aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java48
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java71
2 files changed, 112 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
index 517e3f7c1f..396689ef63 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
@@ -15,6 +15,7 @@ import gtPlusPlus.core.block.base.BlockBaseOre;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialStack;
+import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.EntityUtils;
import gtPlusPlus.core.util.sys.KeyboardUtils;
@@ -44,7 +45,16 @@ public class ItemBlockGtBlock extends ItemBlock {
this.blockColour = block.getBlockColor();
} else {
this.blockColour = block.getBlockColor();
+ }
+
+ if (block instanceof BlockBaseModular){
+ BlockBaseModular g = (BlockBaseModular) block;
+ this.mMaterial = g.getMaterialEx();
+ }
+ else {
+ this.mMaterial = null;
}
+
// GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block",
// "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block",
// "").replace("-", "").replace("_", "").replace(" ", ""),
@@ -59,24 +69,32 @@ public class ItemBlockGtBlock extends ItemBlock {
public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
if (this.mMaterial != null) {
- list.add(this.mMaterial.vChemicalFormula);
- if (this.mMaterial.vRadiationLevel > 0) {
- list.add(CORE.GT_Tooltip_Radioactive);
- }
+ list.add(this.mMaterial.vChemicalFormula);
} else {
- list.add("Material is Null.");
+
+ try {
+ BlockBaseModular g = (BlockBaseModular) thisBlock;
+ this.mMaterial = g.getMaterialEx();
+ }
+ catch (Throwable t) {
+
+ }
+
+
+ //list.add("Material is Null.");
}
+ if (this.isOre) {
if (KeyboardUtils.isCtrlKeyDown()) {
Block b = Block.getBlockFromItem(stack.getItem());
if (b != null) {
String aTool = b.getHarvestTool(stack.getItemDamage());
int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
- list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
if (this.mMaterial != null) {
- list.add("Ore contains: ");
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ list.add("Contains: ");
if (mMaterial.getComposites().isEmpty()) {
list.add("- " + mMaterial.getLocalizedName());
} else {
@@ -89,6 +107,22 @@ public class ItemBlockGtBlock extends ItemBlock {
} else {
list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info.");
}
+ }
+ else {
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ }
+ }
+
+ if (this.mMaterial != null) {
+ if (this.mMaterial.vRadiationLevel > 0) {
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+ }
+
super.addInformation(stack, aPlayer, list, bool);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
index 74dd2f196c..0dd125bf7b 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
@@ -1,18 +1,45 @@
package gtPlusPlus.core.item.base.itemblock;
import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import java.util.List;
import gtPlusPlus.core.block.base.BlockBaseModular;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.MaterialStack;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
public class ItemBlockGtFrameBox extends ItemBlock{
protected int blockColour;
+ private Material mMaterial;
+ private int sRadiation;
public ItemBlockGtFrameBox(final Block block) {
super(block);
final BlockBaseModular baseBlock = (BlockBaseModular) block;
this.blockColour = baseBlock.getRenderColor(1);
+
+
+
+ if (block instanceof BlockBaseModular){
+ BlockBaseModular g = (BlockBaseModular) block;
+ this.mMaterial = g.getMaterialEx();
+ sRadiation = mMaterial.vRadiationLevel;
+ }
+ else {
+ this.mMaterial = null;
+ sRadiation = 0;
+ }
+
//GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this));
}
@@ -20,4 +47,48 @@ public class ItemBlockGtFrameBox extends ItemBlock{
return this.blockColour;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.mMaterial != null) {
+ list.add(this.mMaterial.vChemicalFormula);
+ if (this.mMaterial.vRadiationLevel > 0) {
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+ } else {
+ list.add("Material is Null.");
+ }
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ if (this.mMaterial != null) {
+ list.add("Contains: ");
+ if (mMaterial.getComposites().isEmpty()) {
+ list.add("- " + mMaterial.getLocalizedName());
+ } else {
+ for (MaterialStack m : mMaterial.getComposites()) {
+ list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred());
+ }
+ }
+ }
+ }
+ } else {
+ list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info.");
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
+ final boolean p_77663_5_) {
+
+ if (this.sRadiation > 0) {
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding);
+ }
+ }
+
+
}