Xetapro12 Posted March 24, 2015 Posted March 24, 2015 Hey can someone say what i did wrong here? ServerTickHandler.java int count = 0; int delay = 0; private void onPlayerTick(EntityPlayer player) { if(player.inventory.hasItem(BetterArmourAndTools.FlyRing) && player.capabilities.isCreativeMode == false && this.count < 100 && this.delay == 0) { player.capabilities.allowFlying = true; if(player.capabilities.isFlying){ this.count++; } if(this.count > 0 && !player.capabilities.isFlying){ count = 100; } System.out.println("We should be flying"); } else { this.count = 0; this.delay++; if (this.delay >= 320) { this.delay = 0; } player.capabilities.allowFlying = false; System.out.println("We should NOT be flying"); } System.out.println(this.count); System.out.println(this.delay); } FlyRing.java package com.BetterArmourAndTools.blocksitems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerEvent; public class FlyRing extends Item{ public FlyRing(int id) { super(); this.setCreativeTab(BetterArmourAndTools.rubyTab); this.setMaxStackSize(1); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg){ this.itemIcon = reg.registerIcon("BetterArmourAndTools:FlyRing"); } } Quote NEWB! in java im sorry
Xetapro12 Posted March 24, 2015 Author Posted March 24, 2015 You can't use the "count" and "delay" fields like that, they are global if you do that (shared among all players). You need IExtendedEntityProperties. Also: Where do you call onPlayerTick? Ehm i really dont know i found this at http://www.minecraftforge.net/forum/index.php?topic=8836.0 Quote NEWB! in java im sorry
Recommended Posts
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.