From f6a126e4467c5bf7ab72249c7fc55df3bc574d94 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 2 Apr 2019 15:39:02 +1000 Subject: + Added TexturePackages. $ More work on redstone systems. --- .../textures/blocks/redstone/redstone_meter/top.png | Bin 0 -> 822 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png (limited to 'src/resources') diff --git a/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png b/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png new file mode 100644 index 0000000000..ba45c43891 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png differ -- cgit From d087513a06066296455b1cdc00164398c0260da3 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 11 Apr 2019 00:31:16 +1000 Subject: + Added some base classes for future content. + Made Teflon a refined version of PTFE. $ Fixed bad usage of PRASEODYMIUM. $ Fixed bug regrading null chemical symbols on Materials. $ Finally fixed Nano/Quantum handling for Hazmat. $ Fixed Worldgen in Everglades being too dense. --- .../core/item/bauble/MonsterKillerBaseBauble.java | 5 + .../core/item/chemistry/GenericChem.java | 28 +- .../item/wearable/armour/hazmat/ArmourHazmat.java | 117 ++++++++ src/Java/gtPlusPlus/core/material/ALLOY.java | 2 +- src/Java/gtPlusPlus/core/material/Material.java | 7 +- src/Java/gtPlusPlus/core/material/NONMATERIAL.java | 6 +- .../core/util/minecraft/HazmatUtils.java | 268 +++++++++++------- .../everglades/gen/gt/WorldGen_Ores.java | 309 ++++----------------- src/resources/assets/gregtech/lang/en_US.lang | 6 +- 9 files changed, 375 insertions(+), 373 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java create mode 100644 src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java new file mode 100644 index 0000000000..213a3f5b7c --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java @@ -0,0 +1,5 @@ +package gtPlusPlus.core.item.bauble; + +public class MonsterKillerBaseBauble { + +} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 02afada849..6360429415 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -2,8 +2,11 @@ package gtPlusPlus.core.item.chemistry; import gregtech.api.enums.TextureSet; import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.material.NONMATERIAL; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -18,9 +21,28 @@ public class GenericChem extends ItemPackage { * Materials */ - public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, "", 0);//Not a GT Inherited Material - public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material - public static final Material TEFLON = new Material("Teflon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{75, 45, 75}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material + public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material + public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material + + //Refined PTFE + public static final Material TEFLON = new Material( + "Teflon", + MaterialState.SOLID, + TextureSet.SET_SHINY, + new short[] { 75, 45, 75 }, + 330, 640, + -1, -1, + false, + null, + 0, + new MaterialStack[] { + new MaterialStack(NONMATERIAL.PTFE, 88), + new MaterialStack(NONMATERIAL.PLASTIC, 6), + new MaterialStack(ELEMENT.getInstance().CHLORINE, 3), + new MaterialStack(ELEMENT.getInstance().SODIUM, 3) + });// Not a GT + // Inherited + // Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java new file mode 100644 index 0000000000..9fd7bf7020 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java @@ -0,0 +1,117 @@ +package gtPlusPlus.core.item.wearable.armour.hazmat; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.item.wearable.armour.ArmourLoader; +import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ArmourHazmat extends BaseArmourHelm { + + public IIcon iconHelm; + + public ArmourHazmat() { + super(ArmourLoader.TinFoilArmour, 0); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister ir) { + this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil"); + } + + @Override + public int getRenderIndex() { + return 0; + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return this.iconHelm; + } + + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return CORE.MODID + ":textures/models/TinFoil.png"; + } + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.rare; + } + + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { + return false; + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + return super.getArmorDisplay(player, armor, slot); + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + + } + + @SuppressWarnings({ "unchecked" }) + @Override + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + aList.add("DoomSquirter's protection against cosmic radiation!"); + aList.add("General paranoia makes the wearer unable to collect xp"); + aList.add("Movement speed is also reduced, to keep you safe"); + aList.add("This hat may also have other strange powers"); + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { + return new ArmorProperties(0, 0, 0); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, + EntityLivingBase p_111207_3_) { + return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_); + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_); + } + + @Override + public boolean onEntityItemUpdate(EntityItem entityItem) { + return super.onEntityItemUpdate(entityItem); + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack != null && player != null && world != null && !world.isRemote) { + if (player instanceof EntityPlayer) { + + } + } + super.onArmorTick(world, player, itemStack); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index f18cd4ec73..8bcbb2a051 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -864,7 +864,7 @@ public final class ALLOY { //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().TITANIUM, 55), - new MaterialStack(ELEMENT.getInstance().PRASEODYMIUM, 12), + new MaterialStack(ELEMENT.getInstance().LANTHANUM, 12), new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 8), new MaterialStack(ELEMENT.getInstance().COBALT, 6), new MaterialStack(ELEMENT.getInstance().MANGANESE, 4), diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 58a7f68afe..8fb3c5fc3b 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -141,7 +141,7 @@ public class Material { this (materialName, defaultState, set, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); } - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ if (mMaterialMap.add(this)) { @@ -442,6 +442,11 @@ public class Material { //Makes a Fancy Chemical Tooltip + + if (chemicalSymbol == null) { + chemicalSymbol = ""; + } + this.vChemicalSymbol = chemicalSymbol; if (this.vMaterialInput != null){ this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java index 4da34ae16c..7ab72d50bc 100644 --- a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java +++ b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java @@ -27,7 +27,11 @@ public class NONMATERIAL { //Wrought Iron public static final Material WROUGHT_IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron); - + //PTFE + public static final Material PTFE = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Polytetrafluoroethylene", "Plastic")); + + //Plastic + public static final Material PLASTIC = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Plastic", "Rubber")); static { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index e6ffe1e89d..c37b1271d7 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -21,159 +21,184 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.Utils; import ic2.core.Ic2Items; import ic2.core.item.armor.ItemArmorHazmat; +import ic2.core.item.armor.ItemArmorNanoSuit; +import ic2.core.item.armor.ItemArmorQuantumSuit; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class HazmatUtils { - - public static final GT_HashSet sHazmatList = new GT_HashSet(); - - private static final HashMap> mToolTips = new HashMap>(); - - + public static final GT_HashSet sHazmatList = new GT_HashSet(); + + private static final HashMap> mToolTips = new HashMap>(); + private static boolean mInit = false; private static HazmatUtils mInstance; - + public static void init() { - if (mInit){ + if (mInit) { return; } - + mInstance = new HazmatUtils(); - + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767)); - //Make Nano a hazmat suit - addProtection(Ic2Items.nanoHelmet); - addProtection(Ic2Items.nanoBodyarmor); - addProtection(Ic2Items.nanoLeggings); - addProtection(Ic2Items.nanoBoots); - + // Make Nano a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoBoots:27", 1)); + Logger.INFO("[Hazmat] Registered Nano as hazmat gear."); - - //Make Quantum a hazmat suit - addProtection(Ic2Items.quantumHelmet); - addProtection(Ic2Items.quantumBodyarmor); - addProtection(Ic2Items.quantumLeggings); - addProtection(Ic2Items.quantumBoots); - Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); - - Utils.registerEvent(mInstance); + + // Make Quantum a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumBoots:27", 1)); + Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); + + Utils.registerEvent(mInstance); Logger.INFO("[Hazmat] Registered Tooltip handler for hazmat gear."); mInit = true; - + } - + private final static String mToolTipText = "Provides protection from:"; - + @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event){ - Logger.INFO("Ticking Hazmat handler"); - if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { - Logger.INFO("[Hazmat] Bad Phase : "+GTplusplus.CURRENT_LOAD_PHASE); + public void onItemTooltip(ItemTooltipEvent event) { + //Logger.INFO("Ticking Hazmat handler"); + if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED + && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { + //Logger.INFO("[Hazmat] Bad Phase : " + GTplusplus.CURRENT_LOAD_PHASE); return; } if (event.itemStack == null || isVanillaHazmatPiece(event.itemStack)) { Logger.INFO("[Hazmat] Invalid Itemstack or vanilla hazmat"); return; - } - else { - Logger.INFO("[Hazmat] Finding Tooltip Data"); + } else { ItemStack aStackTemp = event.itemStack; GT_ItemStack aStack = new GT_ItemStack(aStackTemp); - String[] aTooltips = getTooltips(aStack); - if (aTooltips == null || aTooltips.length == 0) { - Logger.INFO("[Hazmat] No Info!"); - return; + if (isNanoArmourPiece(aStackTemp) || isQuantumArmourPiece(aStackTemp)) { + event.toolTip.add("Provides full hazmat protection."); } - else { - Logger.INFO("[Hazmat] Found Tooltips!"); - if (providesProtection(aStackTemp)) { - event.toolTip.add("Provides full hazmat protection."); - } - else { - event.toolTip.add(mToolTipText); - for (String r : aTooltips) { - event.toolTip.add(" - "+r); - } - } - } - } + else { + Logger.INFO("[Hazmat] Finding Tooltip Data"); + String[] aTooltips = getTooltips(aStack); + if (aTooltips == null || aTooltips.length == 0) { + Logger.INFO("[Hazmat] No Info!"); + return; + } else { + Logger.INFO("[Hazmat] Found Tooltips!"); + if (providesProtection(aStackTemp)) { + event.toolTip.add("Provides full hazmat protection."); + } else { + event.toolTip.add(mToolTipText); + for (String r : aTooltips) { + event.toolTip.add(" - " + r); + } + } + } + } + } } - - + /** - * Static function to replace {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. - * Because IC2 doesn't let us register things ourself, anything registered via GT/GT++ will return true. + * Static function to replace + * {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. + * Because IC2 doesn't let us register things ourself, anything registered via + * GT/GT++ will return true. + * * @param living - Entity Wearing Armour * @return - Does {@link EntityLivingBase} have a full hazmat suit on? */ - public static boolean hasCompleteHazmat(EntityLivingBase living) { - //Entity is Null, cannot have Hazmat. + public static boolean hasCompleteHazmat(EntityLivingBase living) { + // Entity is Null, cannot have Hazmat. if (living == null || living.isDead) { return false; - } - else { - - //Map All Player Armour slots + } else { + + // Map All Player Armour slots AutoMap aEquipment = new AutoMap(); for (int i = 1; i < 5; ++i) { ItemStack stack = living.getEquipmentInSlot(i); - - //Item is Null, cannot have full suit + + // Item is Null, cannot have full suit if (stack == null) { return false; - } - else { + } else { aEquipment.put(stack); } } - - //Compare Equipment to all items mapped for full hazmat. + + // Compare Equipment to all items mapped for full hazmat. for (ItemStack aSlotStack : aEquipment) { if (!isHazmatPiece(aSlotStack)) { return false; } } - - //We are in some kind of full hazmat, huzzah! - return true; - } + + // We are in some kind of full hazmat, huzzah! + return true; + } } - - + /** * Is this item vanilla IC2 hazmat? + * * @param aArmour - The Armour to provide protection. * @return */ public static boolean isVanillaHazmatPiece(ItemStack aArmour) { - return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; - } + return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; + } + + /** + * Is this item vanilla IC2 Nanosuit? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isNanoArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorNanoSuit : false; + } + /** + * Is this item vanilla IC2 Quantum? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isQuantumArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorQuantumSuit : false; + } + /** * Is this item a registered piece of full hazmat? (Provides all 6 protections) + * * @param aStack - The Armour to provide protection. * @return */ public static boolean isHazmatPiece(ItemStack aStack) { return isVanillaHazmatPiece(aStack) || providesProtection(aStack); } - + /** - * Registers the {@link ItemStack} to all types of protection. - * Provides full hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * Registers the {@link ItemStack} to all types of protection. Provides full + * hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * * @param aStack - The Armour to provide protection. * @return - Did we register this ItemStack properly? */ - public static boolean addProtection(ItemStack aVanStack) { - Logger.INFO("[Hazmat] Registering "+aVanStack.getDisplayName() +" for full Hazmat protection."); + public static boolean addProtection(ItemStack aVanStack) { + Logger.INFO("[Hazmat] Registering " + aVanStack.getDisplayName() + " for full Hazmat protection."); GT_ItemStack aStack = getGtStackFromVanilla(aVanStack); AutoMap aAdded = new AutoMap(); aAdded.put(addProtection_Frost(aStack)); @@ -181,7 +206,7 @@ public class HazmatUtils { aAdded.put(addProtection_Biohazard(aStack)); aAdded.put(addProtection_Gas(aStack)); aAdded.put(addProtection_Radiation(aStack)); - aAdded.put(addProtection_Electricty(aStack)); + aAdded.put(addProtection_Electricty(aStack)); for (boolean b : aAdded) { if (!b) { return false; @@ -189,63 +214,78 @@ public class HazmatUtils { } Logger.INFO("[Hazmat] Protection added for all 6 damage types, registering to master Hazmat list."); sHazmatList.add(aStack); - return true; + return true; } + public static boolean addProtection_Frost(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.AQUA+"Frost"); + registerTooltip(aStack, EnumChatFormatting.AQUA + "Frost"); return addProtection_Generic(sFrostHazmatList, aStack); } + public static boolean addProtection_Fire(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_RED+"Heat"); + registerTooltip(aStack, EnumChatFormatting.DARK_RED + "Heat"); return addProtection_Generic(sHeatHazmatList, aStack); } + public static boolean addProtection_Biohazard(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.GREEN+"Biohazards"); + registerTooltip(aStack, EnumChatFormatting.GREEN + "Biohazards"); return addProtection_Generic(sBioHazmatList, aStack); } + public static boolean addProtection_Gas(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.WHITE+"Gas"); + registerTooltip(aStack, EnumChatFormatting.WHITE + "Gas"); return addProtection_Generic(sGasHazmatList, aStack); } + public static boolean addProtection_Radiation(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_GREEN+"Radiation"); + registerTooltip(aStack, EnumChatFormatting.DARK_GREEN + "Radiation"); return addProtection_Generic(sRadioHazmatList, aStack); } + public static boolean addProtection_Electricty(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.YELLOW+"Electricity"); + registerTooltip(aStack, EnumChatFormatting.YELLOW + "Electricity"); return addProtection_Generic(sElectroHazmatList, aStack); } - + private static boolean addProtection_Generic(GT_HashSet aSet, GT_ItemStack aStack) { int aMapSize = aSet.size(); aSet.add(aStack); return aMapSize < aSet.size(); } - + /** - * Does this item provide hazmat protection? (Protection against Frost, Heat, Bio, Gas, Rads, Elec) - * An item may return false even if it protects against all six damage types. This is because it's not actually registered as hazmat correct. + * Does this item provide hazmat protection? (Protection against Frost, Heat, + * Bio, Gas, Rads, Elec) An item may return false even if it protects against + * all six damage types. This is because it's not actually registered as hazmat + * correct. + * * @param aStack - The item to check for protection * @return */ public static boolean providesProtection(ItemStack aStack) { return providesProtetion_Generic(sHazmatList, aStack); } + public static boolean providesProtetion_Frost(ItemStack aStack) { return providesProtetion_Generic(sFrostHazmatList, aStack); } + public static boolean providesProtetion_Fire(ItemStack aStack) { return providesProtetion_Generic(sHeatHazmatList, aStack); } + public static boolean providesProtetion_Biohazard(ItemStack aStack) { return providesProtetion_Generic(sBioHazmatList, aStack); } + public static boolean providesProtetion_Gas(ItemStack aStack) { return providesProtetion_Generic(sGasHazmatList, aStack); } + public static boolean providesProtetion_Radiation(ItemStack aStack) { return providesProtetion_Generic(sRadioHazmatList, aStack); } + public static boolean providesProtetion_Electricity(ItemStack aStack) { return providesProtetion_Generic(sElectroHazmatList, aStack); } @@ -256,39 +296,55 @@ public class HazmatUtils { } return aSet.getMap().containsKey(aStack); } - - - private static String[] getTooltips(GT_ItemStack aStack) { - AutoMap aTempTooltipData = mToolTips.get(aStack); + + private static String[] getTooltips(GT_ItemStack aStack) { + String aKey = convertGtItemstackToStringData(aStack); + AutoMap aTempTooltipData = mToolTips.get(aKey); if (aTempTooltipData == null) { - Logger.INFO("[Hazmat] Item was not mapped for TTs"); + Logger.INFO("[Hazmat] Item was not mapped for TTs - "+aKey); return new String[] {}; - } - else { + } else { Logger.INFO("[Hazmat] Item was mapped for TTs"); Collections.sort(aTempTooltipData); Logger.INFO("[Hazmat] Sorted TTs"); return aTempTooltipData.toArray(); } } - + private static void registerTooltip(GT_ItemStack aStack, String aTooltip) { - Logger.INFO("[Hazmat] Mapping "+aTooltip+" for "+getStackFromGtStack(aStack).getDisplayName()); - AutoMap aTempTooltipData = mToolTips.get(aStack); + String aKey = convertGtItemstackToStringData(aStack); + Logger.INFO("[Hazmat] Mapping " + aTooltip + " for " + aKey); + AutoMap aTempTooltipData = mToolTips.get(aKey); if (aTempTooltipData == null) { Logger.INFO("No data mapped yet, creating."); aTempTooltipData = new AutoMap(); } aTempTooltipData.add(aTooltip); - mToolTips.put(aStack, aTempTooltipData); + mToolTips.put(convertGtItemstackToStringData(aStack), aTempTooltipData); } - + public static ItemStack getStackFromGtStack(GT_ItemStack aGtStack) { return ItemUtils.simpleMetaStack(aGtStack.mItem, aGtStack.mMetaData, aGtStack.mStackSize); } - + public static GT_ItemStack getGtStackFromVanilla(ItemStack aStack) { return new GT_ItemStack(aStack); } + + private static String convertGtItemstackToStringData(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mMetaData + "." + aStack.mStackSize; + } + } + private static String convertGtItemstackToStringDataIgnoreDamage(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mStackSize; + } + } + } diff --git a/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java b/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java index 978deb1d25..0715f86e01 100644 --- a/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java +++ b/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java @@ -2,288 +2,77 @@ package gtPlusPlus.everglades.gen.gt; import java.util.Hashtable; -import net.minecraft.block.Block; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.ORES; import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.everglades.object.BoxedQuad; public class WorldGen_Ores { - - /** - * Set Ore Types on by one. - */ - public static volatile Pair Geikielite; // MgTiO3 - public static volatile Pair Zimbabweite; // (Na,K)2PbAs4(Nb,Ta,Ti)4O18 - public static volatile Pair Titanite; // CaTiSiO5 - public static volatile Pair Zirconolite; // CaZrTi2O7 - public static volatile Pair Crocoite; // PbCrO4 - public static volatile Pair Nichromite; // (Ni,Co,Fe)(Cr,Fe,Al)2O4 - public static volatile Pair Yttriaite; // Y2O3 - public static volatile Pair Samarskite_Y; // (YFe3+Fe2+U,Th,Ca)2(Nb,Ta)2O8 - public static volatile Pair Samarskite_Yb; // (YbFe3+)2(Nb,Ta)2O8 - public static volatile Pair Zircon; // ZrSiO4 - public static volatile Pair Gadolinite_Ce; // (Ce2,La,Nd,Y)2FeBe2Si1O14 - public static volatile Pair Gadolinite_Y; // (Ce,La,Nd,Y2)2FeBe2Si4O9 - public static volatile Pair Lepersonnite; // Ca(Gd,Dy)2(UO2)24(SiO4)4(CO3)8(OH)24·48H2O - public static volatile Pair Xenotime; // YPO4 - public static volatile Pair Yttrialite; // Y2Th2Si2O7 - public static volatile Pair Yttrocerite; // CaF5YCe - public static volatile Pair Polycrase; // YCaCeUThTi2Nb2Ta2O6 - public static volatile Pair Zircophyllite; // (K,Na)3(Mn,Fe)7(Zr,Ti,Nb)2Si8O24(OH,F)7 - public static volatile Pair Zirkelite; // (Ca,Th,Ce)Zr(Ti,Nb)2O7 - public static volatile Pair Lanthanite_La; // (La)2(CO3)3·8(H2O). - public static volatile Pair Lanthanite_Ce; // (Ce)2(CO3)3·8(H2O). - public static volatile Pair Lanthanite_Nd; // (Nd)2(CO3)3·8(H2O). - public static volatile Pair Hibonite; // ((Ca,Ce)(Al,Ti,Mg)12O19) - public static volatile Pair Cerite; // (Ce,La,Ca)9(Mg,Fe+3)(SiO4)6(SiO3OH)(OH)3 - public static volatile Pair Agardite_Y; // (YCa)Cu5(As2O4)3(OH)6·3H2O - public static volatile Pair Agardite_Cd; // (CdCa)Cu7(AsO2)4(O2H)5·3H2O - public static volatile Pair Agardite_La; // (LaCa)Cu5(AsO6)2(OH)4·3H2O - public static volatile Pair Agardite_Nd; // (NdCa)Cu6(As3O3)2(O2H)6·3H2O - public static volatile Pair Fluorcaphite; // (Ca,Sr,Ce,Na)5(PO4)3F - public static volatile Pair Florencite; // SmAl3(PO4)2(OH)6 - public static volatile Pair Cryolite; // Na3AlF6 - //public static volatile Pair Pyroxene; // - - - - - public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer( - "veinA", - 20, 40, - 1, - 8, - 128, - ELEMENT.getInstance().IRON, - ELEMENT.getInstance().IRON, - ELEMENT.getInstance().IRON, + public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer("veinA", 20, 40, 1, 1, 128, + ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON); - - - + /** * Custom ore Veins */ - - public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer( - "vein1", - 0, 60, - 30, - 16, - 16, - ORES.AGARDITE_CD, - ORES.AGARDITE_LA, - ORES.DEMICHELEITE_BR, - ORES.IRARSITE); - - public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer( - "vein2", - 0, 60, - 30, - 16, - 16, - ORES.AGARDITE_ND, - ORES.AGARDITE_Y, - ORES.KASHINITE, - ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer( - "vein3", - 0, 60, - 30, - 16, - 32, - ORES.CERITE, - ORES.NICHROMITE, - ORES.XENOTIME, - ORES.HIBONITE); + public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer("vein1", 0, 60, 30, 2, 16, ORES.AGARDITE_CD, + ORES.AGARDITE_LA, ORES.DEMICHELEITE_BR, ORES.IRARSITE); + + public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer("vein2", 0, 60, 30, 2, 16, ORES.AGARDITE_ND, + ORES.AGARDITE_Y, ORES.KASHINITE, ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer( - "vein4", - 0, 60, - 40, - 16, - 32, - ORES.GEIKIELITE, - ORES.CRYOLITE, - ORES.GADOLINITE_CE, - ORES.AGARDITE_ND); - - - - public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer( - "vein5", - 30, 128, - 20, - 8, - 48, - ORES.HIBONITE, - ORES.YTTRIALITE, - ORES.ZIRCONILITE, - ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer( - "vein6", - 0, 40, - 20, - 8, - 48, - ORES.XENOTIME, - ORES.ZIRKELITE, - ORES.CROCROITE, - ORES.IRARSITE); - public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer( - "vein7", - 40, 128, - 20, - 8, - 48, - ORES.HONEAITE, - ORES.MIESSIITE, - ORES.SAMARSKITE_Y, - ORES.SAMARSKITE_YB); - public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer( - "vein8", - 0, 40, - 20, - 8, - 48, - ORES.TITANITE, - ORES.ZIMBABWEITE, - ORES.ZIRCON, - ORES.FLORENCITE); - - - + public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer("vein3", 0, 60, 30, 3, 32, ORES.CERITE, + ORES.NICHROMITE, ORES.XENOTIME, ORES.HIBONITE); + + public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer("vein4", 0, 60, 40, 3, 32, ORES.GEIKIELITE, + ORES.CRYOLITE, ORES.GADOLINITE_CE, ORES.AGARDITE_ND); + + public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer("vein5", 30, 128, 20, 2, 48, ORES.HIBONITE, + ORES.YTTRIALITE, ORES.ZIRCONILITE, ORES.CERITE); + public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer("vein6", 0, 40, 20, 2, 48, ORES.XENOTIME, + ORES.ZIRKELITE, ORES.CROCROITE, ORES.IRARSITE); + public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer("vein7", 40, 128, 20, 2, 48, ORES.HONEAITE, + ORES.MIESSIITE, ORES.SAMARSKITE_Y, ORES.SAMARSKITE_YB); + public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer("vein8", 0, 40, 20, 2, 48, ORES.TITANITE, + ORES.ZIMBABWEITE, ORES.ZIRCON, ORES.FLORENCITE); + + public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer("vein9", 10, 30, 20, 1, 48, + ORES.LANTHANITE_CE, FLUORIDES.FLUORITE, ORES.LAFOSSAITE, ORES.FLORENCITE); + public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer("vein10", 20, 50, 20, 2, 32, ORES.GEIKIELITE, + ORES.YTTROCERITE, ORES.LANTHANITE_LA, ORES.RADIOBARITE); + public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer("vein11", 30, 70, 20, 1, 48, + FLUORIDES.FLUORITE, ORES.KASHINITE, ORES.ZIRCON, ORES.CRYOLITE); + public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer("vein12", 40, 80, 20, 3, 32, ORES.CERITE, + ORES.ALBURNITE, ORES.MIESSIITE, ORES.HIBONITE); - public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer( - "vein9", - 10, 30, - 20, - 4, - 48, - ORES.LANTHANITE_CE, - FLUORIDES.FLUORITE, - ORES.LAFOSSAITE, - ORES.FLORENCITE); - public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer( - "vein10", - 20, 50, - 20, - 8, - 32, - ORES.GEIKIELITE, - ORES.YTTROCERITE, - ORES.LANTHANITE_LA, - ORES.RADIOBARITE); - public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer( - "vein11", - 30, 70, - 20, - 5, - 48, - FLUORIDES.FLUORITE, - ORES.KASHINITE, - ORES.ZIRCON, - ORES.CRYOLITE); - public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer( - "vein12", - 40, 80, - 20, - 8, - 32, - ORES.CERITE, - ORES.ALBURNITE, - ORES.MIESSIITE, - ORES.HIBONITE); - /** * Best Rarest Veins 2017 */ - - public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer( - "vein13", - 5, 15, - 5, - 5, - 16, - ORES.CRYOLITE, - ORES.RADIOBARITE, - ORES.HONEAITE, - ORES.FLORENCITE); - public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer( - "vein14", - 10, 20, - 8, - 3, - 16, - ORES.DEMICHELEITE_BR, - ORES.PERROUDITE, - ORES.IRARSITE, - ORES.RADIOBARITE); + public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer("vein13", 5, 15, 5, 1, 16, ORES.CRYOLITE, + ORES.RADIOBARITE, ORES.HONEAITE, ORES.FLORENCITE); + + public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer("vein14", 10, 20, 8, 2, 16, + ORES.DEMICHELEITE_BR, ORES.PERROUDITE, ORES.IRARSITE, ORES.RADIOBARITE); - public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer( - "vein15", - 5, 25, - 5, - 6, - 24, - ORES.FLUORCAPHITE, - ORES.LAFOSSAITE, - ORES.GADOLINITE_CE, - ORES.GADOLINITE_Y); + public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer("vein15", 5, 25, 5, 3, 24, ORES.FLUORCAPHITE, + ORES.LAFOSSAITE, ORES.GADOLINITE_CE, ORES.GADOLINITE_Y); + + public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer("vein16", 0, 25, 4, 2, 32, ORES.YTTROCERITE, + ORES.LEPERSONNITE, ORES.LAUTARITE, FLUORIDES.FLUORITE); + + public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer("vein17", 10, 35, 4, 1, 32, ORES.FLORENCITE, + ORES.LAUTARITE, ORES.SAMARSKITE_YB, ORES.POLYCRASE); + public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer("vein18", 15, 40, 4, 1, 48, + ORES.GADOLINITE_CE, ORES.GADOLINITE_Y, ORES.AGARDITE_LA, ORES.AGARDITE_CD); - public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer( - "vein16", - 0, 25, - 4, - 6, - 32, - ORES.YTTROCERITE, - ORES.LEPERSONNITE, - ORES.LAUTARITE, - FLUORIDES.FLUORITE); - - public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer( - "vein17", - 10, 35, - 4, - 5, - 32, - ORES.FLORENCITE, - ORES.LAUTARITE, - ORES.SAMARSKITE_YB, - ORES.POLYCRASE); - public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer( - "vein18", - 15, 40, - 4, - 4, - 48, - ORES.GADOLINITE_CE, - ORES.GADOLINITE_Y, - ORES.AGARDITE_LA, - ORES.AGARDITE_CD); - - - - public static Hashtable validOreveins = new Hashtable( 1024); - - public static volatile BoxedQuad OreVein1 = new BoxedQuad(null, null, null, null); - static long ID = 0; - public static void generateValidOreVeins(){ + + public static void generateValidOreVeins() { validOreveins.put(ID++, BaseVein); validOreveins.put(ID++, Vein1); validOreveins.put(ID++, Vein2); @@ -304,5 +93,5 @@ public class WorldGen_Ores { validOreveins.put(ID++, Vein17); validOreveins.put(ID++, Vein18); } - + } diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index ffbb3d8a7a..a9bfa8993d 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -46,7 +46,11 @@ GTPP.nanohealer.tooltip.4=WILL NOT PREVENT DEATH GTPP.nanohealer.tooltip.5=Shift+RMB to toggle notifications GTPP.nanohealer.hidden=Hiding Info? - +//10/4/19 +//Tooltips for the Mob Killing Baubles +GTPP.monsterkiller.tooltip.1=Worn as an Amulet within Baubles +GTPP.monsterkiller.tooltip.2=Drains +GTPP.monsterkiller.tooltip.3=to kill -- cgit From 761a3c8b0c0eb02bd2897359a575126aae1af20f Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 11 Apr 2019 01:12:58 +1000 Subject: + Added a Base Bauble class for Electrics. % Updated some of the Baubles to use this new class. --- .../core/item/bauble/BatteryPackBaseBauble.java | 123 ++----------- .../core/item/bauble/ElectricBaseBauble.java | 199 +++++++++++++++++++++ .../core/item/bauble/MonsterKillerBaseBauble.java | 126 ++++++++++++- src/resources/assets/gregtech/lang/en_US.lang | 3 +- 4 files changed, 336 insertions(+), 115 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java index cc7979825a..2d9b35ac63 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java @@ -3,20 +3,16 @@ package gtPlusPlus.core.item.bauble; import java.util.List; import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -28,23 +24,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), - @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) -public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { +public class BatteryPackBaseBauble extends ElectricBaseBauble { - final int mTier; - private final double maxValueEU; public BatteryPackBaseBauble(int tier) { - super(BaubleType.BELT, "GTPP.BattPack.0" + tier + ".name", 0); - mTier = tier; - maxValueEU = GT_Values.V[mTier] * 20 * 300; - String aUnlocalName = "GTPP.BattPack.0" + mTier + ".name"; - this.setUnlocalizedName(aUnlocalName); - this.setTextureName(CORE.MODID + ":" + "chargepack/"+tier); - this.setMaxDamage(27); - this.setMaxStackSize(1); - this.setNoRepair(); + super(BaubleType.BELT, tier, GT_Values.V[tier] * 20 * 300, "GTPP.BattPack.0" + tier + ".name"); + String aUnlocalName = "GTPP.BattPack.0" + tier + ".name"; this.setCreativeTab(AddToCreativeTab.tabMachines); if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { GameRegistry.registerItem(this, aUnlocalName); @@ -81,46 +66,11 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, return aItemCharge > 0; } - @Override - public Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(27); - return x.getItem(); - } - - @Override - public Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public int getTier(final ItemStack itemStack) { - return mTier; - } - - @Override - public double getTransferLimit(final ItemStack itemStack) { - return GT_Values.V[mTier]; - } - @Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); } - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - // return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); - } - @Override public boolean showDurabilityBar(final ItemStack stack) { return true; @@ -140,70 +90,16 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2"); String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3"); String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4"); - - String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); - String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); - String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); - String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); String aEUT = aEU+"/t"; list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT +" "+ aString3 + EnumChatFormatting.GRAY); list.add(EnumChatFormatting.GREEN + aString4 + EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) - + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW - + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); - list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) - + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW - + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY - + "%]"); super.addInformation(stack, aPlayer, list, bool); } - @Override - public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, - final boolean simulate) { - - if (!simulate) { - ElectricItem.manager.charge(stack, amount, tier, true, simulate); - - } - return ElectricItem.manager.charge(stack, amount, tier, true, simulate); - } - - @Override - public double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - if (!simulate) { - ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - @Override public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); @@ -219,11 +115,6 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, return true; } - @Override - public BaubleType getBaubleType(final ItemStack arg0) { - return BaubleType.BELT; - } - @Override // TODO public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { @@ -349,4 +240,10 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, } } + @Override + public String getTextureNameForBauble() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java new file mode 100644 index 0000000000..fb490285e9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java @@ -0,0 +1,199 @@ +package gtPlusPlus.core.item.bauble; + +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), +@Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) +public abstract class ElectricBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { + + public final int mTier; + private final double maxValueEU; + private final BaubleType mType; + + public ElectricBaseBauble(BaubleType aType, int aTier, double aMaxEU, String aUnlocalName) { + super(aType, aUnlocalName, 0); + mType = aType; + mTier = aTier; + maxValueEU = aMaxEU; + this.setUnlocalizedName(aUnlocalName); + this.setTextureName(getTextureNameForBauble()); + this.setMaxDamage(27); + this.setMaxStackSize(1); + this.setNoRepair(); + this.setCreativeTab(AddToCreativeTab.tabMachines); + if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { + GameRegistry.registerItem(this, aUnlocalName); + } + } + + public abstract String getTextureNameForBauble(); + + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + ItemStack charged; + if (this.getEmptyItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (this.getChargedItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + + } + + @Override + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, + final boolean p_77663_5_) { + super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); + } + + @Override + public boolean canProvideEnergy(final ItemStack itemStack) { + double aItemCharge = ElectricItem.manager.getCharge(itemStack); + return aItemCharge > 0; + } + + @Override + public final Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(27); + return x.getItem(); + } + + @Override + public final Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(0); + return x.getItem(); + } + + @Override + public final double getMaxCharge(final ItemStack itemStack) { + return maxValueEU; + } + + @Override + public final int getTier(final ItemStack itemStack) { + return mTier; + } + + @Override + public final double getTransferLimit(final ItemStack itemStack) { + return GT_Values.V[mTier]; + } + + @Override + public final double getDurabilityForDisplay(final ItemStack stack) { + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); + } + + @Override + public boolean showDurabilityBar(final ItemStack stack) { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); + String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); + String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); + String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU+"/t"; + + list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) + + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW + + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); + list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) + + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW + + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY + + "%]"); + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public final double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, + final boolean simulate) { + /*if (!simulate) { + ElectricItem.manager.charge(stack, amount, tier, true, simulate); + }*/ + + return ElectricItem.manager.charge(stack, amount, tier, true, simulate); + } + + @Override + public final double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { + /*if (!simulate) { + ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + }*/ + + return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + } + + @Override + public final double getCharge(final ItemStack stack) { + return ElectricItem.manager.getCharge(stack); + } + + @Override + public final boolean canUse(final ItemStack stack, final double amount) { + return ElectricItem.manager.canUse(stack, amount); + } + + @Override + public final boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { + return ElectricItem.manager.use(stack, amount, entity); + } + + @Override + public final void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { + ElectricItem.manager.chargeFromArmor(stack, entity); + } + + @Override + public String getToolTip(final ItemStack stack) { + //return ElectricItem.manager.getToolTip(stack); + return null; + } + + @Override + public final BaubleType getBaubleType(final ItemStack arg0) { + return mType; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java index 213a3f5b7c..024f6aa907 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java @@ -1,5 +1,129 @@ package gtPlusPlus.core.item.bauble; -public class MonsterKillerBaseBauble { +import java.util.List; + +import baubles.api.BaubleType; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.core.lib.CORE; +import ic2.api.item.ElectricItem; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class MonsterKillerBaseBauble extends ElectricBaseBauble { + + private final int mTier; + private final Class[] mTargets; + + public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) { + super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300, "GTPP.MonsterKiller."+aMonsterTypeName+".name"); + mTier = aPowerTier; + mTargets = aMonsterBaseClassArray; + } + + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + ItemStack charged; + if (this.getEmptyItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (this.getChargedItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + + } + + @Override + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, + final boolean p_77663_5_) { + super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); + } + + @Override + public boolean canProvideEnergy(final ItemStack itemStack) { + double aItemCharge = ElectricItem.manager.getCharge(itemStack); + return aItemCharge > 0; + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return (EnumChatFormatting.WHITE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); + } + + @Override + public boolean showDurabilityBar(final ItemStack stack) { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + String aString1 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.1"); + String aString2 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.2"); + String aString3 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.3"); + String aString4 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.4"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU+"/t"; + + list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT + aString3 + EnumChatFormatting.GRAY); + list.add(""); + list.add(""+EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY); + for (Class cz : mTargets) { + list.add("- "+EnumChatFormatting.DARK_GREEN + cz.getSimpleName() + EnumChatFormatting.GRAY); + } + + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override // TODO + public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) { + if (!aPlayer.worldObj.isRemote) { + if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { + + } + } + } + + @Override + public String getTextureNameForBauble() { + return CORE.MODID+":"+""; + } } diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index a9bfa8993d..caf4f636fb 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -50,7 +50,8 @@ GTPP.nanohealer.hidden=Hiding Info? //Tooltips for the Mob Killing Baubles GTPP.monsterkiller.tooltip.1=Worn as an Amulet within Baubles GTPP.monsterkiller.tooltip.2=Drains -GTPP.monsterkiller.tooltip.3=to kill +GTPP.monsterkiller.tooltip.3=per each kill +GTPP.monsterkiller.tooltip.4=Target Type: -- cgit From 99da62fca32fa4c6346b2cea119488d7bbf65955 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 17 Apr 2019 13:57:35 +1000 Subject: % Updated Locale. % Adjusted names of three Materials slightly. $ Fixed Multiblocks not consuming inputs by reverting logic back to a previous state. $ Fixed Multiblocks not respecting Control Cores correctly when present. $ Fixed Multiblocks handling of recipes which require boosted outputs. $ Fixed Animation of Large Centrifuges. (Mostly) --- src/Java/gtPlusPlus/core/material/ELEMENT.java | 8 +- .../base/GregtechMeta_MultiBlockBase.java | 481 ++++++++++++--------- .../textures/TexturesCentrifugeMultiblock.java | 122 ++---- ...regtechMetaTileEntity_IndustrialCentrifuge.java | 29 +- src/resources/assets/miscutils/lang/en_US.lang | 105 ++++- 5 files changed, 449 insertions(+), 296 deletions(-) (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index d1b7c01e0a..e972992391 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -216,11 +216,11 @@ public final class ELEMENT { //Runescape materials - public static final Material BLACK_METAL = new Material("Black", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().TUNGSTEN, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material - public static final Material WHITE_METAL = new Material("White", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material - public static final Material GRANITE = new Material("Ancient Granite", MaterialState.SOLID, TextureSet.SET_SAND, new short[] {107, 107, 107}, 500, 2000, 16, 12, false, "«»", 0);//Not a GT Inherited Material + public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().TUNGSTEN, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material + public static final Material WHITE_METAL = new Material("White Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material + public static final Material GRANITE = new Material("Ancient Granite", MaterialState.SOLID, TextureSet.SET_SAND, new short[] {107, 107, 107}, 500, 2000, 16, 12, false, "«»", 0, false);//Not a GT Inherited Material public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "§", 0);//Not a GT Inherited Material - public static final Material DRAGON_METAL = new Material("Dragon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material + public static final Material DRAGON_METAL = new Material("Dragonblood", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 11eaf05535..516f78038d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -273,7 +273,7 @@ GT_MetaTileEntity_MultiBlockBase { public final static String TAG_HIDE_HATCHES = "TAG_HIDE_HATCHES"; public final static String TAG_HIDE_POLLUTION = "TAG_HIDE_POLLUTION"; public final static String TAG_HIDE_MACHINE_TYPE = "TAG_HIDE_MACHINE_TYPE"; - + @Override public final String[] getDescription() { /*if (aCachedToolTip != null) { @@ -291,13 +291,13 @@ GT_MetaTileEntity_MultiBlockBase { aCachedToolTip = null; } }*/ - + String aRequiresMuffler = "1x Muffler Hatch"; String aRequiresCoreModule = "1x Core Module"; String aRequiresMaint = "1x Maintanence Hatch"; - + String[] x = getTooltip(); - + //Filter List, toggle switches, rebuild map without flags boolean showHatches = true; boolean showMachineType = true; @@ -323,8 +323,8 @@ GT_MetaTileEntity_MultiBlockBase { for (int ee = 0; ee < x.length; ee++) { x[ee] = aTempMap.get(ee); } - - + + //Assemble ordered map for misc tooltips AutoMap aOrderedMap = new AutoMap(); if (showHatches) { @@ -338,15 +338,15 @@ GT_MetaTileEntity_MultiBlockBase { if (showMachineType) { aOrderedMap.put(getMachineTooltip()); } - + if (showPollution) { aOrderedMap.put(getPollutionTooltip()); } - - - - - + + + + + //Add Stock Tooltip to bottom of list String[] z; z = new String[aOrderedMap.size()]; @@ -476,62 +476,6 @@ GT_MetaTileEntity_MultiBlockBase { } return true; } - - private int boostOutput(int aAmount) { - if (aAmount <= 0) { - return 10000; - } - if (aAmount <= 250) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 500) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 750) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 1000) { - aAmount = (aAmount*2); - } - else if (aAmount <= 1500) { - aAmount = (aAmount*2); - } - else if (aAmount <= 2000) { - aAmount = (int) (aAmount*1.5); - } - else if (aAmount <= 3000) { - aAmount = (int) (aAmount*1.5); - } - else if (aAmount <= 4000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 5000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 7000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 9000) { - aAmount = (int) (aAmount*1.1); - } - return Math.min(10000, aAmount); - } - - public GT_Recipe generateAdditionalOutputForRecipe(GT_Recipe aRecipe) { - AutoMap aNewChances = new AutoMap(); - for (int chance : aRecipe.mChances) { - aNewChances.put(boostOutput(chance)); - } - GT_Recipe aClone = aRecipe.copy(); - int[] aTemp = new int[aNewChances.size()]; - int slot = 0; - for (int g : aNewChances) { - aTemp[slot] = g; - slot++; - } - aClone.mChances = aTemp; - return aClone; - } /** * A Static {@link Method} object which holds the current status of logging. @@ -539,23 +483,16 @@ GT_MetaTileEntity_MultiBlockBase { public static Method aLogger = null; public void log(String s) { + boolean isDebugLogging = CORE.DEBUG; boolean reset = true; - - if (!isDebugLogging) { - return; - } - + if (aLogger == null || reset) { if (isDebugLogging) { - try { - aLogger = Logger.class.getMethod("INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} + aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); } else { - try { - aLogger = Logger.class.getMethod("MACHINE_INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} + aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); } } try { @@ -606,38 +543,195 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { + // Based on the Processing Array. A bit overkill, but very flexible. + + + if (this.doesMachineBoostOutput()) { + log("Boosting."); + return checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); + } + + //Control Core to control the Multiblocks behaviour. + int aControlCoreTier = getControlCoreTier(); + + //If no core, return false; + if (aControlCoreTier > 0) { + log("Control core found."); + } + + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + log("Running checkRecipeGeneric(0)"); + + //Check to see if Voltage Tier > Control Core Tier + if (tTier > aControlCoreTier) { + log("Control core found is lower tier than power tier. OK"); + tTier = (byte) aControlCoreTier; + } + GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + if (tRecipe == null) { log("BAD RETURN - 1"); return false; } - - //Boost output if machine implements this strategy - if (doesMachineBoostOutput()) { - return checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, tRecipe); - } - else { - return checkRecipeGeneric(tRecipe, aSpeedBonusPercent, aOutputChanceRoll); + + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + log("BAD RETURN - 2"); + return false; } - + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + log("Broke at "+parallelRecipes+"."); + break; + } + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List splitStacks = new ArrayList(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List tSList = new ArrayList(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + log("GOOD RETURN - 1"); + return true; } - + + + + + /* * Here we handle recipe boosting, which grants additional output %'s to recipes that do not have 100%. */ - + private boolean mHasBoostedCurrentRecipe = false; private GT_Recipe mBoostedRecipe = null; private ItemStack[] mInputVerificationForBoosting = null; - + /** * Does this machine boost it's output? * @return - if true, gives additional % to output chances. @@ -646,6 +740,65 @@ GT_MetaTileEntity_MultiBlockBase { return false; } + + + private int boostOutput(int aAmount) { + if (aAmount <= 0) { + return 10000; + } + if (aAmount <= 250) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 500) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 750) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 1000) { + aAmount = (aAmount*2); + } + else if (aAmount <= 1500) { + aAmount = (aAmount*2); + } + else if (aAmount <= 2000) { + aAmount = (int) (aAmount*1.5); + } + else if (aAmount <= 3000) { + aAmount = (int) (aAmount*1.5); + } + else if (aAmount <= 4000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 5000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 7000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 9000) { + aAmount = (int) (aAmount*1.1); + } + return Math.min(10000, aAmount); + } + + public GT_Recipe generateAdditionalOutputForRecipe(GT_Recipe aRecipe) { + AutoMap aNewChances = new AutoMap(); + for (int chance : aRecipe.mChances) { + aNewChances.put(boostOutput(chance)); + } + GT_Recipe aClone = aRecipe.copy(); + int[] aTemp = new int[aNewChances.size()]; + int slot = 0; + for (int g : aNewChances) { + aTemp[slot] = g; + slot++; + } + aClone.mChances = aTemp; + return aClone; + } + + /** * Processes recipes but provides a bonus to the output % of items if they are < 100%. * @@ -740,67 +893,6 @@ GT_MetaTileEntity_MultiBlockBase { // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; - if (tRecipe == null) { - log("BAD RETURN - 1"); - return false; - } - - // -- Try not to fail after this point - inputs have already been consumed! -- - return checkRecipeGeneric(tRecipe, aSpeedBonusPercent, aOutputChanceRoll); - } - - - /** - * Directly processes a recipe from a non-generic recipe handler - * @param aRecipe - A pre-modified GT_Recipe - * @return - Did we process? - */ - public boolean checkRecipeGeneric(GT_Recipe tRecipe, int rSpeedBonus, int aMaxOutputChance) { - // Based on the Processing Array. A bit overkill, but very flexible. - - if (tRecipe == null) { - return false; - } - - - ItemStack[] aItemInputs = tRecipe.mInputs; - FluidStack[] aFluidInputs = tRecipe.mFluidInputs; - int aMaxParallelRecipes = getMaxParallelRecipes(); - int aEUPercent = this.getEuDiscountForParallelism(); - int aSpeedBonusPercent = rSpeedBonus; - int aOutputChanceRoll = aMaxOutputChance; - - - - //Control Core to control the Multiblocks behaviour. - int aControlCoreTier = getControlCoreTier(); - - //If no core, return false; - if (aControlCoreTier == 0 && requireControlCores) { - log("No control core found."); - return false; - } - - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; - - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - log("Running checkRecipeGeneric(0)"); - - //Check to see if Voltage Tier > Control Core Tier - if (tTier > aControlCoreTier && requireControlCores) { - log("Control core found is lower tier than power tier."); - return false; - } - - log("Running checkRecipeGeneric(1)"); - // Remember last recipe - an optimization for findRecipe() - this.mLastRecipe = tRecipe; - if (tRecipe == null) { log("BAD RETURN - 1"); return false; @@ -851,11 +943,6 @@ GT_MetaTileEntity_MultiBlockBase { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - - //Only Overclock as high as the control circuit. - byte tTierOld = tTier; - tTier = getControlCoreTier() > 0 ? (byte) aControlCoreTier : tTierOld; - // Overclock if (this.mEUt <= 16) { this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); @@ -939,40 +1026,30 @@ GT_MetaTileEntity_MultiBlockBase { return true; } - public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe, - final float percentage) { - int cloneTime = 0; - GT_Recipe baseRecipe; - GT_Recipe cloneRecipe = null; - baseRecipe = tRecipe.copy(); - if ((baseRecipe != null) && ((cloneRecipe != baseRecipe) || (cloneRecipe == null))) { - cloneRecipe = baseRecipe.copy(); - log("Setting Recipe"); - } - if ((baseRecipe != null) && ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0))) { - cloneTime = baseRecipe.mDuration; - log("Setting Time"); - } - if ((cloneRecipe != null) && cloneRecipe.mDuration > 0) { - final int originalTime = cloneRecipe.mDuration; - final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, - (100 - percentage)); - cloneRecipe.mDuration = tempTime; - if (cloneRecipe.mDuration < originalTime) { - log("Generated recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return cloneRecipe; - } else { - log("Did not generate recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return tRecipe; - } - } - log("Error generating recipe, returning null."); - return null; - } + + + + + + + + + + + + + + + + + + + + + + public boolean isMachineRunning() { boolean aRunning = this.getBaseMetaTileEntity().isActive(); @@ -1166,13 +1243,13 @@ GT_MetaTileEntity_MultiBlockBase { } public int getControlCoreTier() { - + //Always return best tier if config is off. /*boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; if (!aCoresConfig) { return 10; }*/ - + if (mControlCoreBus.isEmpty()) { log("No Control Core Modules Found."); return 0; @@ -1212,9 +1289,9 @@ GT_MetaTileEntity_MultiBlockBase { log("Tried to add a secondary control core module."); return false; } - + GT_MetaTileEntity_Hatch_ControlCore Module = (GT_MetaTileEntity_Hatch_ControlCore) aMetaTileEntity; - + if (Module != null) { if (Module.setOwner(aTileEntity)) { log("Adding control core module."); @@ -1503,12 +1580,12 @@ GT_MetaTileEntity_MultiBlockBase { @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ Class mDynamoClass; - mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); - if (mDynamoClass != null){ - if (mDynamoClass.isInstance(aMetaTileEntity)){ - return true; - } + mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(aMetaTileEntity)){ + return true; } + } return false; } @@ -1540,7 +1617,7 @@ GT_MetaTileEntity_MultiBlockBase { return ""; } } - + private static Method calculatePollutionReduction; public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) { if (calculatePollutionReduction == null) { @@ -1794,17 +1871,17 @@ GT_MetaTileEntity_MultiBlockBase { } public abstract boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - + + public boolean isValidBlockForStructure(IGregTechTileEntity aBaseMetaTileEntity, int aCasingID, boolean canBeHatch, Block aFoundBlock, int aFoundMeta, Block aExpectedBlock, int aExpectedMeta) { boolean isHatch = false; if (aBaseMetaTileEntity != null) { - + if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); } - + isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { return true; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java index cf6e484ff5..4fde2d6916 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java @@ -1,16 +1,14 @@ package gtPlusPlus.xmod.gregtech.common.blocks.textures; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - import gregtech.api.enums.Textures; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; public class TexturesCentrifugeMultiblock { @@ -92,103 +90,55 @@ public class TexturesCentrifugeMultiblock { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[0].getIcon(); - } - return this.CENTRIFUGE[0].getIcon(); + return getIconByIndex(tMetaTileEntity, 0); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[3].getIcon(); - } - return this.CENTRIFUGE[3].getIcon(); + return getIconByIndex(tMetaTileEntity, 3); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[6].getIcon(); - } - return this.CENTRIFUGE[6].getIcon(); + return getIconByIndex(tMetaTileEntity, 6); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[1].getIcon(); - } - return this.CENTRIFUGE[1].getIcon(); + return getIconByIndex(tMetaTileEntity, 1); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[7].getIcon(); - } - return this.CENTRIFUGE[7].getIcon(); + return getIconByIndex(tMetaTileEntity, 7); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[8].getIcon(); - } - return this.CENTRIFUGE[8].getIcon(); + return getIconByIndex(tMetaTileEntity, 8); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[5].getIcon(); - } - return this.CENTRIFUGE[5].getIcon(); + return getIconByIndex(tMetaTileEntity, 5); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[2].getIcon(); - } - return this.CENTRIFUGE[2].getIcon(); + return getIconByIndex(tMetaTileEntity, 2); } } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[0].getIcon(); - } - return this.CENTRIFUGE[0].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 0); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[3].getIcon(); - } - return this.CENTRIFUGE[3].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 3); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[6].getIcon(); - } - return this.CENTRIFUGE[6].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 6); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[1].getIcon(); - } - return this.CENTRIFUGE[1].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 1); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[7].getIcon(); - } - return this.CENTRIFUGE[7].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 7); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[8].getIcon(); - } - return this.CENTRIFUGE[8].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 8); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[5].getIcon(); - } - return this.CENTRIFUGE[5].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 5); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[2].getIcon(); - } - return this.CENTRIFUGE[2].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 2); } } return TexturesGtBlock.Casing_Material_Centrifuge.getIcon(); @@ -440,15 +390,33 @@ public class TexturesCentrifugeMultiblock { return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); } - public boolean isUsingAnimatedTexture(TileEntity tTileEntity) { - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile instanceof GregtechMetaTileEntity_IndustrialCentrifuge) { - return ((GregtechMetaTileEntity_IndustrialCentrifuge) aTile).usingAnimations(); - } - } + public boolean isCentrifugeRunning(IMetaTileEntity aTile) { + if (aTile == null) { + return false; + } + else { + return aTile.getBaseMetaTileEntity().isActive(); + } + + + } + + public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) { + if (aMetaTileEntity != null) { + if (aMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge) { + return ((GregtechMetaTileEntity_IndustrialCentrifuge) aMetaTileEntity).usingAnimations(); + } + } return false; } + public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) { + if (isUsingAnimatedTexture(aMetaTileEntity)) { + if (isCentrifugeRunning(aMetaTileEntity)) { + return this.CENTRIFUGE_ACTIVE[aIndex].getIcon(); + } + } + return this.CENTRIFUGE[aIndex].getIcon(); + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index e3c05a8388..3f3a276f0c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -1,13 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; -import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -27,7 +24,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase { - private boolean mIsAnimated = true; + private boolean mIsAnimated; private static ITexture frontFace; private static ITexture frontFaceActive; private static CustomIcon GT9_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); @@ -38,10 +35,12 @@ extends GregtechMeta_MultiBlockBase { super(aID, aName, aNameRegional); frontFaceActive = new GT_RenderedTexture(GT9_5_Active); frontFace = new GT_RenderedTexture(GT9_5); + mIsAnimated = true; } public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { super(aName); + mIsAnimated = true; } @Override @@ -59,6 +58,7 @@ extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Industrial Centrifuge", "125% faster than using single block machines of the same voltage", + "Disable animations with a screwdriver", "Only uses 90% of the eu/t normally required", "Processes six items per voltage tier", "Size: 3x3x3 (Hollow)", @@ -179,13 +179,14 @@ extends GregtechMeta_MultiBlockBase { @Override public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - this.mIsAnimated = Utils.invertBoolean(mIsAnimated); + this.mIsAnimated = !mIsAnimated; + Logger.INFO("Is Centrifuge animated "+this.mIsAnimated); if (this.mIsAnimated) { - PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); + PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture. "); } else { - PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); - } + PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture. "); + } } @Override @@ -196,12 +197,18 @@ extends GregtechMeta_MultiBlockBase { @Override public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mIsAnimated = aNBT.getBoolean("mIsAnimated"); + super.loadNBTData(aNBT); + if (aNBT.hasKey("mIsAnimated")) { + mIsAnimated = aNBT.getBoolean("mIsAnimated"); + } + else { + mIsAnimated = true; + } } public boolean usingAnimations() { - return mIsAnimated; + //Logger.INFO("Is animated? "+this.mIsAnimated); + return this.mIsAnimated; } private ITexture getFrontFacingTurbineTexture(boolean isActive) { diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index e1102d708e..9ce7e83082 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -2609,7 +2609,7 @@ item.particle.ion.Antimony.name=Antimony Ion item.particle.ion.Tellurium.name=Tellurium Ion item.particle.ion.Iodine.name=Iodine Ion item.particle.ion.Xenon.name=Xenon Ion -item.particle.ion.Cesium.name=Cesium Ion +item.particle.ion.Cesium.name=Caesium Ion item.particle.ion.Barium.name=Barium Ion item.particle.ion.Lanthanum.name=Lanthanum Ion item.particle.ion.Cerium.name=Cerium Ion @@ -2770,4 +2770,105 @@ item.itemNuggetTeflon.name=Teflon Nugget item.itemPlateTeflon.name=Teflon Plate item.itemPlateDoubleTeflon.name=Double Teflon Plate item.itemCellTeflon.name=Teflon Cell -tile.Block of Teflon.name=Block of Teflon \ No newline at end of file +tile.Block of Teflon.name=Block of Teflon + +//Added 17/4/19 +//Spelling Corrections +item.particle.ion.Aluminium.name=Aluminium Ion +item.particle.ion.Caesium.name=Caesium Ion + +item.GTPP.MonsterKiller.Enderman.name=Enderman Killer +item.GTPP.MonsterKiller.Spider.name=Spider Killer +item.GTPP.MonsterKiller.Skeleton.name=Skeleton Killer +item.GTPP.MonsterKiller.Creeper.name=Creeper Killer +item.GTPP.MonsterKiller.Zombie.name=Zombie Killer +item.GTPP.MonsterKiller.Hellish.name=Nether Mob Killer + +item.itemIngotRunite.name=Runite Ingot +item.itemDustRunite.name=Runite Dust +item.itemDustTinyRunite.name=Tiny Pile of Runite Dust +item.itemDustSmallRunite.name=Small Pile of Runite Dust +item.itemNuggetRunite.name=Runite Nugget +item.itemPlateRunite.name=Runite Plate +item.itemPlateDoubleRunite.name=Double Runite Plate +item.itemCellRunite.name=Runite Cell +tile.Block of Runite.name=Block of Runite + +item.itemIngotDragonblood.name=Dragonblood Ingot +item.itemDustDragonblood.name=Dragonblood Dust +item.itemDustTinyDragonblood.name=Tiny Pile of Dragonblood Dust +item.itemDustSmallDragonblood.name=Small Pile of Dragonblood Dust +item.itemNuggetDragonblood.name=Dragonblood Nugget +item.itemPlateDragonblood.name=Dragonblood Plate +item.itemPlateDoubleDragonblood.name=Double Dragonblood Plate +item.itemCellDragonblood.name=Dragonblood Cell +tile.Block of Dragonblood.name=Block of Dragonblood + +item.itemIngotBlackTitanium.name=Black Titanium Ingot +item.itemDustBlackTitanium.name=Black Titanium Dust +item.itemDustTinyBlackTitanium.name=Tiny Pile of Black Titanium Dust +item.itemDustSmallBlackTitanium.name=Small Pile of Black Titanium Dust +item.itemNuggetBlackTitanium.name=Black Titanium Nugget +item.itemPlateBlackTitanium.name=Black Titanium Plate +item.itemPlateDoubleBlackTitanium.name=Double Black Titanium Plate +item.itemCellBlackTitanium.name=Black Titanium Cell +tile.Block of Black Titanium.name=Block of Black Titanium + +item.itemIngotAncientGranite.name=Ancient Granite Ingot +item.itemHotIngotAncientGranite.name=Hot Ancient Granite Ingot +item.itemDustAncientGranite.name=Ancient Granite Dust +item.itemDustTinyAncientGranite.name=Tiny Pile of Ancient Granite Dust +item.itemDustSmallAncientGranite.name=Small Pile of Ancient Granite Dust +item.itemNuggetAncientGranite.name=Ancient Granite Nugget +item.itemPlateAncientGranite.name=Ancient Granite Plate +item.itemPlateDoubleAncientGranite.name=Double Ancient Granite Plate +tile.Block of Ancient Granite.name=Block of Ancient Granite + +item.itemIngotBabbitAlloy.name=Babbit Alloy Ingot +item.itemHotIngotBabbitAlloy.name=Hot Babbit Alloy Ingot +item.itemDustBabbitAlloy.name=Babbit Alloy Dust +item.itemDustTinyBabbitAlloy.name=Tiny Pile of Babbit Alloy Dust +item.itemDustSmallBabbitAlloy.name=Small Pile of Babbit Alloy Dust +item.itemNuggetBabbitAlloy.name=Babbit Alloy Nugget +item.itemPlateBabbitAlloy.name=Babbit Alloy Plate +item.itemPlateDoubleBabbitAlloy.name=Double Babbit Alloy Plate +item.itemCellBabbitAlloy.name=Babbit Alloy Cell +tile.Block of Babbit Alloy.name=Block of Babbit Alloy + +item.itemIngotBlackMetal.name=Black Metal Ingot +item.itemHotIngotBlackMetal.name=Hot Black Metal Ingot +item.itemDustBlackMetal.name=Black Metal Dust +item.itemDustTinyBlackMetal.name=Tiny Pile of Black Metal Dust +item.itemDustSmallBlackMetal.name=Small Pile of Black Metal Dust +item.itemNuggetBlackMetal.name=Black Metal Nugget +item.itemPlateBlackMetal.name=Black Metal Plate +item.itemPlateDoubleBlackMetal.name=Double Black Metal Plate +item.itemBoltBlackMetal.name=Black Metal Bolt +item.itemRodBlackMetal.name=Black Metal Rod +item.itemRodLongBlackMetal.name=Long Black Metal Rod +item.itemRingBlackMetal.name=Black Metal Ring +item.itemScrewBlackMetal.name=Black Metal Screw +item.itemRotorBlackMetal.name=Black Metal Rotor +item.itemGearBlackMetal.name=Black Metal Gear +item.itemCellBlackMetal.name=Black Metal Cell +tile.Block of Black Metal.name=Block of Black Metal +tile.Black Metal Frame Box.name=Black Metal Frame Box + +item.itemIngotWhiteMetal.name=White Metal Ingot +item.itemHotIngotWhiteMetal.name=Hot White Metal Ingot +item.itemDustWhiteMetal.name=White Metal Dust +item.itemDustTinyWhiteMetal.name=Tiny Pile of White Metal Dust +item.itemDustSmallWhiteMetal.name=Small Pile of White Metal Dust +item.itemNuggetWhiteMetal.name=White Metal Nugget +item.itemPlateWhiteMetal.name=White Metal Plate +item.itemPlateDoubleWhiteMetal.name=Double White Metal Plate +item.itemBoltWhiteMetal.name=White Metal Bolt +item.itemRodWhiteMetal.name=White Metal Rod +item.itemRodLongWhiteMetal.name=Long White Metal Rod +item.itemRingWhiteMetal.name=White Metal Ring +item.itemScrewWhiteMetal.name=White Metal Screw +item.itemRotorWhiteMetal.name=White Metal Rotor +item.itemGearWhiteMetal.name=White Metal Gear +item.itemCellWhiteMetal.name=White Metal Cell +tile.Block of White Metal.name=Block of White Metal +tile.White Metal Frame Box.name=White Metal Frame Box \ No newline at end of file -- cgit From 5e528d66fbe29f499dae32bec895b1304c1b5513 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 17 Apr 2019 16:59:04 +1000 Subject: + Added textures for the Angle Grinders. % Adjusted Tooltips on Angle Grinders. --- .../common/blocks/textures/TexturesGtTools.java | 2 +- .../common/items/MetaGeneratedGregtechTools.java | 4 +- .../common/items/behaviours/Behaviour_Grinder.java | 94 +++++++++++++++++++++ .../common/tools/TOOL_Gregtech_AngelGrinder.java | 3 +- .../textures/items/iconsets/ANGEL_GRINDER.png | Bin 0 -> 410 bytes .../items/iconsets/ANGEL_GRINDER_OVERLAY.png | Bin 0 -> 143 bytes 6 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java index d9917dea44..12662af01e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java @@ -13,7 +13,7 @@ import gtPlusPlus.core.lib.CORE; public final class TexturesGtTools { public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); - public final static CustomIcon ANGEL_GRINDER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); + public final static CustomIcon ANGEL_GRINDER = new CustomIcon("iconsets/ANGEL_GRINDER"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 79ca23fe17..0f54b755fd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -27,9 +27,9 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { GregTech_API.sWrenchList); // Electric File - this.addTool(ANGLE_GRINDER, "Angel Grinder", "Handheld electric filing device", + this.addTool(ANGLE_GRINDER, "Angle Grinder", "Hand-held electric filing device", new TOOL_Gregtech_AngelGrinder(), - new Object[] { GregtechToolDictNames.craftingToolAngelGrinder, ToolDictNames.craftingToolFile, + new Object[] { GregtechToolDictNames.craftingToolAngleGrinder, ToolDictNames.craftingToolFile, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java new file mode 100644 index 0000000000..9012bb8cd8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java @@ -0,0 +1,94 @@ +package gtPlusPlus.xmod.gregtech.common.items.behaviours; + +import java.util.List; + +import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.items.GT_MetaBase_Item; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class Behaviour_Grinder implements IItemBehaviour { + + @Override + public boolean onLeftClickEntity(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, Entity var4) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean onItemUse(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5, int var6, + int var7, int var8, float var9, float var10, float var11) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean onItemUseFirst(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5, + int var6, int var7, int var8, float var9, float var10, float var11) { + // TODO Auto-generated method stub + return false; + } + + @Override + public ItemStack onItemRightClick(GT_MetaBase_Item var1, ItemStack var2, World var3, EntityPlayer var4) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getAdditionalToolTips(GT_MetaBase_Item var1, List var2, ItemStack var3) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void onUpdate(GT_MetaBase_Item var1, ItemStack var2, World var3, Entity var4, int var5, boolean var6) { + // TODO Auto-generated method stub + + } + + @Override + public boolean isItemStackUsable(GT_MetaBase_Item var1, ItemStack var2) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean canDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) { + // TODO Auto-generated method stub + return false; + } + + @Override + public ItemStack onDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3) { + // TODO Auto-generated method stub + return false; + } + + @Override + public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4, double var5, + double var7, double var9) { + // TODO Auto-generated method stub + return null; + } + + @Override + public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4, + EntityLivingBase var5, float var6) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java index eca7e4d9ee..333849108f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java @@ -9,6 +9,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures.ItemIcons; import gregtech.api.interfaces.IIconContainer; import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.tools.GT_Tool; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Choocher; @@ -186,7 +187,7 @@ extends GT_Tool { @Override public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { - aItem.addItemBehavior(aID, new Behaviour_Choocher()); + aItem.addItemBehavior(aID, new Behaviour_None()); } @Override diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png new file mode 100644 index 0000000000..154c0a0b44 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png new file mode 100644 index 0000000000..d83a131004 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png differ -- cgit From c6a5a5fae97f64392806d7830794f792c3d214fd Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 17 Apr 2019 23:55:34 +1000 Subject: + Added Electric Wire Cutters. % Adjusted Angle Grinder Recipes. --- src/Java/gtPlusPlus/GTplusplus.java | 1 + src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 1 + .../gregtech/api/enums/GregtechOrePrefixes.java | 1 + .../gregtech/api/enums/GregtechToolDictNames.java | 2 +- .../common/blocks/textures/TexturesGtTools.java | 1 + .../common/items/MetaGeneratedGregtechTools.java | 10 ++ .../common/tools/TOOL_Gregtech_AngelGrinder.java | 5 +- .../common/tools/TOOL_Gregtech_ElectricSnips.java | 197 +++++++++++++++++++++ .../gregtech/loaders/ProcessingAngelGrinder.java | 54 +++--- .../gregtech/loaders/ProcessingElectricSnips.java | 136 ++++++++++++++ .../textures/items/iconsets/ELECTRIC_SNIPS.png | Bin 0 -> 501 bytes .../items/iconsets/ELECTRIC_SNIPS_OVERLAY.png | Bin 0 -> 143 bytes 12 files changed, 384 insertions(+), 24 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 020cde09de..9de0af65f6 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -126,6 +126,7 @@ public class GTplusplus implements ActionListener { // Tools Logger.WARNING("Processing texture: " + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); Logger.WARNING("Processing texture: " + TexturesGtTools.ANGEL_GRINDER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_SNIPS.getTextureFile().getResourcePath()); // Blocks Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 6fdf91776c..f4960a3014 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -95,6 +95,7 @@ public class HANDLER_GT { new ProcessingToolHeadChoocher().run(); } new ProcessingAngelGrinder().run(); + new ProcessingElectricSnips().run(); if (CORE.ConfigSwitches.enableNitroFix){ GregtechNitroDieselFix.run(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index c9da95f951..104fe1ba2e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -55,6 +55,7 @@ public enum GregtechOrePrefixes { toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index 83a83054a5..5be95e6f53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -2,6 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.enums; public enum GregtechToolDictNames { - craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder; + craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder, craftingToolElectricSnips; } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java index 12662af01e..944a345b7e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java @@ -14,6 +14,7 @@ public final class TexturesGtTools { public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); public final static CustomIcon ANGEL_GRINDER = new CustomIcon("iconsets/ANGEL_GRINDER"); + public final static CustomIcon ELECTRIC_SNIPS = new CustomIcon("iconsets/ELECTRIC_SNIPS"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 0f54b755fd..4a3430502c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -7,11 +7,13 @@ import gregtech.api.items.GT_MetaGenerated_Tool; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricSnips; public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { public static final short SKOOKUM_CHOOCHER = 7734; public static final short ANGLE_GRINDER = 7834; + public static final short ELECTRIC_SNIPS = 7934; public static GT_MetaGenerated_Tool INSTANCE; public MetaGeneratedGregtechTools() { @@ -33,6 +35,14 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Wire Cutter + this.addTool(ELECTRIC_SNIPS, "Automatic Snips", "Hand-held electric wire cutter", + new TOOL_Gregtech_ElectricSnips(), + new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java index 333849108f..53dbf58cf2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java @@ -5,6 +5,7 @@ import java.util.List; import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures.ItemIcons; import gregtech.api.interfaces.IIconContainer; @@ -161,9 +162,9 @@ extends GT_Tool { } public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { - return aIsToolHead + return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa - : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mRGBa; + : Materials.Diamond.mRGBa; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java new file mode 100644 index 0000000000..9974519c71 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java @@ -0,0 +1,197 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricSnips +extends GT_Tool { + + public static final List mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 4.0F; + } + + @Override + public float getSpeedMultiplier() { + return 1F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.4F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("cutter")); + } + + + @Override + public int convertBlockDrops(final List aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_SNIPS + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return !aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Snipped out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_None()); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java index 040d1bed52..987a1c8fbf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java @@ -1,20 +1,22 @@ package gtPlusPlus.xmod.gregtech.loaders; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler.RecipeBits; import gregtech.api.util.GT_OreDictUnificator; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, Runnable { public ProcessingAngelGrinder() { @@ -48,7 +50,7 @@ public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, R public void materialsLoops() { final Materials[] i = Materials.values(); final int size = i.length; - Logger.WARNING("Materials to attempt tool gen. with: " + size); + Logger.INFO("Materials to attempt tool gen. with: " + size); int used = 0; Materials aMaterial = null; for (int r = 0; r < size; r++) { @@ -59,21 +61,20 @@ public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, R && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) && (!aMaterial.contains(SubTag.NO_SMELTING))) { - Logger.WARNING("Found " + aMaterial.name() + " as a valid Angle Grinder Material."); + Logger.INFO("Generating Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); // Input 1 - + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + //final ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); - if ((null != plate)) { + if ((null != plate /*&& longrod != null*/)) { addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); used++; } else { - Logger.WARNING("" + aMaterial.name() + " could not be used for all input compoenents. [3x" - + aMaterial.name() + " plates, 2x" + aMaterial.name() + " ingots, 1x" + aMaterial.name() - + " Hard Hammer Head."); + Logger.INFO("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) /*+" | Rod? "+(longrod == null)+" |"*/); } // GT_ModHandler.addCraftingRecipe(, // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | @@ -82,10 +83,10 @@ public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, R // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); } else { - Logger.WARNING("" + aMaterial.name() + " was not a valid Angle Grinder Material."); + Logger.INFO("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); } } else { - Logger.WARNING("" + aMaterial.name() + " was not a valid Angle Grinder Material."); + Logger.INFO("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); } } @@ -100,13 +101,24 @@ public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, R } public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ANGLE_GRINDER, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.INFO("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + return GT_ModHandler.addCraftingRecipe( - MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( - MetaGeneratedGregtechTools.ANGLE_GRINDER, - 1, - aMaterial, - Materials.TungstenSteel, - new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}), + aOutputStack, RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, new Object[]{ "SXS", @@ -116,7 +128,7 @@ public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, R 'M', CI.getElectricMotor(aVoltageTier, 1), 'S', OrePrefixes.screw.get(Materials.Titanium), 'P', OrePrefixes.plate.get(aMaterial), - 'G', OrePrefixes.gearGt.get(Materials.StainlessSteel), + 'G', OrePrefixes.gearGtSmall.get(Materials.Tungsten), 'B', aBattery }); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java new file mode 100644 index 0000000000..e64b580fd5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java @@ -0,0 +1,136 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricSnips implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricSnips() { + GregtechOrePrefixes.toolElectricSnips.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.INFO("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.INFO("Generating Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.INFO("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.INFO("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.INFO("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Snipss for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_SNIPS, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.INFO("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', ItemList.Component_Grinder_Tungsten.get(1), + 'M', CI.getElectricMotor(aVoltageTier+1, 1), + 'S', OrePrefixes.screw.get(Materials.Tungsten), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', OrePrefixes.gearGtSmall.get(Materials.Titanium), + 'B', aBattery + }); + + } + +} \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png new file mode 100644 index 0000000000..8ccd7f3c1a Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png new file mode 100644 index 0000000000..d83a131004 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png differ -- cgit From 7f7eecf6a84264ca229f6b8d6759004a9a21ae5d Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 18 Apr 2019 05:21:38 +1000 Subject: + Added more tools. --- src/Java/gtPlusPlus/GTplusplus.java | 4 +- src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 2 + .../gregtech/api/enums/GregtechOrePrefixes.java | 2 + .../gregtech/api/enums/GregtechToolDictNames.java | 2 +- .../common/blocks/textures/TexturesGtTools.java | 4 +- .../common/items/MetaGeneratedGregtechTools.java | 20 +++ .../behaviours/Behaviour_Electric_Lighter.java | 143 +++++++++++++++ .../common/tools/TOOL_Gregtech_AngelGrinder.java | 4 +- .../tools/TOOL_Gregtech_ElectricButcherKnife.java | 197 ++++++++++++++++++++ .../tools/TOOL_Gregtech_ElectricLighter.java | 198 +++++++++++++++++++++ .../common/tools/TOOL_Gregtech_ElectricSnips.java | 4 +- .../loaders/ProcessingElectricButcherKnife.java | 143 +++++++++++++++ .../loaders/ProcessingElectricLighter.java | 143 +++++++++++++++ .../textures/items/iconsets/ANGEL_GRINDER.png | Bin 410 -> 0 bytes .../items/iconsets/ANGEL_GRINDER_OVERLAY.png | Bin 143 -> 0 bytes .../textures/items/iconsets/ANGLE_GRINDER.png | Bin 0 -> 387 bytes .../items/iconsets/ANGLE_GRINDER_OVERLAY.png | Bin 0 -> 143 bytes .../items/iconsets/ELECTRIC_BUTCHER_KNIFE.png | Bin 0 -> 336 bytes .../iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png | Bin 0 -> 143 bytes .../textures/items/iconsets/ELECTRIC_LIGHTER.png | Bin 0 -> 313 bytes .../items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png | Bin 0 -> 257 bytes 21 files changed, 859 insertions(+), 7 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java delete mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png delete mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png create mode 100644 src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png (limited to 'src/resources') diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 9de0af65f6..424a63e9bf 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -125,8 +125,10 @@ public class GTplusplus implements ActionListener { Logger.INFO("Loading some textures on the client."); // Tools Logger.WARNING("Processing texture: " + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); - Logger.WARNING("Processing texture: " + TexturesGtTools.ANGEL_GRINDER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ANGLE_GRINDER.getTextureFile().getResourcePath()); Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_SNIPS.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_LIGHTER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_BUTCHER_KNIFE.getTextureFile().getResourcePath()); // Blocks Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index f4960a3014..169683d251 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -96,6 +96,8 @@ public class HANDLER_GT { } new ProcessingAngelGrinder().run(); new ProcessingElectricSnips().run(); + new ProcessingElectricButcherKnife().run(); + new ProcessingElectricLighter().run(); if (CORE.ConfigSwitches.enableNitroFix){ GregtechNitroDieselFix.run(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 104fe1ba2e..b17b4a26ff 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -56,6 +56,8 @@ public enum GregtechOrePrefixes { toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricLighter("Electric Lighter", "", "Electric Lighter", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricButcherKnife("Electric Butcher Knife", "", "Electric Butcher Knife", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index 5be95e6f53..105023065c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -2,6 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.enums; public enum GregtechToolDictNames { - craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder, craftingToolElectricSnips; + craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder, craftingToolElectricSnips, craftingToolElectricLighter, craftingToolElectricButcherKnife; } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java index 944a345b7e..ee104eaca3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java @@ -13,8 +13,10 @@ import gtPlusPlus.core.lib.CORE; public final class TexturesGtTools { public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); - public final static CustomIcon ANGEL_GRINDER = new CustomIcon("iconsets/ANGEL_GRINDER"); + public final static CustomIcon ANGLE_GRINDER = new CustomIcon("iconsets/ANGLE_GRINDER"); public final static CustomIcon ELECTRIC_SNIPS = new CustomIcon("iconsets/ELECTRIC_SNIPS"); + public final static CustomIcon ELECTRIC_LIGHTER = new CustomIcon("iconsets/ELECTRIC_LIGHTER"); + public final static CustomIcon ELECTRIC_BUTCHER_KNIFE = new CustomIcon("iconsets/ELECTRIC_BUTCHER_KNIFE"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 4a3430502c..dbae4fe194 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -7,10 +7,14 @@ import gregtech.api.items.GT_MetaGenerated_Tool; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricButcherKnife; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricLighter; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricSnips; public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { + public static final short ELECTRIC_LIGHTER = 7534; + public static final short ELECTRIC_BUTCHER_KNIFE = 7634; public static final short SKOOKUM_CHOOCHER = 7734; public static final short ANGLE_GRINDER = 7834; public static final short ELECTRIC_SNIPS = 7934; @@ -43,6 +47,22 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Lighter + this.addTool(ELECTRIC_LIGHTER, "Pyromatic 9k", "Electric Fire!", + new TOOL_Gregtech_ElectricLighter(), + new Object[] { GregtechToolDictNames.craftingToolElectricLighter, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Butcher Knife + this.addTool(ELECTRIC_BUTCHER_KNIFE, "Meat-o-matic", "Electric butcher knife", + new TOOL_Gregtech_ElectricButcherKnife(), + new Object[] { GregtechToolDictNames.craftingToolElectricButcherKnife, ToolDictNames.craftingToolKnife, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java new file mode 100644 index 0000000000..278b556733 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java @@ -0,0 +1,143 @@ +package gtPlusPlus.xmod.gregtech.common.items.behaviours; + +import java.util.List; + +import codechicken.lib.math.MathHelper; +import gregtech.api.GregTech_API; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Utility.ItemNBT; +import gregtech.common.items.behaviors.Behaviour_None; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import ic2.api.item.IElectricItemManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class Behaviour_Electric_Lighter extends Behaviour_None { + + private final ItemStack mLighter; + + private final long mFuelAmount; + + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip", + "Can light things on Fire"); + private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses", + "Remaining Uses:"); + private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", + "Not usable when stacked!"); + + public Behaviour_Electric_Lighter(ItemStack aFullLighter, long aFuelAmount) { + this.mLighter = aFullLighter; + this.mFuelAmount = aFuelAmount; + } + + public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { + if (!aPlayer.worldObj.isRemote && aStack.stackSize == 1) { + boolean rOutput = false; + if (aEntity instanceof EntityCreeper) { + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + GT_Utility.sendSoundToPlayers(aPlayer.worldObj, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, + MathHelper.floor_double(aEntity.posX), MathHelper.floor_double(aEntity.posY), + MathHelper.floor_double(aEntity.posZ)); + ((EntityCreeper) aEntity).func_146079_cb(); + rOutput = true; + } + } + return rOutput; + } else { + return false; + } + } + + public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, + int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + return false; + } + + public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, + int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + if (!aWorld.isRemote && aStack.stackSize == 1) { + Logger.WARNING("Preparing Lighter a"); + boolean rOutput = false; + ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); + aX += tDirection.offsetX; + aY += tDirection.offsetY; + aZ += tDirection.offsetZ; + if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + Logger.WARNING("Preparing Lighter b"); + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + Logger.WARNING("Preparing Lighter c"); + GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY, + aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.fire); + rOutput = true; + // ItemNBT.setLighterFuel(aStack, tFuelAmount); + return rOutput; + } + } + } + Logger.WARNING("Preparing Lighter z"); + return false; + } + + private boolean prepare(ItemStack aStack) { + if (aStack != null) { + Logger.WARNING("Preparing Lighter 1"); + if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { + Logger.WARNING("Preparing Lighter 2"); + if (ChargingHelper.isItemValid(aStack)) { + Logger.WARNING("Preparing Lighter 3"); + if (aStack.getItem() instanceof IElectricItemManager) { + Logger.WARNING("Preparing Lighter 4"); + IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem(); + double aCharge = aItemElec.getCharge(aStack); + long aEuCost = 4096 * 2; + if (aCharge >= aEuCost) { + Logger.WARNING("Preparing Lighter 5"); + aItemElec.discharge(aStack, aEuCost, 3, true, true, false); + return true; + } + } + } + } + } + Logger.WARNING("Preparing Lighter 0"); + return false; + } + + private void useUp(ItemStack aStack) { + + } + + public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) { + aList.add(this.mTooltip); + int aUses = 0; + + if (aStack != null) { + if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { + if (ChargingHelper.isItemValid(aStack)) { + if (aStack.getItem() instanceof IElectricItemManager) { + IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem(); + double aCharge = aItemElec.getCharge(aStack); + long aEuCost = 4096 * 2; + aUses = (int) (aCharge / aEuCost); + } + } + } + } + + NBTTagCompound tNBT = aStack.getTagCompound(); + aList.add(this.mTooltipUses + " " + aUses); + aList.add(this.mTooltipUnstackable); + return aList; + } +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java index 53dbf58cf2..905164802c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java @@ -157,14 +157,14 @@ extends GT_Tool { public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { return (IIconContainer) (aIsToolHead - ? TexturesGtTools.ANGEL_GRINDER + ? TexturesGtTools.ANGLE_GRINDER : ItemIcons.POWER_UNIT_HV); } public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa - : Materials.Diamond.mRGBa; + : Materials.TungstenSteel.mRGBa; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java new file mode 100644 index 0000000000..ff4be9dd93 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java @@ -0,0 +1,197 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricButcherKnife +extends GT_Tool { + + public static final List mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 8.0F; + } + + @Override + public float getSpeedMultiplier() { + return 2F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.8F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + } + + + @Override + public int convertBlockDrops(final List aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_BUTCHER_KNIFE + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : Materials.RedSteel.mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Sliced out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_None()); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java new file mode 100644 index 0000000000..cf6f33cc36 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java @@ -0,0 +1,198 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Electric_Lighter; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricLighter +extends GT_Tool { + + public static final List mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 8.0F; + } + + @Override + public float getSpeedMultiplier() { + return 2F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.8F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + } + + + @Override + public int convertBlockDrops(final List aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_LIGHTER + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return !aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : Materials.Silver.mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Ground out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter(null, 32000)); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java index 9974519c71..bc0c821478 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java @@ -156,13 +156,13 @@ extends GT_Tool { public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { return (IIconContainer) (aIsToolHead ? TexturesGtTools.ELECTRIC_SNIPS - : ItemIcons.POWER_UNIT_HV); + : ItemIcons.POWER_UNIT_MV); } public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa - : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mRGBa; + : GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java new file mode 100644 index 0000000000..e8f9f5129c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java @@ -0,0 +1,143 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricButcherKnife implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricButcherKnife() { + GregtechOrePrefixes.toolElectricButcherKnife.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Butcher Knifes for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_BUTCHER_KNIFE, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.BUTCHERYKNIFE, + 1, + aMaterial, + aMaterial, + null); + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', aInputCutter, + 'M', CI.getElectricMotor(aVoltageTier, 1), + 'S', OrePrefixes.wireFine.get(Materials.Electrum), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.WHITE_METAL.getGear(1), + 'B', aBattery + }); + + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java new file mode 100644 index 0000000000..f3dc546191 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java @@ -0,0 +1,143 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricLighter implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricLighter() { + GregtechOrePrefixes.toolElectricLighter.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Lighters for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_LIGHTER, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, + 1, + aMaterial, + aMaterial, + null); + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', aInputCutter, + 'M', CI.getSensor(aVoltageTier, 1), + 'S', OrePrefixes.wireGt04.get(Materials.Gold), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.RUNITE.getPlate(1), + 'B', aBattery + }); + + } + +} \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png deleted file mode 100644 index 154c0a0b44..0000000000 Binary files a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER.png and /dev/null differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png deleted file mode 100644 index d83a131004..0000000000 Binary files a/src/resources/assets/miscutils/textures/items/iconsets/ANGEL_GRINDER_OVERLAY.png and /dev/null differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png new file mode 100644 index 0000000000..3030cbe6aa Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png new file mode 100644 index 0000000000..d83a131004 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png new file mode 100644 index 0000000000..5114f2c9a8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png new file mode 100644 index 0000000000..d83a131004 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png new file mode 100644 index 0000000000..1c6257f336 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png differ diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png new file mode 100644 index 0000000000..1c91860461 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png differ -- cgit