Jump to content

Recommended Posts

Posted

I need a help on my my potion effect the crash points out to this line

 

setPotionEffect(MHFCRegPotion.mhfcpotionpitfall.id, 15, 4, 100);

 

Heres my console and my codes

 

 

  Reveal hidden contents
Posted

I got it working now i tweak some of how to expand its array

but how can i make an entity to be motionY under like stuck on ground underneath. Any help please?

 

HERES MY POTIONEVENTHANDLER ANYWAYS

package mhfc.net.common.eventhandler.potion;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import mhfc.net.common.core.registry.MHFCRegPotion;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;

public class PotionPitfallEventHandler {

@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event){

	if(event.entityLiving.isPotionActive(MHFCRegPotion.mhfcpotionpitfall)){
		event.entityLiving.noClip = true;
		event.entityLiving.motionY = -1D;
	}

	if(event.entityLiving.getActivePotionEffect(MHFCRegPotion.mhfcpotionpitfall).getDuration() == 0){
		event.entityLiving.removePotionEffect(MHFCRegPotion.mhfcpotionpitfall.id);
		return;
	}

}

}

Posted

You want to make the entity rise above or below the the ground? If so, why not change the y coordinate of the entity?? Not motionY

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Posted

I tried to check but still nothing happens on the event when i rightclick my item nothing happens

 

@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event){

	if(event.entityLiving.isPotionActive(MHFCRegPotion.mhfcpotionpitfall)){

		int y = MathHelper.floor_double(event.entityLiving.posY);

		if(!event.entityLiving.worldObj.isRemote)
			event.entityLiving.chunkCoordY = y - 4;
	}

	if(event.entityLiving.getActivePotionEffect(MHFCRegPotion.mhfcpotionpitfall).getDuration() == 0){
		event.entityLiving.removePotionEffect(MHFCRegPotion.mhfcpotionpitfall.id);
		return;
	}

}

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.