-
[1.6.4] Looking for block contact through armor
Hi, I've seen mods that have boots that turn water into ice on contact, and have been having trouble on finding out exactly how they did that. More specifically, I want to create skates... What is the code needed for detecting a block in armour?
-
Adding Parameters
It's still not working: public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helm = player.getCurrentArmor(3); // legs = 1, chest = 2, helm = 3 if (!world.isRemote){ if (boots != null && boots.getItem() == CanadianMod.skates && legs != null && legs.getItem() == CanadianMod.hockeyPants && chest != null && chest.getItem() == CanadianMod.hockeyChest && helm != null && helm.getItem() == CanadianMod.hockeyHelmet && world.getBlockId((int)player.posX, (int)player.posY-1, (int)player.posZ) == Block.ice.blockID){ player.motionX *= 1.1D; player.motionZ *= 1.1D; } } }
-
Adding Parameters
The problem isn't in the motion.x, that works fine without looking for a block. The problem itself is looking for a block
-
Adding Parameters
I've done that too
-
Adding Parameters
Here you go, keep in mind I'm in 1.6.4 public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { super.onArmorTickUpdate(world, player, itemStack); ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helm = player.getCurrentArmor(3); // legs = 1, chest = 2, helm = 3 if (boots != null && boots.getItem() == CanadianMod.skates && legs != null && legs.getItem() == CanadianMod.hockeyPants && chest != null && chest.getItem() == CanadianMod.hockeyChest && helm != null && helm.getItem() == CanadianMod.hockeyHelmet && world.getBlockId((int)player.posX, (int)player.posY, (int)player.posZ) == Block.ice.blockID){ player.motionX *= 1.1D; player.motionZ *= 1.1D; }} The player.motionX and Z will change to probably a speed potion effect when on ice, since currently that has some weird effects when on ice
-
Adding Parameters
Changed it, still doesn't work...
-
Adding Parameters
Woops, forgot to change that. Put I already had tried that before asking on the forums When I was asked for the code I just quickly put it back in
-
Adding Parameters
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { super.onArmorTickUpdate(world, player, itemStack); ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helm = player.getCurrentArmor(3); // legs = 1, chest = 2, helm = 3 if (boots != null && boots.getItem() == CanadianMod.skates && legs != null && legs.getItem() == CanadianMod.hockeyPants && chest != null && chest.getItem() == CanadianMod.hockeyChest && helm != null && helm.getItem() == CanadianMod.hockeyHelmet && world.getBlockId((int)player.posX, (int)player.posX, (int)player.posX) == Block.ice.blockID){ player.motionX *= 1.1D; player.motionZ *= 1.1D; } }
-
Adding Parameters
I tried that, it didn't do anything
-
Adding Parameters
Alright, the method I have is public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack), but I want it to also check for a block that the player is on, so I'm using world.getBlockID(par2, par3, par4), but how do I correctly add the par2, par3, par4 into the method?
-
[1.6.4] full set of armour being worn
It's saying .getEquimentInSlot does not exist
-
[1.6.4] full set of armour being worn
Within my armour class, how would I test for the player wearing a full set of armour? I have this: public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { int i = EntityLiving.getArmorPosition(itemStack) - 1; ItemStack itemstack1 = player.getCurrentArmor(i); if (itemstack1.itemID != CanadianMod.skates.itemID... But that seems to only be returning one time at a time. Suggestions would be great!
-
Armour that changes block properties
And how would I do that?
-
Armour that changes block properties
Where would I do all this? In the armour class? I tried this public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack, int par2, int par3, int par4) { if (itemStack.itemID == CanadianMod.skates.itemID && (world.getBlockId(par2, par3-1, par4) == Block.ice.blockID)){ Block.ice.slipperiness = 0.00F; } } But that was before i knew where to start, I kind of just guessed...
-
Armour that changes block properties
Hi! I've created an armour for my mod where the boots are skates. My plan is to have the skates allow you to walk on ice like it's a normal block, or even "skate" on it faster, but I have no idea where to start to tackle this. Any suggestions would be great! Thanks, ZacDoesStuff
IPS spam blocked by CleanTalk.