Jump to content

Recommended Posts

Posted

Hello :)

 

 

 

I made a mod with lots of armor. Some off the armor have a potion effects.

 

But yesterday I made a "CommonProxy" class and changed some things in the main mod class.

 

But now the armor has no potion effect any more.

 

When I created the common proxy class, eclipse said that the proxy.registerServerTickHandler is false.

 

I created a methode in the CommonProxy class, but then the effects were gone :(

 

pls help me ;)

Posted

in the server tick handler:

 

 

package SamTheBro1704.afterearthmod;

 

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 {

 

public void onPlayerTick(EntityPlayer player) {

 

 

if(player.getCurrentItemOrArmor(3) != null) {

    ItemStack Chestplate = player.getCurrentItemOrArmor(3);

   

    if(Chestplate.getItem() == AfterEarthMod.TitaniumChestplate){

    player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 20, 1)));

    player.addPotionEffect((new PotionEffect(Potion.damageBoost.getId(), 20, 1)));

   

    }

}

if(player.getCurrentItemOrArmor(1) != null) {

    ItemStack Boots = player.getCurrentItemOrArmor(1);

   

    if(Boots.getItem() == AfterEarthMod.TitaniumBoots){

    player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 20, 1)));

   

    }

}

if(player.getCurrentItemOrArmor(2) != null) {

    ItemStack Leggings = player.getCurrentItemOrArmor(2);

   

    if(Leggings.getItem() == AfterEarthMod.TitaniumLeggins){

    player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 20, 1)));

   

    }

}

 

if(player.getCurrentItemOrArmor(4) != null) {

    ItemStack Helmet = player.getCurrentItemOrArmor(4);

   

    if(Helmet.getItem() == AfterEarthMod.TitaniumHelmet){

    player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 20, 1)));

   

   

   

   

   

   

 

    }

}

if(player.getCurrentItemOrArmor(1) != null) {

    ItemStack Boots = player.getCurrentItemOrArmor(1);

   

    if(Boots.getItem() == AfterEarthMod.EnergyBoots){

    player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 20, 1)));

   

    }

}

if(player.getCurrentItemOrArmor(3) != null) {

    ItemStack Chestplate = player.getCurrentItemOrArmor(3);

   

    if(Chestplate.getItem() == AfterEarthMod.EnergyChestplate){

    player.addPotionEffect((new PotionEffect(Potion.heal.getId(), 20, 0)));

    player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 20, 1)));

    }

}

 

if(player.getCurrentItemOrArmor(2) != null) {

    ItemStack Leggings = player.getCurrentItemOrArmor(2);

   

    if(Leggings.getItem() == AfterEarthMod.EnergyLeggins){

    player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 20, 1)));

   

   

    }

   

}

 

if(player.getCurrentItemOrArmor(4) != null) {

    ItemStack Helmet = player.getCurrentItemOrArmor(4);

   

    if(Helmet.getItem() == AfterEarthMod.EnergyHelmet){

    player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 20, 1)));

   

        }

       

   

 

   

}

}

 

 

 

@Override

public void tickStart(EnumSet<TickType> type, Object... tickData) {

if(type.equals(EnumSet.of(TickType.PLAYER)))

{

onPlayerTick((EntityPlayer) tickData[0]);

 

}

// 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 EnumSet.of(TickType.PLAYER, TickType.SERVER);

}

 

@Override

public String getLabel() {

// TODO Auto-generated method stub

return null;

}

 

}

 

I made a common proxy then eclipse says, that i must create a methode in the ClientProxy class.

Since then it did not work.

 

 

 

In the main mod class:

 

 

@EventHandler

    public void load(FMLInitializationEvent event) {

    proxy.registerRenderThings();

    proxy.registerServerTickHandler();

    }

 

and:

 

public static ClientProxy proxy;

 

 

in the ClientProxy class is also a methode:

 

 

public void registerServerTickHandler() {

// TODO Auto-generated method stub

 

}

 

 

 

 

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.