From a2b27b63e4c79410f5c10e3109457a008a965a8b Mon Sep 17 00:00:00 2001 From: HoleFish <48403212+HoleFish@users.noreply.github.com> Date: Tue, 28 May 2024 03:26:06 +0800 Subject: Bartworks cleanup (#2628) * cleanup * fix typo --- .../bartworks/API/BioObjectGetter.java | 112 ------------ .../ClientEventHandler/TooltipEventHandler.java | 16 +- .../bartworks/common/configs/ConfigHandler.java | 5 - .../bartworks/common/loaders/BeforeGTPreload.java | 3 +- .../bartworks/common/loaders/ItemRegistry.java | 13 +- .../BW_TileEntity_ExperimentalFloodGate.java | 126 -------------- .../classic/BW_TileEntity_InfinityTank.java | 163 ------------------ .../common/tileentities/debug/CreativeScanner.java | 21 ++- .../multis/GT_TileEntity_CircuitAssemblyLine.java | 4 +- .../tileentities/multis/GT_TileEntity_HTGR.java | 4 +- .../tileentities/multis/GT_TileEntity_LESU.java | 4 +- .../mega/GT_TileEntity_MegaMultiBlockBase.java | 10 -- .../tiered/GT_MetaTileEntity_AcidGenerator.java | 8 +- .../tiered/GT_MetaTileEntity_Diode.java | 8 +- .../GT_MetaTileEntity_EnergyDistributor.java | 8 +- .../tiered/GT_MetaTileEntity_Transistor.java | 157 ----------------- .../bartworks/neiHandler/BW_NEI_OreHandler.java | 14 +- .../bartworks/system/material/Werkstoff.java | 15 +- .../bartworks/util/BW_Tooltip_Reference.java | 3 +- .../bartworks/util/ChatColorHelper.java | 42 ----- .../bartworks/util/RecipeFinderForParallel.java | 187 --------------------- .../tiered/TT_MetaTileEntity_LowPowerLaserBox.java | 6 +- .../TT_MetaTileEntity_Pipe_Energy_LowPower.java | 20 +-- .../tile/GT_Multi_IndustrialCrucible.java | 84 --------- .../crossmod/thaumcraft/tile/GT_WandBuffer.java | 118 ------------- .../thaumcraft/util/ThaumcraftHandler.java | 147 +++------------- 26 files changed, 97 insertions(+), 1201 deletions(-) delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Transistor.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/ChatColorHelper.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java deleted file mode 100644 index ba1308c427..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.API; - -import java.util.Collection; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import com.github.bartimaeusnek.bartworks.common.loaders.BioItemList; -import com.github.bartimaeusnek.bartworks.util.BioCulture; -import com.github.bartimaeusnek.bartworks.util.BioDNA; -import com.github.bartimaeusnek.bartworks.util.BioData; -import com.github.bartimaeusnek.bartworks.util.BioPlasmid; - -public final class BioObjectGetter { - - public static BioCulture getBioCulture(String aName) { - return BioCulture.getBioCulture(aName); - } - - public static NBTTagCompound getNBTTagFromCulture(BioCulture bioCulture) { - return BioCulture.getNBTTagFromCulture(bioCulture); - } - - public static NBTTagCompound getNBTTagFromBioPlasmid(BioPlasmid bioPlasmid) { - return BioObjectGetter.getNBTTagFromBioData(BioObjectGetter.convertBioPlasmidToData(bioPlasmid)); - } - - public static NBTTagCompound getNBTTagFromBioDNA(BioDNA bioDNA) { - return BioObjectGetter.getNBTTagFromBioData(BioObjectGetter.convertBioDNAtoData(bioDNA)); - } - - public static NBTTagCompound getNBTTagFromBioData(BioData bioData) { - return BioData.getNBTTagFromBioData(bioData); - } - - public static BioDNA convertDataToDNA(BioData bioData) { - return BioDNA.convertDataToDNA(bioData); - } - - public static BioPlasmid convertDataToPlasmid(BioData bioData) { - return BioPlasmid.convertDataToPlasmid(bioData); - } - - public static BioData convertBioPlasmidToData(BioPlasmid bioPlasmid) { - return BioData.convertBioPlasmidToBioData(bioPlasmid); - } - - public static BioData convertDataToDNA(BioDNA bioData) { - return BioData.convertBioDNAToBioData(bioData); - } - - public static BioData convertBioDNAtoData(BioDNA bioDNA) { - return BioData.convertBioDNAToBioData(bioDNA); - } - - public static BioPlasmid convertBioDNAtoBioPlasmid(BioDNA bioDNA) { - return BioObjectGetter.convertDataToPlasmid(BioObjectGetter.convertBioDNAtoData(bioDNA)); - } - - public static BioDNA convertBioPlasmidtoBioDNA(BioPlasmid bioPlasmid) { - return BioObjectGetter.convertDataToDNA(BioObjectGetter.convertBioPlasmidToData(bioPlasmid)); - } - - // UNSAFE needs to be reworked! - - public static Collection getAllPetriDishes() { - return BioItemList.getAllPetriDishes(); - } - - public static Collection getAllDNASampleFlasks() { - return BioItemList.getAllDNASampleFlasks(); - } - - public static Collection getAllPlasmidCells() { - return BioItemList.getAllPlasmidCells(); - } - - public static ItemStack getDNASampleFlask(BioDNA dna) { - return BioItemList.getDNASampleFlask(dna); - } - - public static ItemStack getPetriDish(BioCulture culture) { - return BioItemList.getPetriDish(culture); - } - - public static ItemStack getPlasmidCell(BioPlasmid plasmid) { - return BioItemList.getPlasmidCell(plasmid); - } - - /** - * 1 - DetergentPowder 2 - Agarose 3 - IncubationModule 4 - Plasma Membrane - * - * @param selection - * @return the selected Item - */ - public static ItemStack getOther(int selection) { - return BioItemList.getOther(selection); - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/TooltipEventHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/TooltipEventHandler.java index 9f7fb64e4b..0f7cb58bae 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/TooltipEventHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/TooltipEventHandler.java @@ -22,6 +22,7 @@ import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -31,7 +32,6 @@ import com.github.bartimaeusnek.bartworks.common.blocks.BW_Blocks; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import com.github.bartimaeusnek.bartworks.util.Pair; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; @@ -74,18 +74,18 @@ public class TooltipEventHandler { || "BWCore".equals(UI.modId)) break; if (UI.modId.equals(modContainer.getModId())) { tooAdd.add( - "Shared ItemStack between " + ChatColorHelper.DARKGREEN + "Shared ItemStack between " + EnumChatFormatting.DARK_GREEN + "BartWorks" - + ChatColorHelper.GRAY + + EnumChatFormatting.GRAY + " and " - + ChatColorHelper.RED + + EnumChatFormatting.RED + modContainer.getName()); } } } else tooAdd.add( - "Shared ItemStack between " + ChatColorHelper.DARKGREEN + "Shared ItemStack between " + EnumChatFormatting.DARK_GREEN + "BartWorks" - + ChatColorHelper.GRAY + + EnumChatFormatting.GRAY + " and another Mod, that doesn't use the ModContainer propperly!"); } } @@ -107,14 +107,14 @@ public class TooltipEventHandler { StatCollector.translateToLocal("tooltip.glas.0.name") + " " + BW_ColorUtil.getColorForTier(tier) + GT_Values.VN[tier] - + ChatColorHelper.RESET); + + EnumChatFormatting.RESET); } else if (BLOCK.getMaterial() .equals(Material.glass)) { tooAdd.add( StatCollector.translateToLocal("tooltip.glas.0.name") + " " + BW_ColorUtil.getColorForTier(3) + GT_Values.VN[3] - + ChatColorHelper.RESET); + + EnumChatFormatting.RESET); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index ee53c6ec64..4378f87a96 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java @@ -36,14 +36,12 @@ public class ConfigHandler { public static int ross128batier = 3; public static int landerType = 3; public static int ross128bRuinChance = 512; - public static int creativeScannerID; public static int bioVatMaxParallelBonus = 1000; public static int cutoffTier = 5; public static int[][][] metasForTiers; public static long energyPerCell = 1000000L; - public static boolean newStuff = true; public static boolean BioLab = true; public static boolean Ross128Enabled = true; @@ -120,9 +118,6 @@ public class ConfigHandler { false, "Enables the classic Mode (all recipes in normal machines are doable in MV") .getBoolean(false); - ConfigHandler.creativeScannerID = ConfigHandler.c - .get("System", "Creative Debug Scanner", 0, "ID for the Creative Debug Scanner Block") - .getInt(0); ConfigHandler.tooltips = ConfigHandler.c .get("System", "BartWorksToolTips", true, "If you wish to enable extra tooltips") diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BeforeGTPreload.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BeforeGTPreload.java index 88fab90aea..61df90e5d4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BeforeGTPreload.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BeforeGTPreload.java @@ -31,6 +31,7 @@ import cpw.mods.fml.common.LoadController; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; import ic2.core.Ic2Items; @@ -96,7 +97,7 @@ public class BeforeGTPreload implements Runnable { .get(null); GameRegistry.registerBlock(bw_glasses[0], BW_ItemBlocks.class, "BW_GlasBlocks"); GameRegistry.registerBlock(bw_glasses[1], BW_ItemBlocks.class, "BW_GlasBlocks2"); - OreDictionary.registerOre("blockGlassHV", new ItemStack(Blocks.glass, 1, Short.MAX_VALUE)); + OreDictionary.registerOre("blockGlassHV", new ItemStack(Blocks.glass, 1, GT_Values.W)); OreDictionary.registerOre("blockGlassHV", new ItemStack(bw_glasses[0], 1, 0)); OreDictionary.registerOre("blockGlassEV", Ic2Items.reinforcedGlass); OreDictionary.registerOre("blockGlassEV", new ItemStack(bw_glasses[0], 1, 1)); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index 1a655ab4fa..bf57b641e4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -41,7 +41,6 @@ import com.github.bartimaeusnek.bartworks.common.items.GT_Teslastaff_Item; import com.github.bartimaeusnek.bartworks.common.items.SimpleIconItem; import com.github.bartimaeusnek.bartworks.common.items.SimpleSubItemClass; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_RotorBlock; -import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_ExperimentalFloodGate; import com.github.bartimaeusnek.bartworks.common.tileentities.classic.BW_TileEntity_HeatedWaterPump; import com.github.bartimaeusnek.bartworks.common.tileentities.debug.CreativeScanner; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_CircuitAssemblyLine; @@ -151,10 +150,6 @@ public class ItemRegistry { BW_TileEntity_HeatedWaterPump.class, "BWHeatedWaterPump"); public static final Item PUMPPARTS = new SimpleSubItemClass("BWrawtube", "BWmotor"); - public static final Block EXPPUMP = new BW_TileEntityContainer( - Material.coral, - BW_TileEntity_ExperimentalFloodGate.class, - "ExpReversePump"); public static final Block bw_realglas = new BW_GlasBlocks( "BW_GlasBlocks", @@ -253,8 +248,6 @@ public class ItemRegistry { GameRegistry.registerBlock(ItemRegistry.PUMPBLOCK, BW_ItemBlocks.class, "BWHeatedWaterPumpBlock"); GameRegistry.registerItem(ItemRegistry.PUMPPARTS, "BWPumpParts"); GameRegistry.registerItem(ItemRegistry.WINDMETER, "BW_SimpleWindMeter"); - GameRegistry.registerTileEntity(BW_TileEntity_ExperimentalFloodGate.class, "BWExpReversePump"); - GameRegistry.registerBlock(ItemRegistry.EXPPUMP, BW_ItemBlocks.class, "BWExpReversePumpBlock"); // GT2 stuff GameRegistry.registerBlock(ItemRegistry.BW_BLOCKS[0], BW_ItemBlocks.class, "BW_ItemBlocks"); @@ -267,11 +260,7 @@ public class ItemRegistry { GameRegistry.registerItem(ItemRegistry.ROCKCUTTER_HV, ItemRegistry.ROCKCUTTER_HV.getUnlocalizedName()); GameRegistry.registerItem(ItemRegistry.TAB, "tabIconGT2"); - if (ConfigHandler.creativeScannerID != 0) new CreativeScanner( - ConfigHandler.creativeScannerID, - "Creative Debug Scanner", - "Creative Debug Scanner", - 20); + new CreativeScanner(ConfigHandler.IDOffset + 200, "Creative Debug Scanner", "Creative Debug Scanner", 14); ItemRegistry.eic = new GT_TileEntity_ElectricImplosionCompressor( ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 6, "ElectricImplosionCompressor", diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java deleted file mode 100644 index 79bedfa1b8..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_ExperimentalFloodGate.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.common.tileentities.classic; - -import static net.minecraftforge.common.util.ForgeDirection.DOWN; -import static net.minecraftforge.common.util.ForgeDirection.EAST; -import static net.minecraftforge.common.util.ForgeDirection.NORTH; -import static net.minecraftforge.common.util.ForgeDirection.SOUTH; -import static net.minecraftforge.common.util.ForgeDirection.WEST; - -import java.util.Comparator; -import java.util.PriorityQueue; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.TileFluidHandler; - -import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; -import com.github.bartimaeusnek.bartworks.util.Coords; - -public class BW_TileEntity_ExperimentalFloodGate extends TileFluidHandler implements ITileAddsInformation { - - private static final ForgeDirection[] allowed_directions = { DOWN, WEST, EAST, SOUTH, NORTH }; - private PriorityQueue breadthFirstQueue = new PriorityQueue<>(Comparator.comparingInt(x -> x.y)); - private boolean wasInited = false; - - public BW_TileEntity_ExperimentalFloodGate() { - this.tank.setCapacity(64000); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return fluid.canBePlacedInWorld(); - } - - public void initEntity() { - if (this.wasInited) return; - this.breadthFirstQueue.add(new Coords(this.xCoord, this.yCoord, this.zCoord)); - this.wasInited = true; - } - - @Override - public void updateEntity() { - this.initEntity(); - Coords current = this.breadthFirstQueue.poll(); - if (current == null) return; - this.setFluidBlock(current); - for (ForgeDirection allowed_direction : allowed_directions) { - this.addBlockToQueue(current, allowed_direction); - } - } - - @Override - public void writeToNBT(NBTTagCompound tag) { - super.writeToNBT(tag); - tag.setBoolean("init", this.wasInited); - - int[] x = new int[this.breadthFirstQueue.size()]; - int[] y = new int[this.breadthFirstQueue.size()]; - int[] z = new int[this.breadthFirstQueue.size()]; - Coords[] arr = this.breadthFirstQueue.toArray(new Coords[0]); - - for (int i = 0; i < this.breadthFirstQueue.size(); i++) { - x[i] = arr[i].x; - y[i] = arr[i].y; - z[i] = arr[i].z; - } - - tag.setIntArray("queueX", x); - tag.setIntArray("queueY", y); - tag.setIntArray("queueZ", z); - } - - @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - this.wasInited = tag.getBoolean("init"); - int[] x = tag.getIntArray("queueX"); - int[] y = tag.getIntArray("queueY"); - int[] z = tag.getIntArray("queueZ"); - for (int i = 0; i < x.length; i++) { - this.breadthFirstQueue.add(new Coords(x[i], y[i], z[i])); - } - } - - private void setFluidBlock(Coords current) { - if (!this.checkForAir(current) || this.tank.drain(1000, false) == null - || this.tank.drain(1000, false).amount != 1000) return; - FluidStack stack = this.tank.drain(1000, true); - this.worldObj.setBlock( - current.x, - current.y, - current.z, - stack.getFluid() - .getBlock(), - 0, - 2); - } - - private void addBlockToQueue(Coords current, ForgeDirection allowed_direction) { - Coords side = current.getCoordsFromSide(allowed_direction); - if (this.checkForAir(side)) this.breadthFirstQueue.add(side); - } - - private boolean checkForAir(Coords coords) { - return this.worldObj.isAirBlock(coords.x, coords.y, coords.z); - } - - @Override - public String[] getInfoData() { - return new String[] { "Experimental Machine to fill Holes with Fluids" }; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java deleted file mode 100644 index 0dc888c663..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/classic/BW_TileEntity_InfinityTank.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.common.tileentities.classic; - -import java.util.ArrayList; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fluids.IFluidTank; - -import gregtech.api.util.GT_Utility; - -public class BW_TileEntity_InfinityTank extends TileEntity implements IFluidTank, IFluidHandler { - - final ArrayList INTERNALTANKS = new ArrayList<>(); - - int selectedTank; - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return this.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - return this.drain(from, resource != null ? resource.amount : 0, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - return this.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - boolean ret = false; - for (FluidStack stack : this.INTERNALTANKS) { - ret = GT_Utility.areFluidsEqual(stack, new FluidStack(fluid, 0)); - if (ret) { - this.selectedTank = this.INTERNALTANKS.indexOf(stack); - break; - } - } - return ret; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[0]; - } - - @Override - public FluidStack getFluid() { - if (this.INTERNALTANKS.get(this.selectedTank) == null || this.INTERNALTANKS.get(this.selectedTank).amount == 0) - if (this.selectedTank > 0) this.selectedTank = this.INTERNALTANKS.size() - 1; - return this.INTERNALTANKS.get(this.selectedTank); - } - - @Override - public int getFluidAmount() { - return this.INTERNALTANKS.get(this.selectedTank) != null ? this.INTERNALTANKS.get(this.selectedTank).amount : 0; - } - - @Override - public void writeToNBT(NBTTagCompound compound) { - super.writeToNBT(compound); - - NBTTagList lInternalTank = new NBTTagList(); - - for (FluidStack internaltank : this.INTERNALTANKS) { - if (internaltank != null) { - NBTTagCompound entry = new NBTTagCompound(); - entry.setString( - "FluidName", - internaltank.getFluid() - .getName()); - entry.setInteger("Ammount", internaltank.amount); - entry.setTag("FluidTag", internaltank.tag); - lInternalTank.appendTag(entry); - } - } - compound.setTag("InternalTank", lInternalTank); - } - - @Override - public int getCapacity() { - return Integer.MAX_VALUE; - } - - @Override - public FluidTankInfo getInfo() { - return null; - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - if (this.worldObj.isRemote || resource == null || resource.amount == 0) return 0; - - if (!doFill) return resource.amount; - - int id = 0; - - if (this.canDrain(null, resource.getFluid())) { - for (FluidStack stack : this.INTERNALTANKS) if (GT_Utility.areFluidsEqual(stack, resource)) { - this.INTERNALTANKS.get(id = this.INTERNALTANKS.indexOf(stack)).amount += resource.amount; - this.selectedTank = id; - } - } else { - this.INTERNALTANKS.add(resource); - id = this.INTERNALTANKS.size() - 1; - this.selectedTank = id; - } - return this.INTERNALTANKS.get(id).amount; - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - - FluidStack outputstack = this.INTERNALTANKS.get(this.selectedTank); - if (this.worldObj.isRemote || maxDrain == 0 || this.getFluid() == null || outputstack == null) return null; - - int actualdrain = maxDrain; - if (actualdrain > outputstack.amount) actualdrain = outputstack.amount; - FluidStack ret = new FluidStack(outputstack.getFluid(), actualdrain); - if (ret.amount == 0) ret = null; - if (doDrain) { - outputstack.amount -= actualdrain; - FluidEvent.fireEvent( - new FluidEvent.FluidDrainingEvent( - outputstack, - this.getWorldObj(), - this.xCoord, - this.yCoord, - this.zCoord, - this, - actualdrain)); - } - return ret; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java index 2dcc69377e..a34685bb9c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java @@ -13,6 +13,13 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.debug; +import net.minecraft.util.StatCollector; + +import org.apache.commons.lang3.ArrayUtils; + +import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; + +import gregtech.api.enums.MachineType; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -33,9 +40,21 @@ public class CreativeScanner extends GT_MetaTileEntity_Scanner { return new CreativeScanner(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } + @Override + public String[] getDescription() { + return ArrayUtils.addAll( + MachineType.SCANNER.tooltipDescription(), + StatCollector.translateToLocal("gt.blockmachines.creativeScanner.desc.1"), + BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); + } + + @Override + public long maxEUStore() { + return 0; + } + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - this.setEUVar(this.maxEUStore()); this.mProgresstime = this.mMaxProgresstime; super.onPostTick(aBaseMetaTileEntity, aTick); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java index 1f85ea0167..9094d9faaa 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -13,7 +13,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; -import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS; +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS; import static com.github.bartimaeusnek.bartworks.util.BW_Util.ofGlassTieredMixed; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.GT_HatchElement.Energy; @@ -200,7 +200,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends .addOutputBus("As specified in final slice on layer 1", 4) .addOtherStructurePart("EV+ Tier Glass", "As specified on layer 2", 5) .addMaintenanceHatch("Any layer 1 casing", 2) - .toolTipFinisher(ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); + .toolTipFinisher(MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS); return tt; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java index a5ed5a69b7..10620084e2 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java @@ -25,6 +25,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -32,7 +33,6 @@ import net.minecraftforge.fluids.FluidStack; import com.github.bartimaeusnek.bartworks.API.recipe.BartWorksRecipeMaps; import com.github.bartimaeusnek.bartworks.common.items.SimpleSubItemClass; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import com.github.bartimaeusnek.bartworks.util.MathUtils; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -165,7 +165,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase .addOutputHatch("Any bottom layer casing", 1) .addEnergyHatch("Any bottom layer casing", 1) .addMaintenanceHatch("Any bottom layer casing", 1) - .toolTipFinisher(MULTIBLOCK_ADDED_VIA_BARTWORKS.apply(ChatColorHelper.GOLD + "kuba6000")); + .toolTipFinisher(MULTIBLOCK_ADDED_VIA_BARTWORKS.apply(EnumChatFormatting.GOLD + "kuba6000")); return tt; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java index 5a2c3ba382..30b656cbf7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java @@ -21,6 +21,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; @@ -32,7 +33,6 @@ import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import com.github.bartimaeusnek.bartworks.util.ConnectedBlocksChecker; import com.gtnewhorizons.modularui.api.NumberFormatMUI; import com.gtnewhorizons.modularui.api.drawable.Text; @@ -182,7 +182,7 @@ public class GT_TileEntity_LESU extends GT_MetaTileEntity_MultiBlockBase { dsc = StatCollector.translateToLocal("tooltip.tile.lesu.2.name") .split(";"); Collections.addAll(e, dsc); - e.add(ChatColorHelper.RED + StatCollector.translateToLocal("tooltip.tile.lesu.3.name")); + e.add(EnumChatFormatting.RED + StatCollector.translateToLocal("tooltip.tile.lesu.3.name")); e.add(BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); return e.toArray(new String[0]); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java index 223ef65f77..55f37f6712 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaMultiBlockBase.java @@ -6,7 +6,6 @@ import java.util.Arrays; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -35,15 +34,6 @@ public abstract class GT_TileEntity_MegaMultiBlockBase ret = new ArrayList<>(); Arrays.stream(this.getTCAspects()) .forEach(objectIntegerPair -> { - try { - new TC_Aspects.TC_AspectStack( - TC_Aspects.valueOf( - ((String) ThaumcraftHandler.AspectAdder.getName.invoke(objectIntegerPair.getKey())) - .toUpperCase(Locale.US)), - objectIntegerPair.getValue()).addToAspectList(ret); - } catch (IllegalAccessException | InvocationTargetException ignored) {} + new TC_Aspects.TC_AspectStack( + TC_Aspects.valueOf( + ((Aspect) objectIntegerPair.getKey()).getName() + .toUpperCase(Locale.US)), + objectIntegerPair.getValue()).addToAspectList(ret); }); return ret; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Tooltip_Reference.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Tooltip_Reference.java index b68f3fb437..1630113fdb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Tooltip_Reference.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Tooltip_Reference.java @@ -21,11 +21,12 @@ import static net.minecraft.util.EnumChatFormatting.GREEN; import java.util.function.Function; import java.util.function.Supplier; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; public class BW_Tooltip_Reference { - public static final String BW_NO_RESET = ChatColorHelper.DARKGREEN + "BartWorks"; + public static final String BW_NO_RESET = EnumChatFormatting.DARK_GREEN + "BartWorks"; public static final String TT_NO_RESET = BLUE + "Tec" + DARK_BLUE + "Tech"; public static final String BW = BW_NO_RESET + GRAY; public static final String TT = TT_NO_RESET + GRAY; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ChatColorHelper.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ChatColorHelper.java deleted file mode 100644 index f1d6eeedb3..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/ChatColorHelper.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018-2019 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.util; - -public class ChatColorHelper { - - private ChatColorHelper() {} - - public static final String BLACK = (char) 167 + "0"; - public static final String DARKBLUE = (char) 167 + "1"; - public static final String DARKGREEN = (char) 167 + "2"; - public static final String DARKAQUA = (char) 167 + "3"; - public static final String DARKRED = (char) 167 + "4"; - public static final String DARKPURPLE = (char) 167 + "5"; - public static final String GOLD = (char) 167 + "6"; - public static final String GRAY = (char) 167 + "7"; - public static final String DARKGRAY = (char) 167 + "8"; - public static final String BLUE = (char) 167 + "9"; - public static final String GREEN = (char) 167 + "a"; - public static final String AQUA = (char) 167 + "b"; - public static final String RED = (char) 167 + "c"; - public static final String LIGHT_PURPLE = (char) 167 + "d"; - public static final String YELLOW = (char) 167 + "e"; - public static final String WHITE = (char) 167 + "f"; - public static final String OBFUSCATED = (char) 167 + "k"; - public static final String BOLD = (char) 167 + "l"; - public static final String STRIKETHROUGH = (char) 167 + "m"; - public static final String UNDERLINE = (char) 167 + "n"; - public static final String ITALIC = (char) 167 + "o"; - public static final String RESET = (char) 167 + "r"; -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java deleted file mode 100644 index d0850b20c5..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.github.bartimaeusnek.bartworks.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -/** - * Handle the parallel more efficient. - * - * @author GlodBlock - */ -public class RecipeFinderForParallel { - - /** - * This method is used for mega multis which have extremely high parallel. Never use it for non parallel machines, - * it will have worse performance. It will auto consume the inputs. - * - * @param aRecipe The target recipe that you want calculate the parallel - * @param aFluidInputs The input fluid from machine - * @param aItemStacks The input item from machine - * @param aMaxParallel The max parallel that it can reach - * @return The parallel that it can reach - */ - public static int handleParallelRecipe(GT_Recipe aRecipe, FluidStack[] aFluidInputs, ItemStack[] aItemStacks, - int aMaxParallel) { - if (aFluidInputs == null) aFluidInputs = new FluidStack[0]; - if (aItemStacks == null) aItemStacks = new ItemStack[0]; - HashMap tCompressedFluidInput = compressFluid(aFluidInputs); - HashMap tCompressedItemInput = compressItem(aItemStacks); - HashMap tCompressedFluidRecipe = compressFluid(aRecipe.mFluidInputs); - HashMap tCompressedItemRecipe = compressItem(aRecipe.mInputs); - int tCurrentPara = aMaxParallel; - for (int tFluid : tCompressedFluidRecipe.keySet()) { - if (tCompressedFluidInput.containsKey(tFluid) && tCompressedFluidRecipe.get(tFluid) != 0) { - tCurrentPara = Math - .min(tCurrentPara, tCompressedFluidInput.get(tFluid) / tCompressedFluidRecipe.get(tFluid)); - } - } - for (int tItem : tCompressedItemRecipe.keySet()) { - /* Wildcard Stuff */ - if (tItem