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

Back in 1.6.4 i had this code:

package dudesmods.lozmod2.proxy;

import java.util.EnumSet;

import javax.activation.CommandMap;

import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.CommandServerOp;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.ServerCommand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.world.WorldSettings;
import net.minecraftforge.event.CommandEvent;

import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import dudesmods.lozmod2.LOZmod;
import dudesmods.lozmod2.LOZmodTCAPI;

public class CommonTickHandler implements ITickHandler {

public void onPlayerTick(EntityPlayer player) {
	if(player.getCurrentItemOrArmor(0) != null && player.getHealth() < 19) {
		ItemStack hand = player.getCurrentItemOrArmor(0);

		if(hand.getItem() == LOZmod.healingStone && hand.getItemDamage() > 0 && hand.getItemDamage() < 500){
			hand.damageItem(1, player);
			player.heal(2.0F);
		}
	}
}

@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
	if(type.equals(EnumSet.of(TickType.PLAYER))){
		onPlayerTick((EntityPlayer) tickData[0]);
	}
}

@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {

}

@Override
public EnumSet<TickType> ticks() {
	return EnumSet.of(TickType.PLAYER, TickType.SERVER);

}

@Override
public String getLabel() {
	return null;
}

}

 

What would the replacement for this be in 1.7.2???

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Get rid of the @ForgeSubscibe and replace it with @SubscribeEvent, and register it with this in your preinit:

FMLCommonHandler.instance().bus().register(new CommonTickHandler());

instead of the old way.

 

 

Also change onPlayerTick(tickevent event) into onPlayerTick(TickEvent.PlayerTickEvent event){ }

 

Hope this helps!!

Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more!

width=174 height=100http://i.imgur.com/ghgWmA3.jpg[/img]

Better yet, remove your tick event / handler altogether and use the Item onArmorTick method, which is called every tick for custom armor while worn.

 

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (this == LOZmod.healingStone && stack.getItemDamage() > 0 etc.) {
// heal
}
}

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.