diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java | 126 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/item/UtilsItems.java | 2 |
2 files changed, 128 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java new file mode 100644 index 0000000000..47ffe70cd7 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java @@ -0,0 +1,126 @@ +package gtPlusPlus.core.item.base.plates; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.math.MathUtils; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; + +public class BaseItemPlateDouble extends Item{ + + protected int colour; + protected String materialName; + protected String unlocalName; + private int mTier; + + public BaseItemPlateDouble(String unlocalizedName, String materialName, int colour, int tier, int sRadioactivity) { + setUnlocalizedName(unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalizedName); + this.unlocalName = unlocalizedName; + this.setMaxStackSize(32); + this.setTextureName(CORE.MODID + ":" + "itemPlateDouble"); + this.colour = colour; + this.mTier = tier; + this.materialName = materialName; + this.sRadiation = sRadioactivity; + GameRegistry.registerItem(this, unlocalizedName); + GT_OreDictUnificator.registerOre(unlocalName.replace("itemP", "p"), UtilsItems.getSimpleStack(this)); + addBendingRecipe(); + addCraftingRecipe(); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + + return ("Double "+materialName+ " Plate"); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + if (materialName != null && materialName != "" && !materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); + } + if (sRadiation > 0){ + list.add(CORE.GT_Tooltip_Radioactive); + } + super.addInformation(stack, aPlayer, list, bool); + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return colour; + + } + + protected final int sRadiation; + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + } + + private void addBendingRecipe(){ + Utils.LOG_WARNING("Adding bender recipe for "+materialName+" Double Plates"); + String tempIngot = unlocalName.replace("itemPlateDouble", "ingot"); + String tempPlate = unlocalName.replace("itemPlateDouble", "plate"); + ItemStack inputIngot = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 2); + ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 2); + if (null != inputIngot){ + GT_Values.RA.addBenderRecipe(inputIngot, + UtilsItems.getSimpleStack(this), + 4*20, + 96); + } + if (null != inputPlate){ + GT_Values.RA.addBenderRecipe(inputPlate, + UtilsItems.getSimpleStack(this), + 4*20, + 96); + } + } + + private void addCraftingRecipe(){ + Utils.LOG_WARNING("Adding crafting recipes for "+materialName+" Double Plates"); + String tempPlate = unlocalName.replace("itemPlateDouble", "plate"); + ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 1); + if (null != inputPlate){ + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}), + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"I", "B", "h", + Character.valueOf('I'), + inputPlate, + Character.valueOf('B'), + inputPlate}); + + GT_ModHandler.addShapelessCraftingRecipe( + GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}), + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + inputPlate, + inputPlate}); + } + } + +} diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java index d6d4a85b23..d68174f7bb 100644 --- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java +++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.item.base.gears.BaseItemGear; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; import gtPlusPlus.core.item.base.plates.BaseItemPlate; +import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.base.rings.BaseItemRing; import gtPlusPlus.core.item.base.rods.BaseItemRod; import gtPlusPlus.core.item.base.rods.BaseItemRodLong; @@ -317,6 +318,7 @@ public class UtilsItems { temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", hotIngot, materialTier, sRadiation); temp = new BaseItemPlate("itemPlate"+unlocalizedName, materialName, Colour, materialTier, sRadiation); + temp = new BaseItemPlateDouble("itemPlateDouble"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemRod("itemRod"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemRodLong("itemRodLong"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemRing("itemRing"+unlocalizedName, materialName, Colour, materialTier); |