forum Forumsplay_arrow Minecraft fiber_manual_record Mods

1

Adding a potion effect when you step on a block

1 emerald12 replies451 views
created 09/17/2015 6:56 am by Fire_Mutt
last reply 09/25/2015 7:49 am
I am trying to add a potion effect when you step on a block (Example: Get fire resistance when you step on a custom block). I am using forge 1.8. Anyone know how I can do this for all potion effects?
Posted by avatar
Fire_Mutt
Level 1 : New Miner
2

comment Login or register to post a reply.

12 replies

09/25/2015 7:49 am
Level 16 : Journeyman Engineer
Creeper_4869
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par5Entity instanceof EntityLiving) {
((EntityLiving) par5Entity).addPotionEffect(new PotionEffect(Potion.heal.getId(), 50, 1));
}
}


To break it down...
if (par5Entity instanceof EntityLiving) {
This simply checks if the entity walking on it is alive, not dead.

((EntityLiving) par5Entity).addPotionEffect(new PotionEffect(Potion.heal.getId(), 50, 1));
That just adds the effect to the entity, simple!

The second integer is the duration of the potion in ticks, and the third is the amplifier.

Just replace 'heal' with one of these:
Click to reveal


Seriously... 8 days? Nobody?
Has anyone else ever even tried to mod minecraft before?
09/21/2015 7:11 pm
Level 4 : Apprentice Princess
AuzziPuppy
Probably some sort of "if" statement.
09/25/2015 7:00 am
Level 38 : Artisan Nerd
that2guy
*claps sarcastingly*
09/21/2015 7:03 pm
Level 1 : New Miner
Fire_Mutt
I am using eclipse for this if that helps at all: Please help! I know there is a way to mod a block to give you a potion effect when you or a mob steps on it, but what is it?
09/19/2015 5:40 pm
Level 1 : New Miner
Fire_Mutt
This doesn't work for modding, anyone know how I can do this, or if not, where I should ask besides here?
09/21/2015 7:14 pm
Level 2 : Apprentice Network
ButterChuckles
Well I feel bad for you since all these people are just guessing and not understanding you but you should go to the forge forums.
09/18/2015 7:29 pm
Level 1 : New Miner
Fire_Mutt
I'm talking about java coding
09/17/2015 11:00 am
Level 1 : New Miner
bwfcwalshy
Vanilla, plugin, mod?
09/17/2015 10:25 am
Level 16 : Journeyman Network
YTCereal
or you set the block to the id what are you using in the mod. dadaaa.a.
09/17/2015 9:02 am
Level 37 : Artisan Engineer
Bertiecrafter
to finish the command:
/execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:<block> 0 /effect @p minecraft:<effect> <time> <Level> <hide particles, true/false>
09/17/2015 7:34 am
Level 16 : Journeyman Network
YTCereal
yeah. you can do that.

/execute @a ~ ~ ~ detect something..
09/17/2015 9:00 am
Level 29 : Expert Toast
DaSquyd
That would be how you'd do it in vanilla, but it looks like they're asking about mod-making.

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome