aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/core')
-rw-r--r--src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java86
-rw-r--r--src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java106
-rw-r--r--src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java67
-rw-r--r--src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java124
-rw-r--r--src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java14
-rw-r--r--src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java14
-rw-r--r--src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java14
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java636
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java43
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java57
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java57
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java45
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java84
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java60
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java101
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java91
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java96
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java75
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java314
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java216
-rw-r--r--src/main/java/gtPlusPlus/core/players/FakeFarmer.java85
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotBlockedInv.java39
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java52
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotGtTool.java30
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotLunchBox.java29
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotMagicToolBag.java29
-rw-r--r--src/main/java/gtPlusPlus/core/slots/SlotToolBox.java107
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java157
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java441
-rw-r--r--src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java61
-rw-r--r--src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java17
-rw-r--r--src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java85
32 files changed, 0 insertions, 3432 deletions
diff --git a/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java b/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java
deleted file mode 100644
index 55f1df240f..0000000000
--- a/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package gtPlusPlus.core.block.base;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockContainer;
-import net.minecraft.block.material.Material;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.Explosion;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.item.base.itemblock.ItemBlockNBT;
-
-public abstract class BlockBaseNBT extends BlockContainer {
-
- @SideOnly(Side.CLIENT)
- private IIcon textureTop;
-
- @SideOnly(Side.CLIENT)
- private IIcon textureBottom;
-
- @SideOnly(Side.CLIENT)
- private IIcon textureFront;
-
- public BlockBaseNBT(final Material material, final String unlocalName, final String displayName) {
- super(material);
- this.setBlockName(unlocalName);
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- GameRegistry.registerBlock(this, ItemBlockNBT.class, unlocalName);
- // LanguageRegistry.addName(this, displayName);
- }
-
- /**
- * Gets the block's texture. Args: side, meta
- */
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(final int ordinalSide, final int meta) {
- return ordinalSide == 1 ? this.textureTop
- : (ordinalSide == 0 ? this.textureBottom
- : ((ordinalSide != 2) && (ordinalSide != 4) ? this.blockIcon : this.textureFront));
- }
-
- @Override
- public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_);
-
- @Override
- public void breakBlock(final World world, final int x, final int y, final int z, final Block block,
- final int meta) {
- super.breakBlock(world, x, y, z, block, meta);
- }
-
- @Override
- public void onBlockDestroyedByPlayer(final World world, final int x, final int y, final int z, final int meta) {
- super.onBlockDestroyedByPlayer(world, x, y, z, meta);
- }
-
- @Override
- public void onBlockDestroyedByExplosion(final World world, final int x, final int y, final int z,
- final Explosion explosion) {
- super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
- }
-
- @Override
- public void onBlockHarvested(final World world, final int x, final int y, final int z, final int meta,
- final EntityPlayer player) {
- super.onBlockHarvested(world, x, y, z, meta, player);
- }
-
- @Override
- public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion) {
- super.onBlockExploded(world, x, y, z, explosion);
- }
-
- @Override
- public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y,
- final int z) {
- return false;
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java
deleted file mode 100644
index 9c4fb4d66a..0000000000
--- a/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package gtPlusPlus.core.fluids;
-
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.BlockFluidClassic;
-import net.minecraftforge.fluids.Fluid;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.util.Utils;
-
-public class BlockFluidBase extends BlockFluidClassic {
-
- @SideOnly(Side.CLIENT)
- protected static IIcon stillIcon;
-
- @SideOnly(Side.CLIENT)
- protected static IIcon flowingIcon;
-
- protected final short[] mRGB;
-
- public BlockFluidBase(Fluid fluid, short[] aRGB) {
- this(fluid, Material.water, aRGB);
- }
-
- public BlockFluidBase(Fluid fluid, Material material, short[] aRGB) {
- super(fluid, material);
- mRGB = aRGB;
- this.setHardness(100.0F);
- this.setLightOpacity(3);
- this.disableStats();
- }
-
- @Override
- public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity ent) {
- if (!(ent instanceof EntityLivingBase)) {
- return;
- }
- /*
- * EntityLivingBase player = (EntityLivingBase) ent; int pot = world.rand.nextInt(Potion.potionTypes.length);
- * Potion.potionTypes[pot].performEffect(player, 40);
- */
- }
-
- @Override
- public IIcon getIcon(int ordinalSide, int meta) {
- return (ordinalSide == 0 || ordinalSide == 1) ? stillIcon : flowingIcon;
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public void registerBlockIcons(IIconRegister register) {
- if (stillIcon == null) {
- stillIcon = register.registerIcon(GTPlusPlus.ID + ":" + "fluids/fluid.fluid.autogenerated.still");
- }
- if (flowingIcon == null) {
- flowingIcon = register.registerIcon(GTPlusPlus.ID + ":" + "fluids/fluid.fluid.autogenerated.flowing");
- }
- }
-
- @Override
- public int getBlockColor() {
- if (mRGB != null && mRGB.length >= 3) {
- return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]);
- }
- return super.getBlockColor();
- }
-
- @Override
- public int getRenderColor(int aMeta) {
- if (mRGB != null && mRGB.length >= 3) {
- return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]);
- }
- return super.getRenderColor(aMeta);
- }
-
- @Override
- public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) {
- // TODO Auto-generated method stub
- return super.recolourBlock(world, x, y, z, side, colour);
- }
-
- @Override
- public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) {
- return false;
- }
- return super.canDisplace(world, x, y, z);
- }
-
- @Override
- public boolean displaceIfPossible(World world, int x, int y, int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) {
- return false;
- }
- return super.displaceIfPossible(world, x, y, z);
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java b/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java
deleted file mode 100644
index 96936cced8..0000000000
--- a/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package gtPlusPlus.core.fluids;
-
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import net.minecraft.block.Block;
-import net.minecraft.item.EnumRarity;
-import net.minecraftforge.fluids.Fluid;
-
-import gregtech.api.GregTech_API;
-
-public class FactoryFluid extends Fluid implements Runnable {
-
- private final String mTextureName;
- private final short[] mRGBa;
-
- public FactoryFluid(String fluidName, final short[] aRGBa) {
- this(
- fluidName,
- null,
- Short.MIN_VALUE,
- Short.MIN_VALUE,
- Short.MIN_VALUE,
- Short.MIN_VALUE,
- false,
- EnumRarity.common,
- aRGBa);
- }
-
- public FactoryFluid(String fluidName, int luminosity, int density, int temp, int viscosity, final short[] aRGBa) {
- this(
- fluidName,
- null,
- luminosity,
- density,
- temp,
- viscosity,
- (density == Short.MIN_VALUE || density >= 0 ? false : true),
- EnumRarity.common,
- aRGBa);
- }
-
- public FactoryFluid(String fluidName, Block aBlock, int luminosity, int density, int temp, int viscosity,
- boolean gas, EnumRarity aRarity, final short[] aRGBa) {
- super(fluidName);
- this.mRGBa = aRGBa;
- this.setBlock(aBlock);
- if (luminosity != Short.MIN_VALUE) this.setLuminosity(luminosity);
- if (density != Short.MIN_VALUE) this.setDensity(density);
- if (temp != Short.MIN_VALUE) this.setTemperature(temp);
- if (viscosity != Short.MIN_VALUE) this.setViscosity(viscosity);
- this.setGaseous(gas);
- this.setRarity(aRarity);
- this.mTextureName = GTPlusPlus.ID + ":fluids/fluid.fluid.autogenerated";
- GregTech_API.sGTBlockIconload.add(this);
- }
-
- @Override
- public int getColor() {
- return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8)
- | Math.max(0, Math.min(255, this.mRGBa[2]));
- }
-
- @Override
- public void run() {
- this.setIcons(GregTech_API.sBlockIcons.registerIcon(this.mTextureName));
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java
deleted file mode 100644
index 5bbb405aa3..0000000000
--- a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package gtPlusPlus.core.gui.item.box;
-
-import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.util.ResourceLocation;
-
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL12;
-
-import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
-import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
-
-public class GuiBaseBox extends GuiContainer {
-
- /**
- * x and y size of the inventory window in pixels. Defined as float, passed as int These are used for drawing the
- * player model.
- */
- private float xSize_lo;
-
- private float ySize_lo;
-
- /**
- * ResourceLocation takes 2 parameters: ModId, path to texture at the location: "src/minecraft/assets/modid/"
- *
- * I have provided a sample texture file that works with this tutorial. Download it from
- * Forge_Tutorials/textures/gui/
- */
- private final ResourceLocation iconLocation;
-
- /** The inventory to render on screen */
- private final CustomBoxInventory inventory;
-
- public GuiBaseBox(ContainerBoxBase containerItem, ResourceLocation aGuiTexture) {
- super(containerItem);
- this.inventory = containerItem.getInventoryObject();
- this.iconLocation = aGuiTexture;
- }
-
- /**
- * Draws the screen and all the components in it.
- */
- @Override
- public void drawScreen(int par1, int par2, float par3) {
- super.drawScreen(par1, par2, par3);
- this.xSize_lo = (float) par1;
- this.ySize_lo = (float) par2;
- }
-
- /**
- * Draw the foreground layer for the GuiContainer (everything in front of the items)
- */
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName()
- : I18n.format(this.inventory.getInventoryName());
- this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752);
- this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752);
- }
-
- /**
- * Draw the background layer for the GuiContainer (everything behind the items)
- */
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(iconLocation);
- int k = (this.width - this.xSize) / 2;
- int l = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
- int i1;
- drawPlayerModel(
- k + 51,
- l + 75,
- 30,
- (float) (k + 51) - this.xSize_lo,
- (float) (l + 75 - 50) - this.ySize_lo,
- this.mc.thePlayer);
- }
-
- /**
- * This renders the player model in standard inventory position (in later versions of Minecraft / Forge, you can
- * simply call GuiInventory.drawEntityOnScreen directly instead of copying this code)
- */
- public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) {
- GL11.glEnable(GL11.GL_COLOR_MATERIAL);
- GL11.glPushMatrix();
- GL11.glTranslatef(x, y, 50.0F);
- GL11.glScalef(-scale, scale, scale);
- GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
- float f2 = entity.renderYawOffset;
- float f3 = entity.rotationYaw;
- float f4 = entity.rotationPitch;
- float f5 = entity.prevRotationYawHead;
- float f6 = entity.rotationYawHead;
- GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
- RenderHelper.enableStandardItemLighting();
- GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
- GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);
- entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F;
- entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F;
- entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F;
- entity.rotationYawHead = entity.rotationYaw;
- entity.prevRotationYawHead = entity.rotationYaw;
- GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
- RenderManager.instance.playerViewY = 180.0F;
- RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
- entity.renderYawOffset = f2;
- entity.rotationYaw = f3;
- entity.rotationPitch = f4;
- entity.prevRotationYawHead = f5;
- entity.rotationYawHead = f6;
- GL11.glPopMatrix();
- RenderHelper.disableStandardItemLighting();
- GL11.glDisable(GL12.GL_RESCALE_NORMAL);
- OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java
deleted file mode 100644
index 80d2d6902f..0000000000
--- a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gtPlusPlus.core.gui.item.box;
-
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import net.minecraft.util.ResourceLocation;
-
-import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
-
-public class LunchBoxGui extends GuiBaseBox {
-
- public LunchBoxGui(ContainerBoxBase containerItem) {
- super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png"));
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java
deleted file mode 100644
index 6858c17afb..0000000000
--- a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gtPlusPlus.core.gui.item.box;
-
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import net.minecraft.util.ResourceLocation;
-
-import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
-
-public class MagicBagGui extends GuiBaseBox {
-
- public MagicBagGui(ContainerBoxBase containerItem) {
- super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png"));
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java
deleted file mode 100644
index 4d994eee41..0000000000
--- a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gtPlusPlus.core.gui.item.box;
-
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import net.minecraft.util.ResourceLocation;
-
-import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
-
-public class ToolBoxGui extends GuiBaseBox {
-
- public ToolBoxGui(ContainerBoxBase containerItem) {
- super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png"));
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java
deleted file mode 100644
index 194e585c0d..0000000000
--- a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java
+++ /dev/null
@@ -1,636 +0,0 @@
-package gtPlusPlus.core.item.base;
-
-import static gregtech.api.enums.GT_Values.D1;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.Mods.GTPlusPlus;
-
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.HashMap;
-import java.util.List;
-
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.Container;
-import net.minecraft.item.EnumRarity;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.IIcon;
-import net.minecraft.util.StatCollector;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.SubTag;
-import gregtech.api.enums.TC_Aspects.TC_AspectStack;
-import gregtech.api.interfaces.IItemBehaviour;
-import gregtech.api.interfaces.IItemContainer;
-import gregtech.api.objects.ItemData;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import ic2.api.item.ElectricItem;
-import ic2.api.item.IElectricItem;
-import ic2.api.item.IElectricItemManager;
-import ic2.api.item.ISpecialElectricItem;
-
-public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager {
-
- /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
- private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<>();
- public final short mOffset, mItemAmount;
- public final BitSet mEnabledItems;
- public final BitSet mVisibleItems;
- public final IIcon[][] mIconList;
- /** The unlocalized name of this item. */
- private String unlocalizedName;
-
- private final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<>();
- private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<>();
- private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<>();
- private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<>();
- private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<>();
-
- public final HashMap<Short, Long[]> mElectricStats = new HashMap<>();
- public final HashMap<Short, Short> mBurnValues = new HashMap<>();
-
- public BaseEuItem() {
- this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766);
- }
-
- public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset,
- final short aItemAmount) {
- this.mEnabledItems = new BitSet(aItemAmount);
- this.mVisibleItems = new BitSet(aItemAmount);
- this.mOffset = (short) Math.min(32766, aOffset);
- this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset);
- this.mIconList = new IIcon[aItemAmount][1];
- this.setHasSubtypes(true);
- this.setMaxDamage(0);
- this.setUnlocalizedName(unlocalizedName);
- this.setCreativeTab(creativeTab);
- this.setMaxStackSize(1);
- GameRegistry.registerItem(this, unlocalizedName);
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final int tier,
- final String description) {
- this.registerItem(
- id,
- localizedName,
- euStorage,
- (short) tier,
- description,
- EnumRarity.common,
- EnumChatFormatting.GRAY,
- false);
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final int tier,
- final String description, final int burnTime) {
- this.registerItem(
- id,
- localizedName,
- euStorage,
- (short) tier,
- description,
- EnumRarity.common,
- EnumChatFormatting.GRAY,
- false);
- this.setBurnValue(id, burnTime);
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final short tier,
- final String description, final EnumRarity regRarity, final EnumChatFormatting colour,
- final boolean Effect) {
- this.addItem(id, localizedName, colour + description, new Object[] {});
- this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true);
- this.rarity.add(new Pair<>(id, regRarity));
- this.hasEffect.add(new Pair<>(id, Effect));
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- if (this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset) != null) {
- return this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset).getValue();
- }
- return EnumRarity.common;
- }
-
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack, final int pass) {
- if (this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset) != null) {
- return this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset).getValue();
- }
- return false;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) {
- // aList.add("Meta: "+(aStack.getItemDamage()-mOffset));
- int keyValue = aStack.getItemDamage() - this.mOffset;
- final String tKey = "gtplusplus." + this.getUnlocalizedName(aStack) + "." + keyValue + ".tooltip",
- tString = GT_LanguageManager.getTranslation(tKey);
- if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) {
- aList.add(tString);
- }
- aList.add(StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.0"));
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats != null) {
- if (tStats[3] > 0) {
- aList.add(
- EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted(
- "item.itemBaseEuItem.tooltip.1",
- GT_Utility.formatNumbers(tStats[3]),
- (tStats[2] >= 0 ? tStats[2] : 0)) + EnumChatFormatting.GRAY);
- } else {
- final long tCharge = this.getRealCharge(aStack);
- if ((tStats[3] == -2) && (tCharge <= 0)) {
- aList.add(
- EnumChatFormatting.AQUA + StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.2")
- + EnumChatFormatting.GRAY);
- } else {
- aList.add(
- EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted(
- "item.itemBaseEuItem.tooltip.3",
- GT_Utility.formatNumbers(tCharge),
- GT_Utility.formatNumbers(Math.abs(tStats[0])),
- V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)])
- + EnumChatFormatting.GRAY);
- }
- }
- }
- final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack));
- if (tList != null) {
- for (final IItemBehaviour<BaseEuItem> tBehavior : tList) {
- aList = tBehavior.getAdditionalToolTips(this, aList, aStack);
- }
- }
- }
-
- @Override
- public final Item getChargedItem(final ItemStack itemStack) {
- return this;
- }
-
- @Override
- public final Item getEmptyItem(final ItemStack itemStack) {
- return this;
- }
-
- @Override
- public final double getMaxCharge(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return 0;
- }
- return Math.abs(tStats[0]);
- }
-
- @Override
- public final double getTransferLimit(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return 0;
- }
- return Math.max(tStats[1], tStats[3]);
- }
-
- @Override
- public final int getTier(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]);
- }
-
- @Override
- public final double charge(final ItemStack aStack, final double aCharge, final int aTier,
- final boolean aIgnoreTransferLimit, final boolean aSimulate) {
- final Long[] tStats = this.getElectricStats(aStack);
- if ((tStats == null) || (tStats[2] > aTier)
- || !((tStats[3] == -1) || (tStats[3] == -3) || ((tStats[3] < 0) && (aCharge == Integer.MAX_VALUE)))
- || (aStack.stackSize != 1)) {
- return 0;
- }
- final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE
- ? Long.MAX_VALUE
- : Math.min(
- Math.abs(tStats[0]),
- tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge)));
- if (!aSimulate) {
- this.setCharge(aStack, tNewCharge);
- }
- return tNewCharge - tChargeBefore;