diff options
author | HoleFish <48403212+HoleFish@users.noreply.github.com> | 2024-05-28 03:26:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-27 21:26:06 +0200 |
commit | a2b27b63e4c79410f5c10e3109457a008a965a8b (patch) | |
tree | 8705e2f83720a6ffc5d2512836ee2c042468699c /src/main | |
parent | 8412213eedb7db1c13738dce63b76da864c353a1 (diff) | |
download | GT5-Unofficial-a2b27b63e4c79410f5c10e3109457a008a965a8b.tar.gz GT5-Unofficial-a2b27b63e4c79410f5c10e3109457a008a965a8b.tar.bz2 GT5-Unofficial-a2b27b63e4c79410f5c10e3109457a008a965a8b.zip |
Bartworks cleanup (#2628)
* cleanup
* fix typo
Diffstat (limited to 'src/main')
27 files changed, 98 insertions, 1201 deletions
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<ItemStack> getAllPetriDishes() { - return BioItemList.getAllPetriDishes(); - } - - public static Collection<ItemStack> getAllDNASampleFlasks() { - return BioItemList.getAllDNASampleFlasks(); - } - - public static Collection<ItemStack> 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<Coords> 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<FluidStack> 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; @@ -34,8 +41,20 @@ public class CreativeScanner extends GT_MetaTileEntity_Scanner { } @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<T extends GT_TileEntity_M super(aName); } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - // Migration code - if (aNBT.hasKey("lEUt")) { - this.lEUt = aNBT.getLong("lEUt"); - } - } - protected String[] getExtendedInfoData() { return new String[0]; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java index c50e6cbd12..5dc2ccdde5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_AcidGenerator.java @@ -13,12 +13,12 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.tiered; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import com.github.bartimaeusnek.bartworks.API.recipe.BartWorksRecipeMaps; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; @@ -144,13 +144,13 @@ public class GT_MetaTileEntity_AcidGenerator extends GT_MetaTileEntity_BasicGene return new String[] { StatCollector.translateToLocal("tooltip.tile.acidgen.0.name"), StatCollector.translateToLocal("tooltip.tile.acidgen.1.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Values.V[this.mTier], StatCollector.translateToLocal("tooltip.rotor.2.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + this.getEfficiency(), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + this.maxAmperesOut(), BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java index 76a9c1646e..57512e40c0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java @@ -15,6 +15,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.tiered; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; @@ -22,7 +23,6 @@ import org.apache.commons.lang3.ArrayUtils; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; @@ -123,13 +123,13 @@ public class GT_MetaTileEntity_Diode extends GT_MetaTileEntity_BasicHull { return ArrayUtils.addAll( this.mDescriptionArray, StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_Values.V[this.mTier]), StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxAmperesIn()), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxAmperesOut()), BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java index 4431015ca8..a3fe064ef7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_EnergyDistributor.java @@ -13,10 +13,10 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.tiered; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; @@ -74,13 +74,13 @@ public class GT_MetaTileEntity_EnergyDistributor extends GT_MetaTileEntity_Trans public String[] getDescription() { return new String[] { StatCollector.translateToLocal("tooltip.tile.energydistributor.0.name"), StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_Values.V[this.mTier]), StatCollector.translateToLocal("tooltip.tile.tiereddsc.1.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxAmperesIn()), StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " - + ChatColorHelper.YELLOW + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxAmperesOut()), BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Transistor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Transistor.java deleted file mode 100644 index 46f20e441d..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Transistor.java +++ /dev/null @@ -1,157 +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.tiered; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; - -public class GT_MetaTileEntity_Transistor extends GT_MetaTileEntity_TieredMachineBlock { - - boolean powered; - - public GT_MetaTileEntity_Transistor(int aID, String aName, String aNameRegional, int aTier, String aDescription, - ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 0, aDescription, aTextures); - } - - public GT_MetaTileEntity_Transistor(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, - ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 0, aDescription, aTextures); - } - - public GT_MetaTileEntity_Transistor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - } - - public GT_MetaTileEntity_Transistor(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[12][17][]; - - for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; - rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; - rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; - rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; - rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier] }; - rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier] }; - rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier] }; - rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; - } - - return rTextures; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_MetaTileEntity_Transistor(this.mName, this.mTier, this.getDescription(), null); - } - - @Override - public void saveNBTData(NBTTagCompound nbtTagCompound) {} - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - final ForgeDirection side = ForgeDirection.EAST; - if (aBaseMetaTileEntity.inputEnergyFrom(side)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(side); - if (!(tTileEntity instanceof IBasicEnergyContainer tileAtSide)) { - this.powered = false; - return; - } - if (!tileAtSide.outputsEnergyTo(ForgeDirection.WEST) || !tileAtSide.isUniversalEnergyStored(4L) - || !tileAtSide.decreaseStoredEnergyUnits(4, false)) { - this.powered = false; - return; - } - if (aBaseMetaTileEntity.injectEnergyUnits(side, 4L, 1L) == 4L) { - this.powered = true; - } - } - - if (aBaseMetaTileEntity.isAllowedToWork()) this.powered = !this.powered; - } - } - - @Override - public long maxEUInput() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxAmperesIn() { - return 1L; - } - - @Override - public long maxAmperesOut() { - return this.powered ? 1L : 0; - } - - @Override - public long maxEUOutput() { - return this.powered ? GT_Values.V[this.mTier] : 0; - } - - @Override - public void loadNBTData(NBTTagCompound nbtTagCompound) {} - - @Override - public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, - ItemStack itemStack) { - return false; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity iGregTechTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean b3, boolean b4) { - return new ITexture[0]; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java index 2b34250512..6664a5b65e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_OreHandler.java @@ -21,6 +21,7 @@ import java.util.Objects; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; @@ -29,7 +30,6 @@ import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128b; import com.github.bartimaeusnek.bartworks.system.oregen.BW_WorldGenRoss128ba; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; @@ -128,13 +128,13 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { return; if (cachedOreRecipe.worldGen != null) GuiDraw.drawString( - ChatColorHelper.BOLD + "DIM: " + ChatColorHelper.RESET + cachedOreRecipe.worldGen.getDimName(), + EnumChatFormatting.BOLD + "DIM: " + EnumChatFormatting.RESET + cachedOreRecipe.worldGen.getDimName(), 0, 40, 0, false); - GuiDraw.drawString(ChatColorHelper.BOLD + "Primary:", 0, 50, 0, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + "Primary:", 0, 50, 0, false); GuiDraw.drawString( cachedOreRecipe.getOtherStacks() .get(0).item.getDisplayName(), @@ -144,7 +144,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { false); if (!cachedOreRecipe.small) { - GuiDraw.drawString(ChatColorHelper.BOLD + "Secondary:", 0, 70, 0, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + "Secondary:", 0, 70, 0, false); GuiDraw.drawString( cachedOreRecipe.getOtherStacks() .get(1).item.getDisplayName(), @@ -152,7 +152,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { 80, 0, false); - GuiDraw.drawString(ChatColorHelper.BOLD + "InBetween:", 0, 90, 0, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + "InBetween:", 0, 90, 0, false); GuiDraw.drawString( cachedOreRecipe.getOtherStacks() .get(2).item.getDisplayName(), @@ -160,7 +160,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { 100, 0, false); - GuiDraw.drawString(ChatColorHelper.BOLD + "Sporadic:", 0, 110, 0, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + "Sporadic:", 0, 110, 0, false); GuiDraw.drawString( cachedOreRecipe.getOtherStacks() .get(3).item.getDisplayName(), @@ -169,7 +169,7 @@ public class BW_NEI_OreHandler extends TemplateRecipeHandler { 0, false); } else if (cachedOreRecipe.worldGen != null) { - GuiDraw.drawString(ChatColorHelper.BOLD + "Amount per Chunk:", 0, 70, 0, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + "Amount per Chunk:", 0, 70, 0, false); GuiDraw.drawString(cachedOreRecipe.worldGen.mDensity + "", 0, 80, 0, false); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index af8651dc6b..50a38869b8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -17,7 +17,6 @@ import static gregtech.api.enums.Mods.GalaxySpace; import static net.minecraft.util.EnumChatFormatting.DARK_PURPLE; import static net.minecraft.util.EnumChatFormatting.GREEN; -import java.lang.reflect.InvocationTargetException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -45,7 +44,6 @@ import com.github.bartimaeusnek.bartworks.util.NonNullWrappedHashMap; import com.github.bartimaeusnek.bartworks.util.Pair; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.github.bartimaeusnek.crossmod.tgregworks.MaterialsInjector; -import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; @@ -59,6 +57,7 @@ import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; +import thaumcraft.api.aspects.Aspect; public class Werkstoff implements IColorModulationContainer, ISubTagContainer { @@ -430,13 +429,11 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { final List<TC_Aspects.TC_AspectStack> 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<Integer, Integer> tCompressedFluidInput = compressFluid(aFluidInputs); - HashMap<Integer, Integer> tCompressedItemInput = compressItem(aItemStacks); - HashMap<Integer, Integer> tCompressedFluidRecipe = compressFluid(aRecipe.mFluidInputs); - HashMap<Integer, Integer> 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 >> 16 == Short.MAX_VALUE) { - int tCountWildcard = 0; - for (int tInputItem : tCompressedItemInput.keySet()) { - if ((tInputItem & 0xffff) == (tItem & 0xffff)) { - tCountWildcard += tCompressedItemInput.get(tInputItem); - } - } - tCurrentPara = Math.min(tCurrentPara, tCountWildcard / tCompressedItemRecipe.get(tItem)); - } else if (tCompressedItemRecipe.get(tItem) != 0) { - /* OreDict Stuff */ - int tCountOre = 0; - ItemStack tRealRecipe = GT_Utility.intToStack(tItem); - for (int tInputItem : tCompressedItemInput.keySet()) { - ItemStack tRealStack = GT_Utility.intToStack(tInputItem); - if (GT_OreDictUnificator.isInputStackEqual(tRealStack, tRealRecipe)) { - tCountOre += tCompressedItemInput.get(tInputItem); - } - } - tCurrentPara = Math.min(tCurrentPara, tCountOre / tCompressedItemRecipe.get(tItem)); - } - } - - for (int tFluid : tCompressedFluidRecipe.keySet()) { - int tOldSize = tCompressedFluidRecipe.get(tFluid); - tCompressedFluidRecipe.put(tFluid, tOldSize * tCurrentPara); - } - for (int tItem : tCompressedItemRecipe.keySet()) { - int tOldSize = tCompressedItemRecipe.get(tItem); - tCompressedItemRecipe.put(tItem, tOldSize * tCurrentPara); - } - - for (FluidStack tFluid : aFluidInputs) { - if (tFluid != null && tCompressedFluidRecipe.containsKey(tFluid.getFluidID())) { - if (tFluid.amount >= tCompressedFluidRecipe.get(tFluid.getFluidID())) { - tFluid.amount -= tCompressedFluidRecipe.get(tFluid.getFluidID()); - tCompressedFluidRecipe.remove(tFluid.getFluidID()); - } else { - tCompressedFluidRecipe - .put(tFluid.getFluidID(), tCompressedFluidRecipe.get(tFluid.getFluidID()) - tFluid.amount); - tFluid.amount = 0; - } - } - } - - /* OreDict Stuff */ - /* Wildcard Stuff */ - for (Iterator<Integer> i = tCompressedItemRecipe.keySet() - .iterator(); i.hasNext();) { - int tItem = i.next(); - if (tItem >> 16 == Short.MAX_VALUE) { - for (ItemStack tInputItem : aItemStacks) { - int InputID = GT_Utility.stackToInt(tInputItem); - if ((InputID & 0xffff) == (tItem & 0xffff)) { - if (tInputItem.stackSize >= tCompressedItemRecipe.get(tItem)) { - tInputItem.stackSize -= tCompressedItemRecipe.get(tItem); - i.remove(); - break; - } - tCompressedItemRecipe.put(tItem, tCompressedItemRecipe.get(tItem) - tInputItem.stackSize); - tInputItem.stackSize = 0; - } - } - } else { - ItemStack tRealRecipe = GT_Utility.intToStack(tItem); - int tTargetAmount = tCompressedItemRecipe.get(tItem); - for (ItemStack input : aItemStacks) { - if (GT_OreDictUnificator.isInputStackEqual(input, tRealRecipe)) { - int d = Math.min(tTargetAmount, input.stackSize); - tTargetAmount -= d; - tCompressedItemRecipe.put(tItem, tTargetAmount); - input.stackSize -= d; - } - if (tTargetAmount == 0) { - i.remove(); - break; - } - } - } - } - - return tCurrentPara; - } - - /** - * Get the proper packed output stacks - * - * @param aRecipe The target recipe - * @param aPall The parallel it has - * @return A pair of the output fluid and item stack, the first value is fluid, the second is item. - */ - public static Pair<ArrayList<FluidStack>, ArrayList<ItemStack>> getMultiOutput(GT_Recipe aRecipe, int aPall) { - ArrayList<FluidStack> tFluidList = new ArrayList<>(); - ArrayList<ItemStack> tItemList = new ArrayList<>(); - if (aRecipe == null) return new Pair<>(tFluidList, tItemList); - if (aRecipe.mFluidOutputs != null && aRecipe.mFluidOutputs.length > 0) { - for (FluidStack tFluid : aRecipe.mFluidOutputs) { - if (tFluid != null && tFluid.amount > 0) { - tFluidList.add(new FluidStack(tFluid.getFluid(), tFluid.amount * aPall)); - } - } - } - if (aRecipe.mOutputs != null && aRecipe.mOutputs.length > 0) { - for (ItemStack tItem : aRecipe.mOutputs) { - if (tItem != null && tItem.stackSize > 0) { - int tAmount = tItem.stackSize * aPall; - while (tAmount > tItem.getMaxStackSize()) { - tItemList.add(GT_Utility.copyAmount(tItem.getMaxStackSize(), tItem)); - tAmount -= tItem.getMaxStackSize(); - } - tItemList.add(GT_Utility.copyAmount(tAmount, tItem)); - } - } - } - return new Pair<>(tFluidList, tItemList); - } - - public static HashMap<Integer, Integer> compressItem(ItemStack[] aItemStacks) { - HashMap<Integer, Integer> tCompressed = new HashMap<>(); - for (ItemStack tItem : aItemStacks) { - if (tItem != null) { - int tItemID = GT_Utility.stackToInt(tItem); - int tItemSize = tItem.stackSize; - tCompressed.merge(tItemID, tItemSize, Integer::sum); - } - } - return tCompressed; - } - - public static HashMap<Integer, Integer> compressFluid(FluidStack[] aFluidStack) { - HashMap<Integer, Integer> tCompressed = new HashMap<>(); - for (FluidStack tFluid : aFluidStack) { - if (tFluid != null) { - int tFluidID = tFluid.getFluidID(); - int tFluidSize = tFluid.amount; - tCompressed.merge(tFluidID, tFluidSize, Integer::sum); - } - } - return tCompressed; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserBox.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserBox.java index b79ddb4a44..4b50dab64f 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserBox.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserBox.java @@ -13,10 +13,10 @@ package com.github.bartimaeusnek.crossmod.tectech.tileentites.tiered; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -168,9 +168,9 @@ public class TT_MetaTileEntity_LowPowerLaserBox extends TT_Abstract_LowPowerLase @Override public String[] getDescription() { return new String[] { "Like a Tranformer... but for LAZORZ", - "Transfer rate: " + ChatColorHelper.YELLOW + "Transfer rate: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.getTotalPower()) - + ChatColorHelper.WHITE + + EnumChatFormatting.WHITE + " EU/t", BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_Pipe_Energy_LowPower.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_Pipe_Energy_LowPower.java index 38ad31688d..a51e9998ae 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_Pipe_Energy_LowPower.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_Pipe_Energy_LowPower.java @@ -18,10 +18,10 @@ import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ITexture; @@ -77,22 +77,22 @@ public class TT_MetaTileEntity_Pipe_Energy_LowPower extends GT_MetaPipeEntity_Ca public String[] getDescription() { return new String[] { "Primitive Laser Cable intended for Low Power Applications", "Does not auto-connect", "Does not turn or bend", - ChatColorHelper.WHITE + "Must be " - + ChatColorHelper.YELLOW + EnumChatFormatting.WHITE + "Must be " + + EnumChatFormatting.YELLOW + "c" - + ChatColorHelper.RED + + EnumChatFormatting.RED + "o" - + ChatColorHelper.BLUE + + EnumChatFormatting.BLUE + "l" - + ChatColorHelper.DARKPURPLE + + EnumChatFormatting.DARK_PURPLE + "o" - + ChatColorHelper.GOLD + + EnumChatFormatting.GOLD + "r" - + ChatColorHelper.DARKRED + + EnumChatFormatting.DARK_RED + "e" - + ChatColorHelper.DARKGREEN + + EnumChatFormatting.DARK_GREEN + "d" - + ChatColorHelper.WHITE + + EnumChatFormatting.WHITE + " in order to work", BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java deleted file mode 100644 index c52e440383..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java +++ /dev/null @@ -1,84 +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.crossmod.thaumcraft.tile; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; - -public class GT_Multi_IndustrialCrucible extends GT_MetaTileEntity_MultiBlockBase { - - public GT_Multi_IndustrialCrucible(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_Multi_IndustrialCrucible(String aName) { - super(aName); - } - - @Override - public boolean isCorrectMachinePart(ItemStack itemStack) { - return false; - } - - @Override - public boolean checkRecipe(ItemStack itemStack) { - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; - } - - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 0; - } - - @Override - public int getPollutionPerTick(ItemStack itemStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack itemStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack itemStack) { - return false; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return null; - } - - @Override - public String[] getDescription() { - return new String[0]; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity iGregTechTileEntity, ForgeDirection side, ForgeDirection facing, - int colorIndex, boolean b3, boolean b4) { - return new ITexture[0]; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java deleted file mode 100644 index 79e606d536..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java +++ /dev/null @@ -1,118 +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.crossmod.thaumcraft.tile; - -import net.minecraft.item.ItemStack; - -import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; -import gregtech.api.util.GT_ModHandler; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class GT_WandBuffer extends GT_MetaTileEntity_BasicBatteryBuffer { - - public GT_WandBuffer(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); - } - - public GT_WandBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { - super(aName, aTier, aDescription, aTextures, aSlotCount); - } - - public GT_WandBuffer(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { - super(aName, aTier, aDescription, aTextures, aSlotCount); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mBatteryCount = 0; - this.mChargeableCount = 0; - - for (ItemStack tStack : this.mInventory) { - if (ThaumcraftHandler.isWand(tStack)) { - ++this.mBatteryCount; - ++this.mChargeableCount; - } - } - } - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return ThaumcraftHandler.isWand(aStack); - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return ThaumcraftHandler.isWand(aStack); - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - @Override - public long[] getStoredEnergy() { - boolean scaleOverflow = false; - boolean storedOverflow = false; - long tScale = this.getBaseMetaTileEntity() - .getEUCapacity(); - long tStored = this.getBaseMetaTileEntity() - .getStoredEU(); - long tStep; - if (this.mInventory != null) { - - for (ItemStack aStack : this.mInventory) { - if (GT_ModHandler.isElectricItem(aStack)) { - if (aStack.getItem() instanceof GT_MetaBase_Item) { - Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack); - if (stats != null) { - if (stats[0] > 4611686018427387903L) { - scaleOverflow = true; - } - - tScale += stats[0]; - tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack); - if (tStep > 4611686018427387903L) { - storedOverflow = true; - } - - tStored += tStep; - } - } else if (aStack.getItem() instanceof IElectricItem) { - tStored += (long) ElectricItem.manager.getCharge(aStack); - tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack); - } - } - } - } - - if (scaleOverflow) { - tScale = 9223372036854775807L; - } - - if (storedOverflow) { - tStored = 9223372036854775807L; - } - - return new long[] { tStored, tScale }; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java index 9492a6c077..124901effb 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java @@ -13,154 +13,47 @@ package com.github.bartimaeusnek.crossmod.thaumcraft.util; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.biome.BiomeGenBase; import com.github.bartimaeusnek.bartworks.API.API_ConfigValues; import com.github.bartimaeusnek.bartworks.util.Pair; import com.github.bartimaeusnek.bartworks.util.log.DebugLog; -import gregtech.api.enums.TC_Aspects; +import thaumcraft.api.ThaumcraftApi; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; public class ThaumcraftHandler { - private ThaumcraftHandler() {} - - private static Integer taintBiomeID; - private static Integer magicalForestBiomeID; - private static Class<?> mWandInterface; - - static { - try { - ThaumcraftHandler.mWandInterface = Class.forName("thaumcraft.common.items.wands.ItemWandCasting"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - - public static boolean isWand(ItemStack aStack) { - try { - return aStack != null && ThaumcraftHandler.mWandInterface.isAssignableFrom( - aStack.getItem() - .getClass()); - } catch (Throwable var3) { - return false; - } - } - public static boolean isMagicalForestBiome(int biomeID) { - if (ThaumcraftHandler.magicalForestBiomeID == null) { - try { - BiomeGenBase biome = (BiomeGenBase) Class - .forName("thaumcraft.common.lib.world.ThaumcraftWorldGenerator") - .getField("biomeMagicalForest") - .get(null); - return biomeID == (ThaumcraftHandler.magicalForestBiomeID = biome.biomeID); - } catch (ClassCastException | ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - return false; - } - } - return biomeID == ThaumcraftHandler.magicalForestBiomeID; + return biomeID == ThaumcraftWorldGenerator.biomeMagicalForest.biomeID; } public static boolean isTaintBiome(int biomeID) { - if (ThaumcraftHandler.taintBiomeID == null) { - try { - BiomeGenBase TaintBiome = (BiomeGenBase) Class - .forName("thaumcraft.common.lib.world.ThaumcraftWorldGenerator") - .getField("biomeTaint") - .get(null); - return biomeID == (ThaumcraftHandler.taintBiomeID = TaintBiome.biomeID); - } catch (ClassCastException | ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - return false; - } - } - return biomeID == ThaumcraftHandler.taintBiomeID; + return biomeID == ThaumcraftWorldGenerator.biomeTaint.biomeID; } public static class AspectAdder { - public static Class<?> mAspectListClass; - public static Class<?> mAspectClass; - public static Method registerObjectTag; - public static Method addToList; - public static Method getName; - public static Method writeAspectListToNBT; - public static Method readAspectListFromNBT; - public static Method add; - public static Method getAmount; - public static Method getAspects; - public static Method isResearchComplete; - public static Field linkedAspektList; - - static { - try { - ThaumcraftHandler.AspectAdder.mAspectListClass = Class.forName("thaumcraft.api.aspects.AspectList"); - ThaumcraftHandler.AspectAdder.mAspectClass = Class.forName("thaumcraft.api.aspects.Aspect"); - ThaumcraftHandler.AspectAdder.addToList = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("add", ThaumcraftHandler.AspectAdder.mAspectClass, int.class); - ThaumcraftHandler.AspectAdder.registerObjectTag = Class.forName("thaumcraft.api.ThaumcraftApi") - .getMethod("registerObjectTag", ItemStack.class, ThaumcraftHandler.AspectAdder.mAspectListClass); - ThaumcraftHandler.AspectAdder.getName = ThaumcraftHandler.AspectAdder.mAspectClass.getMethod("getName"); - ThaumcraftHandler.AspectAdder.writeAspectListToNBT = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("writeToNBT", NBTTagCompound.class); - ThaumcraftHandler.AspectAdder.add = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("add", ThaumcraftHandler.AspectAdder.mAspectListClass); - ThaumcraftHandler.AspectAdder.getAmount = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("getAmount", ThaumcraftHandler.AspectAdder.mAspectClass); - ThaumcraftHandler.AspectAdder.getAspects = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("getAspects"); - ThaumcraftHandler.AspectAdder.readAspectListFromNBT = ThaumcraftHandler.AspectAdder.mAspectListClass - .getMethod("readFromNBT", NBTTagCompound.class); - ThaumcraftHandler.AspectAdder.isResearchComplete = Class - .forName("thaumcraft.common.lib.research.ResearchManager") - .getMethod("isResearchComplete", String.class, String.class); - ThaumcraftHandler.AspectAdder.linkedAspektList = ThaumcraftHandler.AspectAdder.mAspectListClass - .getField("aspects"); - } catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException e) { - e.printStackTrace(); - } - } - @SafeVarargs public static void addAspectViaBW(ItemStack stack, Pair<Object, Integer>... aspectPair) { if (stack == null || stack.getItem() == null || stack.getUnlocalizedName() == null) return; - try { - Object aspectList = ThaumcraftHandler.AspectAdder.mAspectListClass.getConstructor() - .newInstance(); - for (Pair<Object, Integer> a : aspectPair) { - if (API_ConfigValues.debugLog) DebugLog.log( - "Stack:" + stack.getDisplayName() - + " Damage:" - + stack.getItemDamage() - + " aspectPair: " - + ThaumcraftHandler.AspectAdder.getName.invoke(a.getKey()) - + " / " - + a.getValue()); - ThaumcraftHandler.AspectAdder.addToList.invoke(aspectList, a.getKey(), a.getValue()); - } - ThaumcraftHandler.AspectAdder.registerObjectTag.invoke(null, stack, aspectList); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void addAspectViaGT(ItemStack stack, TC_Aspects.TC_AspectStack... tc_aspectStacks) { - try { - Object aspectList = ThaumcraftHandler.AspectAdder.mAspectListClass.getConstructor() - .newInstance(); - for (TC_Aspects.TC_AspectStack tc_aspects : tc_aspectStacks) ThaumcraftHandler.AspectAdder.addToList - .invoke(aspectList, tc_aspects.mAspect.mAspect, (int) tc_aspects.mAmount); - ThaumcraftHandler.AspectAdder.registerObjectTag.invoke(null, stack, aspectList); - } catch (Exception e) { - e.printStackTrace(); + AspectList aspectList = new AspectList(); + for (Pair<Object, Integer> a : aspectPair) { + Aspect aspect = (Aspect) a.getKey(); + int amount = a.getValue(); + if (API_ConfigValues.debugLog) DebugLog.log( + "Stack:" + stack.getDisplayName() + + " Damage:" + + stack.getItemDamage() + + " aspectPair: " + + aspect.getName() + + " / " + + amount); + aspectList.add(aspect, amount); } + ThaumcraftApi.registerObjectTag(stack, aspectList); } } } diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 7ec5d318d0..1b0482cfd0 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -32,6 +32,7 @@ tile.BWHeatedWaterPump.0.name=Simple Stirling Water Pump item.BWrawtube.name=Elongated Glass Tube item.BWmotor.name=Simple Stirling Motor item.BWstove.name=Simple Heated Stove +gt.blockmachines.creativeScanner.desc.1=Finishes Scanning instantly. Does not require power. itemGroup.BioTab=BartWorks BioEngineering filled.item.petriDish.name=Petri Dish with a Culture |