diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-09-10 13:13:29 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-09-10 13:13:29 +1000 |
commit | e71696f3140dfb549f37f28308176524e521e3eb (patch) | |
tree | 96bbe3ac695e07dd094bddc45c7d070d7c249696 /src/Java/gtPlusPlus/core | |
parent | 4d8395704802fd408a3380e75bf6b016ce6729e4 (diff) | |
download | GT5-Unofficial-e71696f3140dfb549f37f28308176524e521e3eb.tar.gz GT5-Unofficial-e71696f3140dfb549f37f28308176524e521e3eb.tar.bz2 GT5-Unofficial-e71696f3140dfb549f37f28308176524e521e3eb.zip |
+ Added recipes for the Alkalus Disk.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
7 files changed, 488 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 624edbe743..1d169acc55 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -221,6 +221,8 @@ public final class ModItems { public static Item itemDebugAreaClear; + public static Item itemGemShards; + @@ -229,7 +231,7 @@ public final class ModItems { //Default item used when recipes fail, handy for debugging. AAA_Broken = new BaseItemIngot_OLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); - itemAlkalusDisk = new CoreItem("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null); + itemAlkalusDisk = new BaseItemDamageable("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null); //Debug Loading if (CORE.DEBUG){ @@ -283,6 +285,9 @@ public final class ModItems { itemBlueprintBase = new ItemBlueprint("itemBlueprint"); + itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob"); + + //Start meta Item Generation ItemsFoods.load(); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java new file mode 100644 index 0000000000..07e70b86de --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java @@ -0,0 +1,96 @@ +package gtPlusPlus.core.item.base; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.*; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class BaseItemColourable extends Item +{ + + private final EnumRarity rarity; + private final EnumChatFormatting descColour; + private final String itemDescription; + protected String itemName; + private final boolean hasEffect; + public final int componentColour; + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.componentColour; + } + + //5 + /* + * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect + */ + public BaseItemColourable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb) + { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); + this.rarity = regRarity; + this.itemDescription = description; + this.descColour = colour; + this.hasEffect = Effect; + this.componentColour = rgb; + GameRegistry.registerItem(this, unlocalizedName); + } + + //6 + /* + * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect + */ + public BaseItemColourable(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb) + { + this.setUnlocalizedName(unlocalizedName); + this.itemName = displayName; + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); + this.rarity = regRarity; + this.itemDescription = description; + this.descColour = colour; + this.hasEffect = Effect; + this.componentColour = rgb; + GameRegistry.registerItem(this, unlocalizedName); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(this.descColour+this.itemDescription); + //super.addInformation(stack, aPlayer, list, bool); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(final ItemStack par1ItemStack){ + return this.rarity; + } + + @Override + public boolean hasEffect(final ItemStack par1ItemStack){ + return this.hasEffect; + } + + @Override + public String getItemStackDisplayName(final ItemStack tItem) { + if ((this.itemName == null) || this.itemName.equals("")) { + return super.getItemStackDisplayName(tItem); + } + return this.itemName; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java new file mode 100644 index 0000000000..c85eea4bed --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java @@ -0,0 +1,199 @@ +package gtPlusPlus.core.item.base; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +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; + +public class BaseItemDamageable extends Item { + + private final EnumRarity rarity; + private final String itemDescription; + protected String itemName; + private final boolean hasEffect; + + public BaseItemDamageable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) + { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(1); + this.setMaxDamage(251); + this.setNoRepair(); + this.rarity = regRarity; + this.itemDescription = description; + this.hasEffect = Effect; + GameRegistry.registerItem(this, unlocalizedName); + } + + public String getItemDescription(){ + return this.itemDescription; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + int dmg = (int) getItemDamage(stack); + if (dmg <= 3){ + list.add(EnumChatFormatting.GRAY+this.itemDescription); + } + if (dmg > 3 && dmg <= 25){ + list.add(EnumChatFormatting.GRAY+"You have discovered that smashing this against valuable stones has some function.."); + } + else if (dmg > 0){ + int maxDamage = 250; + list.add(EnumChatFormatting.GRAY+""+(maxDamage-getItemDamage(stack))+"/"+maxDamage+" gems remaining."); + } + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(final ItemStack par1ItemStack){ + int dmg = (int) getItemDamage(par1ItemStack); + if (dmg > 200){ + return EnumRarity.epic; + } + return this.rarity; + } + + @Override + public boolean hasEffect(final ItemStack par1ItemStack){ + int dmg = (int) getItemDamage(par1ItemStack); + if (dmg > 200){ + return true; + } + return this.hasEffect; + } + + @Override + public String getItemStackDisplayName(final ItemStack tItem) { + if ((this.itemName == null) || this.itemName.equals("")) { + return super.getItemStackDisplayName(tItem); + } + return this.itemName; + } + + private static boolean createNBT(ItemStack rStack){ + final NBTTagCompound tagMain = new NBTTagCompound(); + final NBTTagCompound tagNBT = new NBTTagCompound(); + tagNBT.setLong("Value", 0); + tagMain.setTag("Damage", tagNBT); + rStack.setTagCompound(tagMain); + return true; + } + + public static final long getItemDamage(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("Damage"); + if (aNBT != null) { + return aNBT.getLong("Value"); + } + } + else { + createNBT(aStack); + } + return 0L; + } + + public static final boolean setItemDamage(final ItemStack aStack, final long aDamage) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("Damage"); + if (aNBT != null) { + aNBT.setLong("Value", aDamage); + return true; + } + } + else { + createNBT(aStack); + } + return false; + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (stack.getTagCompound() == null){ + createNBT(stack); + } + double currentDamage = getItemDamage(stack); + double durabilitypercent = currentDamage / 100; + double inverse = (100-durabilitypercent); + return durabilitypercent; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + int dmg = (int) getItemDamage(stack); + if (dmg <= 20){ + return false; + } + else { + return true; + } + } + + public static ItemStack damageItem(ItemStack item){ + if (item != null){ + long currentUse = BaseItemDamageable.getItemDamage(item); + if (currentUse >= 0 && currentUse <= 250){ + BaseItemDamageable.setItemDamage(item, currentUse+1); + return item; + } + else { + return item; + } + } + return null; + } + + @Override + public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { + Utils.LOG_INFO("Does Leave Table? "+stack.getDisplayName()); + return true; + } + + @Override + public boolean getShareTag() { + return true; + } + + @Override + public boolean hasContainerItem() { + return true; + } + + @Override + public boolean hasContainerItem(ItemStack stack) { + Utils.LOG_INFO("hasContainerItem? "+stack.getDisplayName()); + return true; + } + + @Override + public ItemStack getContainerItem(ItemStack itemStack) { + ItemStack stack = itemStack.copy(); + //stack.setItemDamage(stack.getItemDamage() + 1); + damageItem(stack); + stack.stackSize = 1; + return stack; + } + + @Override + public int getDamage(ItemStack stack) { + return (int) getItemDamage(stack); + } + +} + + + diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java b/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java new file mode 100644 index 0000000000..d9f4509d7c --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java @@ -0,0 +1,80 @@ +package gtPlusPlus.core.item.general; + +import java.util.List; + +import gtPlusPlus.core.item.base.BaseItemColourable; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class ItemGemShards extends BaseItemColourable{ + + public ItemGemShards(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, + String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) { + super(unlocalizedName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb); + } + + public ItemGemShards(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, + int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) { + super(unlocalizedName, displayName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 4; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + //0 - Diamond + //1 - Emerald + //2 - Ruby + //3 - Sapphire + + @Override + public String getItemStackDisplayName(final ItemStack tItem) { + String suffix = " Shards"; + String gemType = ""; + if (tItem.getItemDamage() == 0){ + gemType = "Diamond"; + } + else if (tItem.getItemDamage() == 1){ + gemType = "Emerald"; + } + else if (tItem.getItemDamage() == 2){ + gemType = "Ruby"; + } + else if (tItem.getItemDamage() == 3){ + gemType = "Sapphire"; + } + return (gemType+suffix); + + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (this.getDamage(stack)==0){ + return Utils.rgbtoHexValue(150, 150, 220); + } + else if (this.getDamage(stack)==1){ + return Utils.rgbtoHexValue(75, 182, 75); + } + else if (this.getDamage(stack)==2){ + return Utils.rgbtoHexValue(182, 77, 77); + } + else { + return Utils.rgbtoHexValue(77, 75, 182); + } + } + + + + + +} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index fd8874ca0b..71a00ff402 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -1,17 +1,29 @@ package gtPlusPlus.core.recipe; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; +import gtPlusPlus.core.util.reflect.AddGregtechRecipe; +import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; public class RECIPES_General { @@ -81,18 +93,18 @@ public class RECIPES_General { GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardIgnis), ItemUtils.getSimpleStack(ModItems.dustIgnis, 2)); GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardTerra), ItemUtils.getSimpleStack(ModItems.dustTerra, 2)); GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardAqua), ItemUtils.getSimpleStack(ModItems.dustAqua, 2)); - + } - + //Rainforest oak Sapling if (RecipeUtils.recipeBuilder( "stickWood", "stickWood", "stickWood", "stickWood", "treeSapling", "stickWood", "stickWood", "dustBone", "stickWood", ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest))){ - Utils.LOG_INFO("Added a recipe for Rainforest oak Saplings."); + Utils.LOG_INFO("Added a recipe for Rainforest oak Saplings."); } - + //Iron bars ItemStack ironBars = ItemUtils.getItemStack("minecraft:iron_bars", 1); //Fish Trap @@ -101,9 +113,57 @@ public class RECIPES_General { ironBars, "frameGtWroughtIron", ironBars, ironBars, ironBars, ironBars, ItemUtils.getSimpleStack(ModBlocks.blockFishTrap))){ - Utils.LOG_INFO("Added a recipe for the Fish Trap."); + Utils.LOG_INFO("Added a recipe for the Fish Trap."); + } + + //Alkalus Coin + if (RecipeUtils.recipeBuilder( + "gemExquisiteRuby", "gemFlawlessDiamond", "gemExquisiteDiamond", + "gemFlawlessRuby", ItemList.Credit_Greg_Naquadah.get(1), "gemFlawlessSapphire", + "gemExquisiteEmerald", "gemFlawlessEmerald", "gemExquisiteSapphire", + ItemUtils.getSimpleStack(ModItems.itemAlkalusDisk))){ + Utils.LOG_INFO("Added a recipe for The Alkalus Disk."); + } + + String fancyGems[] = new String[]{"gemExquisiteDiamond", "gemExquisiteEmerald", "gemExquisiteRuby", "gemExquisiteSapphire"}; + ItemStack gemShards[] = new ItemStack[]{ItemUtils.simpleMetaStack(ModItems.itemGemShards, 0, 1), + ItemUtils.simpleMetaStack(ModItems.itemGemShards, 1, 1), + ItemUtils.simpleMetaStack(ModItems.itemGemShards, 2, 1), + ItemUtils.simpleMetaStack(ModItems.itemGemShards, 3, 1)}; + + int l=0; + for (String gem : fancyGems){ + GameRegistry.addShapelessRecipe( + gemShards[l], + ItemUtils.getItemStackOfAmountFromOreDict(gem, 1), + new ItemStack(ModItems.itemAlkalusDisk, 1, OreDictionary.WILDCARD_VALUE)); + l++; + } + + //Alkalus Coin + AddGregtechRecipe.addAssemblylineRecipe( + ItemUtils.getSimpleStack(ModItems.itemAlkalusDisk), + 288000, + new ItemStack[]{ + ItemUtils.getSimpleStack(gemShards[0], 10), + ItemUtils.getSimpleStack(gemShards[1], 10), + ItemUtils.getSimpleStack(gemShards[2], 10), + ItemUtils.getSimpleStack(gemShards[3], 10), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.NeodymiumMagnetic, 1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16L), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16L), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16L), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16L), + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.NiobiumTitanium, 2L)}, + new FluidStack[]{ + Materials.Osmium.getMolten(144*32), + Materials.Europium.getFluid(144*8)}, + ItemUtils.getSimpleStack(Dimension_DarkWorld.portalItem), + 30*20*60, + 100000); + } } -} + diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 00068f1871..b9b2bcb7ec 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -58,6 +58,13 @@ public class ItemUtils { return null; } } + + public static final int WILDCARD_VALUE = Short.MAX_VALUE; + public static ItemStack getWildcardStack(Item x){ + ItemStack y = new ItemStack(x, 1, WILDCARD_VALUE); + return y; + } + public static ItemStack getIC2Cell(final String S){ final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); diff --git a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java index 77889b4267..d0aa229189 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java @@ -66,6 +66,40 @@ public final class AddGregtechRecipe { } return false; } + + + + public static boolean addAssemblylineRecipe( + ItemStack aResearchItem, + int aResearchTime, + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack aOutput, + int aDuration, int aEUt){ + + try { + IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; + if (IGT_RecipeAdder != null){ + Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); + Method addRecipe = classRA.getMethod( + "addAssemblylineRecipe", + ItemStack.class, + int.class, + ItemStack.class, + FluidStack.class, + ItemStack.class, + int.class, + int.class); + if (addRecipe != null){ + return (boolean) addRecipe.invoke(IGT_RecipeAdder, aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); + } + } + } + catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + return false; + } public static boolean addCircuitAssemblerRecipe( ItemStack[] aInputs, |