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/java | |
| 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/java')
26 files changed, 97 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); |
