Posted August 11, 201312 yr Hi guys, I wanted to make a special armour that it charge and then ask you to press F for release the Fury Mode. I created it in my ItemClass, it worked good but the problem is, the server is not registering this. So I asked to my friend that can make mod and said to me: "You need to register a new TickHandler for this thing" but the problem is, I can't figure out I tried doing this: TickHandler class: package mods.exoworld.handler; import java.util.EnumSet; import mods.exoworld.Main; import mods.exoworld.item.ExoTNTHelmet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class ExoServerTickHandler implements ITickHandler { public ExoTNTHelmet event; public World world; public EntityPlayer player; @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { // TODO Auto-generated method stub } public void onTickArmor(EntityPlayer player, World world, ItemStack itemStack, ExoTNTHelmet event) { ItemStack helmet = player.inventory.armorItemInSlot(3); ItemStack chestplate = player.inventory.armorItemInSlot(2); ItemStack leggings = player.inventory.armorItemInSlot(1); ItemStack boots = player.inventory.armorItemInSlot(0); if (helmet.itemID == Main.ExoTNTHelmet.itemID && chestplate.itemID == Main.ExoTNTChestplate.itemID && leggings.itemID == Main.ExoTNTLeggings.itemID && boots.itemID == Main.ExoTNTBoots.itemID) { event.counter += 0.021F; System.out.println(event.counter); if(event.counter > 50F) { event.powerupIsAvailable = true; } if (event.powerupIsAvailable == true) { event.counter -= 5F; if (event.counter < 0F) { event.counter = 0F; } } } } public void onPowerupActivated() { while (event.counter < 0F) { // I want that every 5 ticks the function do this code below if (event.powerupIsAvailable == true) world.createExplosion(null, player.posX + 5, player.posY, player.posZ, 5.0F, false); world.createExplosion(null, player.posX - 5, player.posY, player.posZ, 5.0F, false); world.createExplosion(null, player.posX, player.posY, player.posZ + 5, 5.0F, false); world.createExplosion(null, player.posX, player.posY, player.posZ - 5, 5.0F, false); event.powerupIsAvailable = false; } } @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.CLIENT, TickType.RENDER); } @Override public String getLabel() { // TODO Auto-generated method stub return null; } } My KeyHandler code: package mods.exoworld.handler; import java.util.EnumSet; import mods.exoworld.item.ExoTNTHelmet; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler; import cpw.mods.fml.common.TickType; public class ExoKeyHandler extends KeyHandler { public ExoServerTickHandler tickHandler; public static KeyBinding armorPowerup = new KeyBinding( "Armor Powerup", Keyboard.KEY_F); public static KeyBinding[] arrayOfKeys = new KeyBinding[] { armorPowerup }; public static boolean[] areRepeating = new boolean[] { false }; public ExoKeyHandler() { super(arrayOfKeys, areRepeating); } @Override public String getLabel() { return "ExoWorld's KeyHandler"; } @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if (tickEnd) { if (kb.keyCode == armorPowerup.keyCode) { tickHandler.onPowerupActivated(); } } } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.CLIENT); } } P.S.: Never used TickHandler in my life, no tutorials, no examples = never use this sh@t again
August 11, 201312 yr TickRegistry.registerTickHandler() or similar name how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 11, 201312 yr Author TickRegistry.registerTickHandler() or similar name Nooooo you don't say? : I just wrote it... still not work
August 11, 201312 yr Nooooo you don't say? : *pretend i didnt see anything.............* in your frirst post you talk about registerng with the server yet your tickhabdler return a tick type of client and render, 2 type which dont exists server side. you want this tick handler server side or client side ? how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 11, 201312 yr Author Nooooo you don't say? : *pretend i didnt see anything.............* in your frirst post you talk about registerng with the server yet your tickhabdler return a tick type of client and render, 2 type which dont exists server side. you want this tick handler server side or client side ? Bold word are just wtf? Anyway Server side
August 11, 201312 yr typing answer on a phone, im sure you can still read "first" "registering" "tickhandler" return a tick type of server then, because server side doesnt call tickhandler of type client and render how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
August 11, 201312 yr Author typing answer on a phone, im sure you can still read "first" "registering" "tickhandler" return a tick type of server then, because server side doesnt call tickhandler of type client and render Done
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.