no not how to add a mob how to add A POTION EFFECT TO a mob when it is wet and this tutorial is about adding potion effects to stuff(well armor to be exact but you also told how to do items and swords so why not mobs)
no not how to add a mob how to add A POTION EFFECT TO a mob when it is wet and this tutorial is about adding potion effects to stuff(well armor to be exact but you also told how to do items and swords so why not mobs)
The title of this post is "Making custom armor that adds potion effects and more". Not, how to add potion effects to some mob. I did do swords and what not in the past but only because it was one or two lines of code. Find a method that ticks constantly with your entity, check to see if it is wet, then add the potion effect.
When wearing armor, how do I create a second row of hearts(or more)?
I actually can't say I know the answer to that. I know Tinkers Construct adds something like that and is open source so you may want to check that out.
Its not really hard, its just really annoying. This is not the topic to discuss it though, so I suggest you use google for a tutorial.
if (this.isWet())
{
this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 10, 1));
}
else
{
this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 0, 0));
}
This is not the topic for these questions
I know very well how to add mobs. This tutorial just has nothing to do with mobs.
The title of this post is "Making custom armor that adds potion effects and more". Not, how to add potion effects to some mob. I did do swords and what not in the past but only because it was one or two lines of code. Find a method that ticks constantly with your entity, check to see if it is wet, then add the potion effect.
Outside the scope of this tutorial, sorry
I used:
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
super.onUpdate(stack, world, entity, par4, par5);
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.getHeldItem();
if(equipped == stack) {
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 5, 5));
}
}
How do I make it so it checks if its i my inventory, not just my hand.
Use player.inventory. Although I'm not sure of the index where hop bar items appear.
It says it can't convert:
public class jasperH extends Item{
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer){
for(int counter = 1; counter <= 1; counter++){
if(entityplayer.inventory.getCurrentItem().stackSize == 1){
entityplayer.inventory.addItemStackToInventory(new ItemStack( MItems.amethystW, 1));
}
}
return itemstack;
}
public boolean hasEffect(ItemStack itemstack)
{
return true;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
super.onUpdate(stack, world, entity, par4, par5);
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.inventory;
if(equipped == stack) {
player.addPotionEffect(new PotionEffect(Potion.resistance.id , 6, 5));
}
}
}
You will need to search through the inventory to to find the items you want...
How?
Use for() loops to iterate through the inventory. If you don't know how to use them, I recommend you lookup a tutorial.
It isn't working:
public void onUpdate(ItemStack stack, World world, EntityPlayer entityplayer, int par4, boolean par5) {
super.onUpdate(stack, world, entityplayer, par4, par5);
for(int counter1 = 1; counter1 <= 1; counter1++){
if(entityplayer.inventory.getCurrentItem().stackSize == 1){
entityplayer.addPotionEffect(new PotionEffect(Potion.resistance.id , 6, 5));
}
}
}
}
When wearing armor, how do I create a second row of hearts(or more)?
I actually can't say I know the answer to that. I know Tinkers Construct adds something like that and is open source so you may want to check that out.
I found a potion effect called field_76434_w (Health boost). Maybe this will help???