From db3dece804bf33f8d66c52fd18e47b8e49cab9de Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 18 Apr 2019 16:41:50 +1000 Subject: % Improved Mode handling on some tools, Electric lighter now has a projectile mode. $ Fixed Bombs not having a renderer. $ Fixed Mode changing on custom GT Tools. Fixes #80 --- .../core/entity/InternalEntityRegistry.java | 3 + .../entity/projectile/EntityLightningAttack.java | 76 ++++++++++++ src/Java/gtPlusPlus/core/proxy/ClientProxy.java | 5 + .../items/behaviours/Behaviour_Choocher.java | 48 +++++--- .../behaviours/Behaviour_Electric_Lighter.java | 132 +++++++++++++++++---- .../tools/TOOL_Gregtech_ElectricButcherKnife.java | 65 +++++----- .../tools/TOOL_Gregtech_ElectricLighter.java | 40 +------ 7 files changed, 258 insertions(+), 111 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java (limited to 'src/Java/gtPlusPlus') diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java index e5c779adcf..aec82119cc 100644 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; +import gtPlusPlus.core.entity.projectile.EntityLightningAttack; import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; @@ -54,6 +55,8 @@ public class InternalEntityRegistry { EntityRegistry.registerModEntity(EntityThrowableBomb.class, "EntityThrowableBomb", mEntityID++, GTplusplus.instance, 64, 10, true); + EntityRegistry.registerModEntity(EntityLightningAttack.class, "EntityLightningAttack", mEntityID++, GTplusplus.instance, 64, 20, true); + /** * Globals, which generate spawn eggs. (Currently required for Giant chicken spawning) */ diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java new file mode 100644 index 0000000000..868517d1db --- /dev/null +++ b/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java @@ -0,0 +1,76 @@ +package gtPlusPlus.core.entity.projectile; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityLightningAttack extends EntityWitherSkull { + + public EntityLightningAttack(World p_i1793_1_) + { + super(p_i1793_1_); + this.setSize(0.3125F, 0.3125F); + } + + public EntityLightningAttack(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_, double p_i1794_7_) + { + super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_); + this.setSize(0.3125F, 0.3125F); + } + + @SideOnly(Side.CLIENT) + public EntityLightningAttack(World p_i1795_1_, double p_i1795_2_, double p_i1795_4_, double p_i1795_6_, double p_i1795_8_, double p_i1795_10_, double p_i1795_12_) + { + super(p_i1795_1_, p_i1795_2_, p_i1795_4_, p_i1795_6_, p_i1795_8_, p_i1795_10_, p_i1795_12_); + this.setSize(0.3125F, 0.3125F); + } + + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70227_1_) { + + if (!this.worldObj.isRemote) { + if (p_70227_1_.entityHit != null) { + if (this.shootingEntity != null) { + if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) + && !p_70227_1_.entityHit.isEntityAlive()) { + this.shootingEntity.heal(0.5F); + } + } else { + p_70227_1_.entityHit.attackEntityFrom(DamageSource.lava, 10.0F); + } + + if (p_70227_1_.entityHit instanceof EntityLivingBase) { + byte b0 = 0; + + if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) { + b0 = 10; + } else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) { + b0 = 40; + } + + if (b0 > 0) { + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 20 * b0, 1)); + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.confusion.id, 20 * b0, 1)); + ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.weakness.id, 20 * b0, 1)); + } + } + } + + this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, + this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + this.setDead(); + } + } + + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index c7374ca7d5..71befe0a37 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -47,7 +47,9 @@ import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; +import gtPlusPlus.core.entity.projectile.EntityLightningAttack; import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; +import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; import gtPlusPlus.core.handler.render.FirepitRender; import gtPlusPlus.core.item.ModItems; @@ -61,6 +63,7 @@ import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBat; import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.entity.RenderFireball; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; @@ -138,6 +141,8 @@ public class ClientProxy extends CommonProxy implements Runnable{ RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderPlasmaBolt()); RenderingRegistry.registerEntityRenderingHandler(EntityGiantChickenBase.class, new RenderGiantChicken(new ModelGiantChicken(), 1f)); RenderingRegistry.registerEntityRenderingHandler(EntityBatKing.class, new RenderBatKing()); + RenderingRegistry.registerEntityRenderingHandler(EntityThrowableBomb.class, new RenderSnowball(ModItems.itemBomb, 1)); + RenderingRegistry.registerEntityRenderingHandler(EntityLightningAttack.class, new RenderFireball(1F)); /** * Tiles diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index c74a31055d..f82e0e5cb0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -10,6 +10,9 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.items.behaviors.Behaviour_Wrench; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; public class Behaviour_Choocher extends Behaviour_None { @@ -30,30 +33,47 @@ extends Behaviour_None { if (aWorld.isRemote) { return false; } + + boolean inWrenchMode; + if (NBTUtils.hasKey(aStack, "aMode")) { + inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); + } + else { + aStack.getTagCompound().setBoolean("aMode", true); + inWrenchMode = true; + } + if (aPlayer.isSneaking()){ - if (this.isWrench){ - this.isWrench = false; - return false; - } - this.isWrench = true; - return false; + boolean aModeNew = Utils.invertBoolean(inWrenchMode); + aStack.getTagCompound().setBoolean("aMode", aModeNew); + PlayerUtils.messagePlayer(aPlayer, "Mode: "+(aModeNew ? "Wrench" : "Hammer")); + return true; } - else if (!aPlayer.isSneaking()){ - if (this.isWrench){ - this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); - return false; + else { + if (inWrenchMode){ + return this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); + } + else { + return this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); } - this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); - return false; } - return false; } @Override public List getAdditionalToolTips(final GT_MetaBase_Item aItem, final List aList, final ItemStack aStack) { + boolean inWrenchMode; + if (NBTUtils.hasKey(aStack, "aMode")) { + inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); + } + else { + NBTUtils.setBoolean(aStack, "aMode", true); + aStack.getTagCompound().setBoolean("aMode", true); + inWrenchMode = true; + } + - if (this.isWrench){ + if (inWrenchMode){ aList.add(this.mTooltip1+"Wrench"); aList.add(this.mTooltipW); } 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 index 278b556733..64676fa907 100644 --- 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 @@ -7,9 +7,15 @@ 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.core.entity.projectile.EntityLightningAttack; +import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import ic2.api.item.IElectricItemManager; @@ -19,15 +25,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; 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", @@ -35,9 +38,8 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { 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 Behaviour_Electric_Lighter() { + } public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { @@ -60,30 +62,97 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { 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) { + if (!aWorld.isRemote && aStack.stackSize == 1) { + if (aPlayer.isSneaking()) { + Logger.INFO("Changing Mode"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); + boolean aNewMode = Utils.invertBoolean(aCurrentMode); + Logger.INFO("Is now set to Fireball mode? "+aNewMode); + aStack.getTagCompound().setBoolean("aFireballMod", aNewMode); + //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); + PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter")); + } + else { + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + if (aCurrentMode) { + //Shoot Lightning Attack + aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); + if (!aWorld.isRemote) { + aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); + } + } + else { + //Lights Fires Mode + 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; } 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; - } + if (!aWorld.isRemote && aStack.stackSize == 1) { + if (aPlayer.isSneaking()) { + Logger.INFO("Changing Mode"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); + boolean aNewMode = Utils.invertBoolean(aCurrentMode); + Logger.INFO("Is now set to Fireball mode? "+aNewMode); + aStack.getTagCompound().setBoolean("aFireballMod", aNewMode); + //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); + PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter")); } + else { + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + if (aCurrentMode) { + //Shoot Lightning Attack + aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); + if (!aWorld.isRemote) { + aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); + } + } + else { + //Lights Fires Mode + 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; @@ -138,6 +207,17 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { NBTTagCompound tNBT = aStack.getTagCompound(); aList.add(this.mTooltipUses + " " + aUses); aList.add(this.mTooltipUnstackable); + + + boolean aCurrentMode; + if (NBTUtils.hasKey(aStack, "aFireballMode")) { + aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + } + else { + aStack.getTagCompound().setBoolean("aFireballMod", false); + aCurrentMode = false; + } + aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter")); return aList; } } \ No newline at end of file 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 index ff4be9dd93..7aa7529817 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java @@ -13,6 +13,7 @@ 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.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityIronGolem; @@ -39,7 +40,7 @@ extends GT_Tool { @Override public int getToolDamagePerBlockBreak() { - return 50; + return 100; } @Override @@ -49,12 +50,12 @@ extends GT_Tool { @Override public int getToolDamagePerContainerCraft() { - return 400; + return 100; } @Override public int getToolDamagePerEntityAttack() { - return 100; + return 200; } @Override @@ -111,41 +112,10 @@ extends GT_Tool { 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; + return (tTool != null) && (tTool.equals("sword") || tTool.equals("knife")); } @Override @@ -193,5 +163,30 @@ extends GT_Tool { public boolean isGrafter() { return false; } + + @Override + public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) { + return aOriginalHurtResistance * 2; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMiningTool() { + return false; + } + + @Override + public Enchantment[] getEnchantments(ItemStack aStack) { + return LOOTING_ENCHANTMENT; + } + + @Override + public int[] getEnchantmentLevels(ItemStack aStack) { + return new int[]{(4 + GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolQuality) / 2}; + } } 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 index cf6f33cc36..36e1161e83 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java @@ -9,7 +9,6 @@ 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; @@ -23,7 +22,6 @@ 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 { @@ -119,36 +117,9 @@ extends GT_Tool { @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")); + return false; } - - @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; @@ -164,10 +135,7 @@ extends GT_Tool { return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : Materials.Silver.mRGBa; - } - - - + } @Override public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { @@ -182,12 +150,12 @@ extends GT_Tool { @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); + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been prodded 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)); + aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter()); } @Override -- cgit