diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/core/item')
10 files changed, 13 insertions, 761 deletions
diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java index c411555d4d..cbd149fbdf 100644 --- a/src/main/java/gtPlusPlus/core/item/ModItems.java +++ b/src/main/java/gtPlusPlus/core/item/ModItems.java @@ -64,7 +64,6 @@ import gtPlusPlus.core.item.general.chassis.ItemDehydratorCoilWire; import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg; import gtPlusPlus.core.item.init.ItemsFoods; import gtPlusPlus.core.item.materials.DustDecayable; -import gtPlusPlus.core.item.tool.misc.DebugScanner; import gtPlusPlus.core.item.tool.misc.GregtechPump; import gtPlusPlus.core.item.wearable.WearableLoader; import gtPlusPlus.core.lib.CORE; @@ -98,8 +97,6 @@ public final class ModItems { public static Item itemIngotBatteryAlloy; - public static Item itemHydrogenBlob; - public static Item itemBedLocator_Base; public static Item itemBaseItemWithCharge; @@ -212,8 +209,6 @@ public final class ModItems { public static BatteryPackBaseBauble itemChargePack_High_3; public static BatteryPackBaseBauble itemChargePack_High_4; - public static DebugScanner itemDebugScanner; - public static ItemDummyResearch itemDummyResearch; public static BaseItemMetaFood itemMetaFood; @@ -234,7 +229,6 @@ public final class ModItems { public static void init() { - itemDebugScanner = new DebugScanner(); itemMagicFeather = new ItemMagicFeather(); itemAlkalusDisk = new BaseItemDamageable( @@ -256,8 +250,6 @@ public final class ModItems { MetaGeneratedGregtechItems.INSTANCE.generateMetaItems(); // Register Hydrogen Blobs first, so we can replace old helium blobs. - itemHydrogenBlob = new CoreItem("itemHydrogenBlob", "Mysterious Hydrogen Blob", tabMisc) - .setTextureName(GTPlusPlus.ID + ":itemHeliumBlob"); // Register Old Helium Blob, this will be replaced when held by a player. // Load Wearable Items @@ -720,10 +712,7 @@ public final class ModItems { // Xp Fluids - Dev if (!FluidRegistry.isFluidRegistered("mobessence")) { - FluidUtils.generateFluidNoPrefix("mobessence", "mobessence", 0, new short[] { 125, 175, 125, 100 }); - } - if (!FluidRegistry.isFluidRegistered("xpjuice")) { - FluidUtils.generateFluidNoPrefix("xpjuice", "xpjuice", 0, new short[] { 50, 150, 50, 100 }); + FluidUtils.generateFluidNoPrefix("mobessence", "Mob Essence", 0, new short[] { 125, 175, 125, 100 }); } dustNeptunium238 = new DustDecayable( diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index be73e92aee..cf50da52a3 100644 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -26,12 +26,6 @@ public class ItemBlockBasicTile extends ItemBlock { list.add("Can also be placed beside upto 4 other fish traps"); list.add("Requires at least two faces touching water"); list.add("1/1000 chance to produce triple loot."); - } else if (this.mID == 1) { // Modularity - list.add("Used to construct modular armour & bauble upgrades.."); - } else if (this.mID == 2) { // Trade - list.add("Allows for SMP trade-o-mat type trading."); - } else if (this.mID == 3) { // Project - list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter.."); } else if (this.mID == 4) { // Circuit Table list.add("Easy Circuit Configuration"); list.add("Change default setting with a Screwdriver"); @@ -44,8 +38,6 @@ public class ItemBlockBasicTile extends ItemBlock { list.add("Kills Forestry Butterflies, Bats and other pests"); list.add("Use either Formaldehyde or Hydrogen cyanide"); list.add("Be weary of your neighbours"); - } else if (this.mID == 7) { // Egg Box - list.add("A box for holding big eggs"); } else if (this.mID == 8) { // Volumetric Flask Setter list.add("Easy Flask Configuration"); list.add("Configure default input slot with a screwdriver"); diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java index cdb2934a40..c88a8581b6 100644 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java +++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java @@ -17,8 +17,6 @@ import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.everglades.gen.gt.WorldGen_GT_Ore_Layer; @@ -28,7 +26,6 @@ public class ItemBlockOre extends ItemBlock { private final BlockBaseOre mThisOre; private final Material mThisMaterial; private final int mThisRadiation; - private final int mThisColour; public ItemBlockOre(final Block block) { super(block); @@ -36,19 +33,13 @@ public class ItemBlockOre extends ItemBlock { this.mThisOre = (BlockBaseOre) block; this.mThisMaterial = this.mThisOre.getMaterialEx(); this.mThisRadiation = this.mThisMaterial.vRadiationLevel; - this.mThisColour = this.mThisMaterial.getRgbAsHex(); } else { this.mThisOre = null; this.mThisMaterial = null; this.mThisRadiation = 0; - this.mThisColour = Utils.rgbtoHexValue(255, 255, 255); } } - public int getRenderColor(final int aMeta) { - return this.mThisColour; - } - private static Map<String, AutoMap<String>> mMapOreBlockItemToDimName = new LinkedHashMap<>(); private static boolean mInitOres_Everglades = false; private AutoMap<String> mDimsForThisOre = new AutoMap<>(); @@ -83,17 +74,6 @@ public class ItemBlockOre extends ItemBlock { list.add(CORE.GT_Tooltip_Radioactive.get()); } - /** - * Tooltip Handler for Ores - */ - if (this.mThisMaterial == FLUORIDES.FLUORITE) { - list.add( - "Mined from Sandstone with a 1/" + (CORE.ConfigSwitches.chanceToDropFluoriteOre * 20) - + " chance, or Limestone with a 1/" - + (CORE.ConfigSwitches.chanceToDropFluoriteOre) - + " chance."); - } - if (this.mThisMaterial != null) { list.add("Ore contains: "); if (mThisMaterial.getComposites().isEmpty()) { @@ -109,7 +89,6 @@ public class ItemBlockOre extends ItemBlock { Block b = Block.getBlockFromItem(stack.getItem()); if (b != null) { - String aTool = b.getHarvestTool(stack.getItemDamage()); int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); if (aMiningLevel1 != 0) { list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java index 7b017fb093..74e810f9bd 100644 --- a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java +++ b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java @@ -2,14 +2,12 @@ package gtPlusPlus.core.item.bauble; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingAttackEvent; @@ -22,12 +20,10 @@ import baubles.common.container.InventoryBaubles; import baubles.common.lib.PlayerHandler; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Mods; import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; import gtPlusPlus.core.util.minecraft.NBTUtils; @Optional.InterfaceList( @@ -43,17 +39,7 @@ public class BaseBauble extends Item implements IBauble { private List<String> damageNegations = new ArrayList<>(); Multimap<String, AttributeModifier> attributes = HashMultimap.create(); - public BaseBauble(BaubleType type, String displayName) { - this.mThisBauble = type; - Utils.registerEvent(this); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(Utils.sanitizeString(displayName.toLowerCase())); - GT_LanguageManager.addStringLocalization("gtplusplus." + getUnlocalizedName() + ".name", displayName); - GameRegistry.registerItem(this, getUnlocalizedName()); - } - - public BaseBauble(BaubleType type, String unlocalName, int register) { + public BaseBauble(BaubleType type) { this.mThisBauble = type; Utils.registerEvent(this); this.setMaxStackSize(1); @@ -77,26 +63,14 @@ public class BaseBauble extends Item implements IBauble { } } - public boolean addDamageNegation(DamageSource damageSource) { - return addDamageNegation(damageSource, null); - } - - public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) { - return damageNegations.add(damageSource.damageType); - } - - public void clearDamageNegation() { - damageNegations.clear(); - } - @Override public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { - return EntityPlayer.class.isInstance(arg1) ? true : false; + return arg1 instanceof EntityPlayer; } @Override public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { - return EntityPlayer.class.isInstance(arg1) ? true : false; + return arg1 instanceof EntityPlayer; } @Override @@ -104,23 +78,10 @@ public class BaseBauble extends Item implements IBauble { return mThisBauble; } - public boolean SetBaubleType(BT arg0) { - return SetBaubleType(arg0.getType()); - } - - public boolean SetBaubleType(BaubleType arg0) { - BaubleType temp = this.mThisBauble; - this.mThisBauble = arg0; - if (this.mThisBauble != temp) { - return true; - } - return false; - } - @Override public void onEquipped(ItemStack stack, EntityLivingBase entity) { - if (entity != null && EntityPlayer.class.isInstance(entity)) { - onEquippedOrLoadedIntoWorld(stack, entity); + if (entity instanceof EntityPlayer) { + onEquippedOrLoadedIntoWorld(entity); setPlayerHashcode(stack, entity.hashCode()); } } @@ -128,26 +89,22 @@ public class BaseBauble extends Item implements IBauble { @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { if (getPlayerHashcode(stack) != player.hashCode()) { - onEquippedOrLoadedIntoWorld(stack, player); + onEquippedOrLoadedIntoWorld(player); setPlayerHashcode(stack, player.hashCode()); } } - public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) { + public void onEquippedOrLoadedIntoWorld(EntityLivingBase player) { attributes.clear(); - fillModifiers(attributes, stack); player.getAttributeMap().applyAttributeModifiers(attributes); } @Override public void onUnequipped(ItemStack stack, EntityLivingBase player) { attributes.clear(); - fillModifiers(attributes, stack); player.getAttributeMap().removeAttributeModifiers(attributes); } - void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {} - public ItemStack getCorrectBauble(EntityPlayer player) { InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); ItemStack stack1 = baubles.getStackInSlot(1); @@ -164,19 +121,6 @@ public class BaseBauble extends Item implements IBauble { return Integer.MAX_VALUE; } - public static UUID getBaubleUUID(ItemStack stack) { - long most = NBTUtils.getLong(stack, "baubleUUIDMost"); - if (most == 0) { - UUID uuid = UUID.randomUUID(); - NBTUtils.setLong(stack, "baubleUUIDMost", uuid.getMostSignificantBits()); - NBTUtils.setLong(stack, "baubleUUIDLeast", uuid.getLeastSignificantBits()); - return getBaubleUUID(stack); - } - - long least = NBTUtils.getLong(stack, "baubleUUIDLeast"); - return new UUID(most, least); - } - public static int getPlayerHashcode(ItemStack stack) { return NBTUtils.getInteger(stack, "mPlayerHashcode"); } diff --git a/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java index 0b8ce24974..e6b3ab9941 100644 --- a/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java +++ b/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java @@ -39,7 +39,7 @@ public abstract class ElectricBaseBauble extends BaseBauble implements IElectric private final BaubleType mType; public ElectricBaseBauble(BaubleType aType, int aTier, double aMaxEU, String aUnlocalName) { - super(aType, aUnlocalName, 0); + super(aType); mType = aType; mTier = aTier; maxValueEU = aMaxEU; diff --git a/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java index 5e31b2ad89..95c2462e23 100644 --- a/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java +++ b/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java @@ -41,7 +41,7 @@ public class FireProtectionBauble extends BaseBauble { } public FireProtectionBauble() { - super(BaubleType.RING, "GTPP.bauble.fireprotection.0" + ".name", 0); + super(BaubleType.RING); String aUnlocalName = "GTPP.bauble.fireprotection.0" + ".name"; this.setUnlocalizedName(aUnlocalName); this.setTextureName(GTPlusPlus.ID + ":" + getTextureNameForBauble()); @@ -70,7 +70,6 @@ public class FireProtectionBauble extends BaseBauble { return false; } - @SuppressWarnings("unchecked") @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { super.addInformation(stack, aPlayer, list, bool); @@ -87,11 +86,7 @@ public class FireProtectionBauble extends BaseBauble { } @Override - public void onEquipped(final ItemStack arg0, final EntityLivingBase aPlayer) { - if (!aPlayer.worldObj.isRemote) { - if (aPlayer instanceof EntityPlayer bPlayer) {} - } - } + public void onEquipped(final ItemStack arg0, final EntityLivingBase aPlayer) {} @Override public void onUnequipped(final ItemStack arg0, final EntityLivingBase aPlayer) { diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java index 09838c6bac..1fd9416b90 100644 --- a/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java +++ b/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java @@ -4,6 +4,7 @@ import static gregtech.api.util.GT_RecipeBuilder.SECONDS; import static gregtech.api.util.GT_RecipeConstants.UniversalChemical; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -94,7 +95,7 @@ public class NuclearChem extends ItemPackage { .itemInputs( GT_OreDictUnificator.get(OrePrefixes.gem, Materials.NetherStar, 2), GT_Utility.getIntegratedCircuit(20)) - .fluidInputs(FluidUtils.getMobEssence(5000)) + .fluidInputs(FluidRegistry.getFluidStack("mobessence", 5000)) .fluidOutputs(FluidUtils.getFluidStack(GeneticMutagen, 8000)).duration(30 * SECONDS) .eut(TierEU.RECIPE_HV).addTo(UniversalChemical); } diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java b/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java deleted file mode 100644 index 889c64f2f8..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java +++ /dev/null @@ -1,108 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class DebugScanner extends CoreItem { - - public DebugScanner() { - super( - "gtpp.debug.scanner", - AddToCreativeTab.tabTools, - 1, - 0, - new String[] { "Used to obtain information from GT/GT++ content", "Right Click to use", }, - EnumRarity.epic); - setTextureName(GTPlusPlus.ID + ":itemStickyRubber"); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int p_77648_4_, int p_77648_5_, - int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - // TODO Auto-generated method stub - return super.onItemUse( - aStack, - aPlayer, - aWorld, - p_77648_4_, - p_77648_5_, - p_77648_6_, - p_77648_7_, - p_77648_8_, - p_77648_9_, - p_77648_10_); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - // TODO Auto-generated method stub - return super.onItemRightClick(p_77659_1_, p_77659_2_, p_77659_3_); - } - - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { - return 0f; - } - - @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { - if (entity != null && player != null) { - PlayerUtils.messagePlayer(player, "Entity ID: " + entity.getEntityId()); - PlayerUtils.messagePlayer(player, "UUID: " + entity.getUniqueID()); - PlayerUtils.messagePlayer(player, "Invulnerable? " + entity.isEntityInvulnerable()); - PlayerUtils.messagePlayer(player, "Invisible? " + entity.isInvisible()); - PlayerUtils.messagePlayer(player, "Age: " + entity.ticksExisted); - - if (entity instanceof EntityLivingBase g) { - PlayerUtils.messagePlayer(player, "Health: " + g.getHealth() + "/" + g.getMaxHealth()); - PlayerUtils.messagePlayer(player, "On ground? " + g.onGround); - PlayerUtils.messagePlayer(player, "Child? " + g.isChild()); - } - if (entity instanceof EntityLiving g) { - PlayerUtils.messagePlayer(player, "Can Loot? " + g.canPickUpLoot()); - } - if (entity instanceof EntityPlayer y) { - PlayerUtils.messagePlayer(player, "Experience: " + y.experience); - PlayerUtils.messagePlayer(player, "Name: " + y.getCommandSenderName()); - } - } - return true; - } - - @Override - public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { - return false; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return true; - } - - @Override - public int getHarvestLevel(ItemStack stack, String toolClass) { - return 0; - } -} diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java deleted file mode 100644 index ab154c2b24..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.enums.Mods.Minecraft; - -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class MultiSpadeBase extends StaballoySpade { - - /* - * (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - if (super.getDurabilityForDisplay(stack) > 0) { - return super.getDurabilityForDisplay(stack); - } - return 0; - } - - protected final int colour; - protected final String materialName; - protected final String displayName; - public boolean isValid = true; - - public MultiSpadeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, - final int colour) { - super(Utils.sanitizeString(unlocalizedName), material); - this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); - // this.setTextureName(GTPlusPlus.ID + ":" + "itemShovel"); - this.setTextureName(Minecraft.ID + ":" + "iron_shovel"); - this.setMaxStackSize(1); - this.setMaxDamage(materialDurability * 3); - this.colour = colour; - this.materialName = material.name(); - this.displayName = unlocalizedName; - this.setCreativeTab(AddToCreativeTab.tabTools); - try { - this.isValid = this.addRecipe(); - } catch (final Throwable e) {} - if ((colour != 0) && this.isValid) { - if (GameRegistry.findItem(GTPlusPlus.ID, Utils.sanitizeString(unlocalizedName)) == null) { - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); - } - } - } - - private boolean addRecipe() { - final String cleanName = Utils.sanitizeString(this.materialName); - final String plateDense = "plateDense" + cleanName; - final String plateDouble = "plateDouble" + cleanName; - final String rodLong = "stickLong" + cleanName; - final String toolHammer = "craftingToolHardHammer"; - final String toolWrench = "craftingToolWrench"; - final String toolFile = "craftingToolFile"; - final String toolScrewDriver = "craftingToolScrewdriver"; - - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)) { - return false; - } - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)) { - if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)) { - RecipeUtils.recipeBuilder( - toolFile, - plateDouble, - toolHammer, - null, - rodLong, - null, - toolWrench, - rodLong, - toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - return false; - } - - RecipeUtils.recipeBuilder( - toolFile, - plateDense, - toolHammer, - null, - rodLong, - null, - toolWrench, - rodLong, - toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - return this.displayName; - /* - * String name; if (getUnlocalizedName().toLowerCase().contains("wood")){ name = "Wooden"; } else { } return - * "Big "+name+" Spade"; - */ - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0) { - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack) { - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack, final int pass) { - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java deleted file mode 100644 index 7af2c3cf56..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java +++ /dev/null @@ -1,403 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemSpade; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.MiningUtils; - -public class StaballoySpade extends ItemSpade { - - /* - * (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - if (super.getDurabilityForDisplay(stack) > 0) { - return super.getDurabilityForDisplay(stack); - } - return 0; - } - - /** - * Creates an NBT tag for this item if it doesn't have one. This also set some default values. - * - * @param rStack - * @return - */ - private static boolean createNBT(ItemStack rStack) { - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - - tagNBT.setBoolean("FACING_HORIZONTAL", true); - tagNBT.setString("FACING", "north"); - tagNBT.setString("lookingDirection", ""); - - tagMain.setTag("PickStats", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - /* - * Is the player facing horizontally? - */ - - public static final boolean isFacingHorizontal(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getBoolean("FACING_HORIZONTAL"); - } - } else { - createNBT(aStack); - } - return true; - } - - public static final boolean setFacingHorizontal(final ItemStack aStack, final boolean aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setBoolean("FACING_HORIZONTAL", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * Handles the Direction the player is facing - */ - - public static final String getFacingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("FACING"); - } - } else { - createNBT(aStack); - } - return "north"; - } - - public static final boolean setFacingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("FACING", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * The Looking Direction handlers - */ - - public static final String getLookingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("lookingDirection"); - } - } else { - createNBT(aStack); - } - return ""; - } - - public static final boolean setLookingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("lookingDirection", aFacingHorizontal); - return true; - } - } - return false; - } - - private int miningLevel; - - /* - * Methods - */ - - @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) { - return super.onItemRightClick(stack, world, aPlayer); - } - - @Override - public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X, - final int Y, final int Z, final EntityLivingBase entity) { - if (!world.isRemote) { - if (entity instanceof EntityPlayer) { - this.GetDestroyOrientation((EntityPlayer) entity, getLookingDirection(stack), world, X, Y, Z, stack); - } - } - return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); - } - - public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz) { - String correctTool = ""; - if (!currentWorld.isRemote) { - try { - correctTool = currentBlock.getHarvestTool(0); - // Utils.LOG_WARNING(correctTool); - - Logger.WARNING( - "Tool for Block: " + correctTool + " | Current block: " + currentBlock.getLocalizedName()); - if (MiningUtils.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) - || correctTool.equals("shovel")) { - return true; - } - } catch (final NullPointerException e) { - return false; - } - } - return false; - } - - private void GetDestroyOrientation(EntityPlayer player, final String FACING, final World world, final int X, - final int Y, final int Z, final ItemStack heldItem) { - float DURABILITY_LOSS = 0; - if (!world.isRemote) { - - switch (FACING) { - case "below", "above" -> { - DURABILITY_LOSS = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS - + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); - } - } - } - case "facingEast", "facingWest" -> { - DURABILITY_LOSS = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS - + this.removeBlockAndDropAsItem(world, X, Y + i, Z + j, heldItem)); - } - } - } - case "facingNorth", "facingSouth" -> { - DURABILITY_LOSS = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j & |
