
DanielDawn
Forge Modder-
Posts
62 -
Joined
-
Last visited
Everything posted by DanielDawn
-
How can I add the destroyed effects of a block in this method? public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) {}
-
[UNSOLVED][1.7.10] Better Version of Is Tool Effective?
DanielDawn replied to DanielDawn's topic in Modder Support
Pretty much, except instead of ItemPickaxe I want Block, and CanHarvestBlock makes it so that I can basically harvest anything... So let me try to explain this much more clearly... I would like to know a way I can check if the block is broken faster by a diamond pickaxe (Level 3 Pickaxe). I was currently using getBlock().isToolEffective("pickaxe", 3) (From memory), but it doesn't work for stairs, obsidian, end_stone, etc. -
[UNSOLVED][1.7.10] Better Version of Is Tool Effective?
DanielDawn replied to DanielDawn's topic in Modder Support
Lmao, I thought that thru already. Meh, I like it like that... Lmao what if there's a block that is only affected by pickaxes if the damage is 1 or something... heh... That also reminds me to add a damage checker. -
So I've been using this sort of code for my 3 by 3 by 3 pickaxe if(world.getBlock(x, y, z) == world.getBlock(x+1, y, z) && world.getBlock(x+1, y, z).isToolEffective("pickaxe", 3)) .isToolEffective("pickaxe", 3) isn't really working well for me, since I'd like it to mine Obsidian, Fences, Stairs, and everything that is mined faster with a diamond pickaxe. For redstone ore, I've currently been using an awkward boolean system, but it's under control. I don't want to code a awkward fix for all of these other blocks either.
-
How can I add a recipe that accepts any item?
-
[1.7.10][Solved] How to get an ItemStack with NBT?
DanielDawn replied to DanielDawn's topic in Modder Support
Oh lmao, thanks for the quick reply, solved! -
I've been able to get the Entity's Armor, but it's never damaged and never has an enchantment. So how would I get all the information and put it in this? if(entity.getEquipmentInSlot(4) != null && !player.getEntityWorld().isRemote){ player.getEntityWorld().spawnEntityInWorld(new EntityItem(player.getEntityWorld(), player.posX, player.posY, player.posZ, [color=red]new ItemStack(entity.getEquipmentInSlot(4).getItem()[/color]))); entity.setCurrentItemOrArmor(4, null); }
-
How would I go about restoring the players hp equal to the damage the player dealt to an entity? I could simply restore a fixed amount, but I wish to restore an amount that depends on the damage dealt. Has anyone done something likes this before?
-
Um, my main concern is that splash potion breaking effect, I want to change that into my texture, I already have my own render for when it's thrown btw. But, will try this stuff that you people mentioned.
-
That's what I thought at first too, but when I remove that line of code, no splash appears.
-
bump
-
I really wish I would have found that! The first time I googled how I could do this, it said I needed an eventhandler.
-
THANK YOU! I remembered not being able to use that method on Item. Thanks CoolAlias. Final Code: Beware, it isn't organized. package danieldawn.smallenhancements; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.EntityInteractEvent; public class SeEventHandler { public static final int INTERVAL = 60; @SubscribeEvent(priority = EventPriority.NORMAL) public void onLivingUpdate(EntityInteractEvent e) { if(e.entityPlayer.getCurrentEquippedItem() != null){ EntityPlayer player = (EntityPlayer) e.entityLiving; EntityLivingBase entity = (EntityLivingBase) e.target; ItemStack itemstack = e.entityPlayer.getCurrentEquippedItem(); World world = e.entityPlayer.getEntityWorld(); if(player.getCurrentEquippedItem().getItem() == SmallEnhancements.Heal_Staff){ if (!itemstack.hasTagCompound()) { itemstack.setTagCompound(new NBTTagCompound()); } if (world.getTotalWorldTime() > itemstack.getTagCompound().getInteger("nextUse")) { player.getCurrentEquippedItem().damageItem(1, player); itemstack.getTagCompound().setInteger("nextUse", (int) (world.getTotalWorldTime() + INTERVAL)); entity.heal(entity.getMaxHealth() / 4 + 2); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); world.playSoundEffect(player.posX, player.posY, player.posZ, "random.orb", 4, 1); }} } } } My Staff class is called Heal_Staff it extends Item, everything in it is pretty unimportant, the big stuff is done in my event handler. Explanation: When an Entity is right clicked, checks if player has something in there hand, if it is a heal staff, it will then check if it doesn't have an nbt tag yet, and give it one if it doesn't have one already. Then, it checks to make sure that the cooldown isn't active, if the cooldown isn't active it damages the heal staff by 1 durability point, heals the entity 1/4 of its hp +2 extra hp, activates a 60 tick cooldown, spawns particles, and makes that ding sound.
-
So I need to get my ThrowableEntity to splash like a swiftness potion on the ground. I've used this this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 16450); It only gets the color, because I set up the color. But, I'd like it to show the texture of the item I throw, instead of the default Empty Splash Potion texture and possibly have a different sound such as glass breaking instead of potion breaking.
-
I've never extended ItemTool and the constructor seems complex... Can I get some help? I don't want my staff do deal any melee damage, or actually be efficient in breaking blocks, nor enchantable. Basically want it to be an item, that can use this method onBlockDestroyed.
-
Ah, I didn't scroll down on your post, wow. But, thanks this was very helpful. Your timer is great too. The nbt check is brilliant. Thank you! I will be uploading my final code when my staff is done.
-
I tested out what you had to say about it removing Enchantments, with my new code, it still removes enchantments though. Because everytime I right click it creates a new... Wait, I'll try something with another NBT... I'll look into ItemTool later. Thanks again! Ah, so what I thought I could do was put an if with a new int called Has it been used? Which would be 0 if it hasn't and I'd put the newnbt.... Yeah, lmao... But, I don't know what you said about it only resetting the nbt on first use, because there is nothing in my code that does that.
-
Thank you for your wonderful reply! That would've helped me a ton earlier, but it still does. As for not having my code all organized, that's because I'm not an organized person . And I haven't implemented a timer yet, I'd planning on doing that once I've got everything else under control. If you look now at my recent edit, it's been fixed, and no longer crashes. I think all I need to know now is how to damage it, when a block is destroyed with it and how to give it that itemstack.stackTagCompound = new NBTTagCompound(); when a command is used to summon it. Because I can just use get sub types and on created for the rest. Thank you for a reply, it was still helpful since I didn't know I forgot the {} on the if statement.
-
So tried the !WorldObject if statement, but nothing was happening, except for the printin print out. So I decided to just try using the nbt, but I've never used NBT before and am a little confused... SeEventHandler package danieldawn.smallenhancements; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.EntityInteractEvent; public class SeEventHandler { @SubscribeEvent(priority = EventPriority.NORMAL) public void onLivingUpdate(EntityInteractEvent e) { //if (e.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e.entityLiving; EntityLivingBase entity = (EntityLivingBase) e.target; ItemStack itemstack = e.entityPlayer.getCurrentEquippedItem(); //if(healcooldown == 0){ if(player.getCurrentEquippedItem().getItem() == SmallEnhancements.Heal_Staff){ itemstack.stackTagCompound = new NBTTagCompound(); if (itemstack.stackTagCompound.getInteger("word") == 0) System.out.println(itemstack.stackTagCompound.getInteger("word")); player.getCurrentEquippedItem().damageItem(2, player); itemstack.stackTagCompound.setInteger("word", 60); entity.heal(entity.getMaxHealth() / 4); System.out.println(entity.getHealth()); System.out.println(entity.getMaxHealth()); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); } } } } } The staff is not properly setting the int... It shows up as zero every time. Edit: Because it keeps creating a new tag... So how can I make it so that, if it were to be created by a command like /give it would still get that itemstack.stackTagCompound = new NBTTagCompound();
-
My staff is not healing the Entity, the System Print says that it is healing the entity but if I hit it after healing it to full health after it having 1 hp it dies, so that means it is not being healed. I took away my variable code and such, and it was working properly. Can I get some help with this? SeEventHandler package danieldawn.smallenhancements; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.EntityInteractEvent; public class SeEventHandler { private int healcooldown = 0; @SubscribeEvent(priority = EventPriority.NORMAL) public void Cooldowns(PlayerTickEvent e) { if(healcooldown > 0) healcooldown = healcooldown - 1; } @SubscribeEvent(priority = EventPriority.NORMAL) public void onLivingUpdate(EntityInteractEvent e) { if (e.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e.entityLiving; EntityLivingBase entity = (EntityLivingBase) e.target; if(healcooldown == 0){ if(player.getCurrentEquippedItem().getItem() == SmallEnhancements.Heal_Staff){ healcooldown = 200; player.getCurrentEquippedItem().damageItem(2, player); entity.heal(entity.getMaxHealth() / 4); System.out.println(entity.getHealth()); System.out.println(entity.getMaxHealth()); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ + 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX + 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.2D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.4D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); entity.worldObj.spawnParticle("happyVillager", entity.posX - 0.6D, entity.posY + 0.6D, entity.posZ - 0.6D, 1.0D, 1.0D, 1.0D); } } } }} Heal_Staff package danieldawn.smallenhancements.item; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class Heal_Staff extends Item { public Heal_Staff(){ this.setFull3D(); this.setMaxDamage(19); } public boolean hitEntity(ItemStack itemstack, EntityLivingBase target, EntityLivingBase player){ itemstack.damageItem(1, player); return true; } }
-
[1.7.10] Setting Target If hit by lightning bolt?
DanielDawn replied to DanielDawn's topic in Modder Support
Like if I have an explosion staff that when you click on an Entity it creates an explosion on the entity. Also how do I set the flag? Are there any minecraft classes that set the flag that I can use as an example? -
[1.7.10] Setting Target If hit by lightning bolt?
DanielDawn replied to DanielDawn's topic in Modder Support
.setRevengeTarget()? Also does this work with explosions? -
So in an onItemUse method my sword spawns a lightning bolt, how can I make it so that if an Entity is hit by the lightning bolt it's target is set to the player, or like it was melee damage.
-
Thank you, I've read that in a previous post of yours actually involving your pegasus boots. However I would not like to have it give speed while running, or give speed when not sprinting... So I guess I'll just give up on this idea for now. Thanks for your reply though.
-
So I'd like to make an item called running boots, where when you start sprinting it gives you a speed boost(Not the speed effect), and then through an event handler it removes the added speed, or sets it back to normal. I'm really confused... player.capabilities.setPlayerWalkSpeed(1); is what I'm currently trying to use. EventHandler Class (It says Iron Boots because I haven't made the class yet.) package danieldawn.smallenhancements; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; public class SeEventHandler { @SubscribeEvent(priority = EventPriority.NORMAL) public void onLivingUpdate(LivingUpdateEvent e) { if (e.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e.entityLiving; if (player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == Items.iron_boots){ if(player.isSprinting() == true){ player.capabilities.setPlayerWalkSpeed(2); } } if (player.getEquipmentInSlot(0) == null){ player.capabilities.setPlayerWalkSpeed(1); } } } } I'm hoping to do everything in the event handler as well? I'd also like to make more boots that do the exact same thing. With the code above, no matter what, the player moves rapidly. (Yes this is my first Event Handler)