Posted June 26, 201312 yr So lately I have been trying to make armor that allows you to fly like you are in creative. I have not had any luck with using a tick handler and I was wondering if there is any other way to allow flight than what this topic: http://www.minecraftforge.net/forum/index.php?topic=7925.0 does as it has not worked for me.
June 26, 201312 yr Why/how didn't it work? BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 26, 201312 yr Author Basically it would not let you fly but there were no errors I will post the classes later tonight.
June 27, 201312 yr The exact classes I used there still work for me... (Note this is all from the project I use to test stuff (mostly for this site), so it isn't organized at all) Tick Handler import java.util.EnumSet; import mods.gaspoweredstick.code.item.ItemModArmor; import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class PlayerTickHandler implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { playerTick((EntityPlayer)tickData[0]); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER); } @Override public String getLabel() { return "My_Tick_Handler"; } private void playerTick(EntityPlayer player) { if (player.inventory.armorInventory[3] != null) { if (player.inventory.armorInventory[3].getItem() instanceof ItemModArmor) { player.capabilities.allowFlying = true; } } else if (!player.capabilities.isCreativeMode) { player.capabilities.allowFlying = false; } } } Armor class import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.EnumHelper; public class ItemModArmor extends ItemArmor { public static final EnumArmorMaterial ModArmor = EnumHelper .addArmorMaterial("ModArmor", 9001, new int[]{1,2,3,4}, 42); public ItemModArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); } } Common Proxy import mods.gaspoweredstick.code.handlers.PlayerTickHandler; import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; public class CommonProxy { public void registerHandlers() { TickRegistry.registerTickHandler(new PlayerTickHandler(), Side.SERVER); } } Client Proxy import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; import mods.gaspoweredstick.code.common.CommonProxy; import mods.gaspoweredstick.code.handlers.PlayerTickHandler; public class ClientProxy extends CommonProxy { @Override public void registerHandlers() { TickRegistry.registerTickHandler(new PlayerTickHandler(), Side.SERVER); TickRegistry.registerTickHandler(new PlayerTickHandler(), Side.CLIENT); } } Main File import mods.gaspoweredstick.code.block.TestBlock; import mods.gaspoweredstick.code.item.ItemModArmor; import mods.gaspoweredstick.code.item.Stick; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.Configuration; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="GasPoweredStick", name="Gas Powered Stick", version = "1.0a") @NetworkMod(serverSideRequired=false, clientSideRequired=true) public class GasPoweredStick { @Instance("GasPoweredStick") public static GasPoweredStick instance; @SidedProxy(clientSide="mods.gaspoweredstick.code.client.ClientProxy", serverSide="mods.gaspoweredstick.code.common.CommonProxy") public static CommonProxy proxy; @PreInit public static void preInit(FMLPreInitializationEvent evt) { Config.doConfig(new Configuration(evt.getSuggestedConfigurationFile())); } public static Item stick, gasStick, modHat; public static Block testBlock; @Init public static void init(FMLInitializationEvent evt) { stick = new Stick(Config.Stick_ID, Stick.STICK) .setUnlocalizedName("GasStick1"); gasStick = new Stick(Config.GPStick_ID, Stick.STICK2) .setUnlocalizedName("GasStick2"); modHat = new ItemModArmor(9001, ItemModArmor.ModArmor, 0, 0) .setCreativeTab(CreativeTabs.tabCombat).setUnlocalizedName("modHat"); testBlock = new TestBlock(800, Material.cloth).setCreativeTab(CreativeTabs.tabMisc).setUnlocalizedName("testBlock"); LanguageRegistry.addName(stick, "Stick!"); LanguageRegistry.addName(gasStick, "Ghast Powered Stick!"); LanguageRegistry.addName(modHat, "Mod Hat"); LanguageRegistry.addName(testBlock, "Test Block"); GameRegistry.registerBlock(testBlock, "testBlock"); GameRegistry.addRecipe(new ItemStack(stick), " X", " X ", "X ", 'X', Item.stick); GameRegistry.addRecipe(new ItemStack(gasStick), "YYX", "YXY", "XYY", 'X', stick, 'Y', Item.ghastTear); proxy.registerHandlers(); } @PostInit public static void postInit(FMLPostInitializationEvent evt) { } } github
June 27, 201312 yr you need to set it in the onArmorUpdateTick method in the armor's item class. doesn't disable after the armor has been removed... github
June 27, 201312 yr Ask the Gravitysuit maker how he solved the problem. Maybe he has a way. And if you want a realistic Flying (like with a jetpack) than you could look into the IC2 Sources they have it. The bad thing is google which comes at 1.4 (maybe bevor) so you only can get the 1.2 source^^ better than nothing^^"
June 27, 201312 yr Author I fixed it... The first time when i had it based off of Yagoki's classes I didn't realize the armor was based off of one class when we have individual classes for them... Thanks for you help!!1
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.