Jump to content

Recommended Posts

Posted

am trying to get my armor and tools to have potion effect when they are equiped but it does not work. i dont not have any errors.

 

Main Class:
@Init
    public void load(FMLInitializationEvent event){
	proxy.registerRenderThings();
	proxy.registerServerTickHandler();
TickHandler:
ackage ArcaneLoot;

import java.util.EnumSet;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;

public class ServerTickHandler implements ITickHandler {

private void onPlayerTick(EntityPlayer player) {

	if (player.getCurrentItemOrArmor(4) != null ) {
		ItemStack helmet = player.getCurrentItemOrArmor(4);

		if (helmet.getItem() == Base.RemmantHelm ) {
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.resistance.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 100, 0)));
		}			
	}

	if (player.getCurrentItemOrArmor(3) != null ) {
		ItemStack chest = player.getCurrentItemOrArmor(3);

		if (chest.getItem() == Base.RemmantChest ) {
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.resistance.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 100, 0)));
		}		
	}

	if (player.getCurrentItemOrArmor(2) != null ) {
		ItemStack legs = player.getCurrentItemOrArmor(2);

		if (legs.getItem() == Base.RemmantLegs ) {
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.resistance.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 100, 0)));
		}	
	}

	if (player.getCurrentItemOrArmor(1) != null ) {
		ItemStack boots = player.getCurrentItemOrArmor(1);

		if (boots.getItem() == Base.RemmantBoots ) {
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.resistance.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 100, 0)));
		}	
	}



	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantAxe){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantPick){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantShovel){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantHoe){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantSword){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

	if(player.getCurrentItemOrArmor(0) != null){
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == Base.RemmantManifold){
			player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 100, 0)));
			player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 100, 0)));
		}
	}

}

@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
	// TODO Auto-generated method stub

}

@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
	// TODO Auto-generated method stub

}

@Override
public EnumSet<TickType> ticks() {
	// TODO Auto-generated method stub
	return null;
}

@Override
public String getLabel() {
	// TODO Auto-generated method stub
	return null;
}



}



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.