@SubscribeEvent
public void pTickEvent(PlayerTickEvent event) {
if (event.player != null) {
if (event.player.inventory.hasItem(WheelOfTime.itemAngelta)){
}
else
event.player.capabilities.allowFlying = false;
event.player.capabilities.isFlying = false;
}
}
}
The flying works correctly, once i give myself the item, I can fly. If i toss it on the ground, I can still fly. If I log out and back in, I can no longer fly.
What do I need to change in order to disable flying once they lose the item?
Nope. I can right click it to fly, and right click it again to drop down and no longer fly. But, after I toss the item, I do not lose flying. If I die or log out/in, I can no longer fly.
Still didn't work. Guess it's not too big of a deal, i doubt anyone would toss it away, and if they did, once you die or log out, it takes the flying away.
Register it where? maybe that is my original problem. Are you talking about in my main WheelOfTime.java file? I got an error today while flying around messing with it, said something about expecting a tick event, here is the error:
---- Minecraft Crash Report ----
// I just don't know what went wrong
Time: 12/15/15 7:44 PM
Description: Ticking memory connection
java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:388)
at net.minecraftforge.common.ChestGenHooks.generateStacks(ChestGenHooks.java:111)
at net.minecraft.util.WeightedRandomChestContent.generateChestContent(WeightedRandomChestContent.java:99)
at net.minecraft.util.WeightedRandomChestContent.generateChestContents(WeightedRandomChestContent.java:44)
at net.minecraft.world.gen.feature.WorldGenDungeons.generate(WorldGenDungeons.java:133)
at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:441)
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:313)
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157)
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149)
at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:405)
at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:110)
at net.minecraft.server.management.PlayerManager.filterChunkLoadQueue(PlayerManager.java:193)
at net.minecraft.server.management.PlayerManager.updatePlayerPertinentChunks(PlayerManager.java:296)
at net.minecraft.server.management.ServerConfigurationManager.updatePlayerPertinentChunks(ServerConfigurationManager.java:337)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:430)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:163)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at java.util.Random.nextInt(Random.java:388)
at net.minecraftforge.common.ChestGenHooks.generateStacks(ChestGenHooks.java:111)
at net.minecraft.util.WeightedRandomChestContent.generateChestContent(WeightedRandomChestContent.java:99)
at net.minecraft.util.WeightedRandomChestContent.generateChestContents(WeightedRandomChestContent.java:44)
at net.minecraft.world.gen.feature.WorldGenDungeons.generate(WorldGenDungeons.java:133)
at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:441)
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:313)
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157)
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149)
at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:405)
at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:110)
at net.minecraft.server.management.PlayerManager.filterChunkLoadQueue(PlayerManager.java:193)
at net.minecraft.server.management.PlayerManager.updatePlayerPertinentChunks(PlayerManager.java:296)
at net.minecraft.server.management.ServerConfigurationManager.updatePlayerPertinentChunks(ServerConfigurationManager.java:337)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:430)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:163)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@1af7e9e1
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_66, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 717917872 bytes (684 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA wot{1.0} [Wheel of Time] (bin)
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player656'/89, l='New World', x=144.46, y=80.49, z=208.76]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
I just made my first animal mob, I wasn't sure if this error happened because it tried to load one up, or if it was from the flying Ter'Angreal checking to see if the item was there. I don't know a ton about java yet, but I know the java.util.RAndom.nextInt(Random.java:338) is suppose to tell me where the error occured right? I added these to the WheelOfTime.java
Since the second part of the error is talking about chest hooks I figured it may be this new addition. I did a ton of stuff yesterday so really unsure exactly what part caused it. I'm guessing mainly the ChestHook though. I wanted to add the Ter'Angreal to dungeon loot so they could be like lost artifacts, but if need be, i can remove that and just make them craftable. I'm gonna switch that bit of coding up on the Flying item, and wait for a response on exactly how to register the event handler. And thanks for the help This is a fun learning experience, I know this weekend I gotta learn how to get all this uploaded to GitHub so its easier for people to look at and help.
I changed it, and game wouldnt load, got this message
---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.
Time: 12/16/15 6:37 PM
Description: Initializing game
java.lang.NullPointerException: Initializing game
at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:236)
at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:237)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:236)
at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:237)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_66, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 653128024 bytes (622 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHI mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHI Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHE wot{1.0} [Wheel of Time] (bin)
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '3.3.11472 Compatibility Profile Context' Renderer: 'ATI Radeon HD 4550'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: ATI Radeon HD 4550 GL version 3.3.11472 Compatibility Profile Context, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
GameRegistry.addRecipe(new ItemStack(blockCuendillar), new Object[]{"CCC","CCC","CCC",'C',WheelOfTime.itemCuendillar});
this is the line from at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:237) in the error code. This was the very first recipe I added when I was doing the tutorial. It has never caused a crash before. None of the recipes Ive added have ever crashed the game.
*Edit*
I commented out that recipe, and now it links to the second recipe. Im assuming if i comment it out, it'll just point to the next one
Ok started getting my stuff on github, I dont see how to make folders for it to go into though. but here is the main WheelOfTime.java file and the AngelEventHandler.java , ill have to upload the others later, gotta get some sleep for work tomorrow morning.
that is the start of all my files. I did my best with everything considering I had to go from MrCrayfish's tutorials to another guys, since crayfish didnt cover mobs and stuff. The second guy doesnt explain stuff as well, and his coding seems a lot different. So if you see anything that is done stupidly, let me know. I cant see why the crafting recipes would be causing an error.
I commented out EVERY crafting recipe and the game loaded. I un-commented the last one and it crashed. I un-commented these two:
GameRegistry.addRecipe(new ItemStack(itemSunburst), new Object[]{" G ","GGG"," G ",'G',Items.gold_nugget});
GameRegistry.addRecipe(new ItemStack(itemTabard), new Object[]{"W W","WWW","WWW",'W',Blocks.wool});
and the game loads, I uncommented a few more one by one, and each time the game wont load. I cannot for the life of me, figure out why my crafting recipes, which have all worked from the time i made them, are now suddenly causing the game to not load
Ok, went ahead to load the game, and it tells me I have 32 missing blocks and items. So im guessing that why my crafting recipes are bad, for some reason its not seeing the items/blocks anymore. I dont see anything in the code that would make it not see my items. Especially since it DOES see the itemSunburst and itemTabard for their crafting recipes.
***EDIT***
Scratch that, it specially says itemSunburst is one of the missing items/blocks
Ok, been up for about an hour, going through and commenting out stuff, removing files that I just added, pretty much working "backwards" slowly getting rid of changes I made while I was working on the Motai creature. Nothing is getting the game to load. It makes zero sense. I played perfectly fine while testing out the Motai creature, I had to load the game several times while testing it out, then after I got the texture to render on it, I was flying around the desert trying to make one spawn and my game crashed. I got that first error about ticking memory connection with GenChestHooks error, and anytime I try to run the game now, it says I have a crafting recipe error. If I get rid of all my recipes, it tells me im missing 32 blocks and items, How does that even make sense? One crash over GenChestHooks has caused my game to no longer see my blocks and items? I made a new world too see if it worked, it crashed when I try to click the arrow to get over to the creative tab, if I'm reading that error right, I think it crashed trying to pull up the icon for my tab.
This also appears in my console when trying to run the game, not sure if it is important or related, but trying to give as much info as I can.
[03:26:38] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[03:26:52] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
[03:26:52] [Client thread/ERROR] [FML]:
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHI mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHI Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHE wot{1.0} [Wheel of Time] (bin)
[03:26:52] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[03:26:52] [Client thread/ERROR] [FML]: Caught exception from wot
And what does it mean that it has Bin after the location?
at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:234) ~[bin/:?]
Does that mean it's something in the Bin folder that is causing it? Instead of the regular src location? I notice it has the (bin) in the error above also after UCHE wot
So many questions, sorry. Trying to get everything I can on her before I go to work, I do 12 hour shifts so I won't be able to give anymore info till late tonight. Thanks in advance to anyone that sees this and helps out.
Also, I see the Bin folder in my windows explorer, but not the project explorer. Is that normal?
Ok, I created an item that would let a player fly as long as they had it in their inventory. The coding is as follows:
package projectmayhem1983.wheeloftime.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemAngelta extends Item {
public ItemAngelta() {
this.setMaxStackSize(1);
}
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
player.capabilities.allowFlying = !player.capabilities.allowFlying;
return item;
}
}
Then, I tried to make an EventHandler class to check and see if the item is in the inventory, and if not, disable the flying. It looks like this:
package taEventHandlers;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import projectmayhem1983.wheeloftime.WheelOfTime;
public class AngelEventHandler {
@SubscribeEvent
public void pTickEvent(PlayerTickEvent event) {
if (event.player != null) {
if (event.player.inventory.hasItem(WheelOfTime.itemAngelta)){
}
else
event.player.capabilities.allowFlying = false;
event.player.capabilities.isFlying = false;
}
}
}
The flying works correctly, once i give myself the item, I can fly. If i toss it on the ground, I can still fly. If I log out and back in, I can no longer fly.
What do I need to change in order to disable flying once they lose the item?
I changed the EventHandlerta to look like this, after reading some post on here, but it still doesn't disable flying.
I see that you are new to java. You don't need to use ==false just use the not signal "!" before the statement.
Also it is not working because you are not enabling flight if the item is there.
Check out thenewboston for simple and good tutorials.
Also this code
can be converted to this:
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
I changed the code in theAngelEventHandler to look like this:
I still have the issue of being able to fly when I toss the item.
And? is it working?
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
Nope. I can right click it to fly, and right click it again to drop down and no longer fly. But, after I toss the item, I do not lose flying. If I die or log out/in, I can no longer fly.
try removing the isFlying
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
ok I'll try that now
Still didn't work. Guess it's not too big of a deal, i doubt anyone would toss it away, and if they did, once you die or log out, it takes the flying away.
try this: (and remember to register the event handler :P)
sorry for my bad english I'm Italian
Register it where? maybe that is my original problem. Are you talking about in my main WheelOfTime.java file? I got an error today while flying around messing with it, said something about expecting a tick event, here is the error:
I just made my first animal mob, I wasn't sure if this error happened because it tried to load one up, or if it was from the flying Ter'Angreal checking to see if the item was there. I don't know a ton about java yet, but I know the java.util.RAndom.nextInt(Random.java:338) is suppose to tell me where the error occured right? I added these to the WheelOfTime.java
Since the second part of the error is talking about chest hooks I figured it may be this new addition. I did a ton of stuff yesterday so really unsure exactly what part caused it. I'm guessing mainly the ChestHook though. I wanted to add the Ter'Angreal to dungeon loot so they could be like lost artifacts, but if need be, i can remove that and just make them craftable. I'm gonna switch that bit of coding up on the Flying item, and wait for a response on exactly how to register the event handler. And thanks for the help This is a fun learning experience, I know this weekend I gotta learn how to get all this uploaded to GitHub so its easier for people to look at and help.
I changed it, and game wouldnt load, got this message
GameRegistry.addRecipe(new ItemStack(blockCuendillar), new Object[]{"CCC","CCC","CCC",'C',WheelOfTime.itemCuendillar});
this is the line from at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:237) in the error code. This was the very first recipe I added when I was doing the tutorial. It has never caused a crash before. None of the recipes Ive added have ever crashed the game.
*Edit*
I commented out that recipe, and now it links to the second recipe. Im assuming if i comment it out, it'll just point to the next one
Ok started getting my stuff on github, I dont see how to make folders for it to go into though. but here is the main WheelOfTime.java file and the AngelEventHandler.java , ill have to upload the others later, gotta get some sleep for work tomorrow morning.
https://github.com/projectmayhem1983/WheelOfTimeMod
***EDIT***
ok, got the whole thing sync'd, but the path was weird, so here is a link
https://github.com/projectmayhem1983/WheelOfTimeMod/tree/master/Wheel Of Time/src/main/java/projectmayhem1983/wheeloftime
that is the start of all my files. I did my best with everything considering I had to go from MrCrayfish's tutorials to another guys, since crayfish didnt cover mobs and stuff. The second guy doesnt explain stuff as well, and his coding seems a lot different. So if you see anything that is done stupidly, let me know. I cant see why the crafting recipes would be causing an error.
I commented out EVERY crafting recipe and the game loaded. I un-commented the last one and it crashed. I un-commented these two:
GameRegistry.addRecipe(new ItemStack(itemSunburst), new Object[]{" G ","GGG"," G ",'G',Items.gold_nugget});
GameRegistry.addRecipe(new ItemStack(itemTabard), new Object[]{"W W","WWW","WWW",'W',Blocks.wool});
and the game loads, I uncommented a few more one by one, and each time the game wont load. I cannot for the life of me, figure out why my crafting recipes, which have all worked from the time i made them, are now suddenly causing the game to not load
Ok, went ahead to load the game, and it tells me I have 32 missing blocks and items. So im guessing that why my crafting recipes are bad, for some reason its not seeing the items/blocks anymore. I dont see anything in the code that would make it not see my items. Especially since it DOES see the itemSunburst and itemTabard for their crafting recipes.
***EDIT***
Scratch that, it specially says itemSunburst is one of the missing items/blocks
Ok, been up for about an hour, going through and commenting out stuff, removing files that I just added, pretty much working "backwards" slowly getting rid of changes I made while I was working on the Motai creature. Nothing is getting the game to load. It makes zero sense. I played perfectly fine while testing out the Motai creature, I had to load the game several times while testing it out, then after I got the texture to render on it, I was flying around the desert trying to make one spawn and my game crashed. I got that first error about ticking memory connection with GenChestHooks error, and anytime I try to run the game now, it says I have a crafting recipe error. If I get rid of all my recipes, it tells me im missing 32 blocks and items, How does that even make sense? One crash over GenChestHooks has caused my game to no longer see my blocks and items? I made a new world too see if it worked, it crashed when I try to click the arrow to get over to the creative tab, if I'm reading that error right, I think it crashed trying to pull up the icon for my tab.
This also appears in my console when trying to run the game, not sure if it is important or related, but trying to give as much info as I can.
[03:26:38] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[03:26:52] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
[03:26:52] [Client thread/ERROR] [FML]:
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHI mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHI Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHE wot{1.0} [Wheel of Time] (bin)
[03:26:52] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[03:26:52] [Client thread/ERROR] [FML]: Caught exception from wot
And what does it mean that it has Bin after the location?
at projectmayhem1983.wheeloftime.WheelOfTime.init(WheelOfTime.java:234) ~[bin/:?]
Does that mean it's something in the Bin folder that is causing it? Instead of the regular src location? I notice it has the (bin) in the error above also after UCHE wot
So many questions, sorry. Trying to get everything I can on her before I go to work, I do 12 hour shifts so I won't be able to give anymore info till late tonight. Thanks in advance to anyone that sees this and helps out.
Also, I see the Bin folder in my windows explorer, but not the project explorer. Is that normal?
I explored your code and...you made a terrible mistake
over preinit in your main class you didn't put @EventHandler
sorry for my bad english I'm Italian
And because of that the items wasn't registering causing you a NPE
P.S. to register tick handler you have to insert this (preferably in post-init)
sorry for my bad english I'm Italian