Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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 ;)

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.