Jump to content

EsvDefcon

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by EsvDefcon

  1. I've tried some different ways of doing it, but it just seems that the event isn't going to trigger. Here is my code: package esvdefcon.skyline.achievementevent; import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import esvdefcon.skyline.chunk.AssembleResult; import esvdefcon.skyline.common.Skyline; public class OnRegisterShipEvent { @SubscribeEvent public static void unlockShipTypeAchievements(PlayerOpenContainerEvent event) { if(AssembleResult.passengerCapacity > AssembleResult.actualCargoCapacity && AssembleResult.passengerCapacity > AssembleResult.actualWeaponCount) { event.entityPlayer.addStat(Skyline.achievementCivilianCaptain, 1); if(AssembleResult.passengerCapacity >= 50) { event.entityPlayer.addStat(Skyline.achievementSkylinerCaptain, 1); } else if(AssembleResult.passengerCapacity < 50 && AssembleResult.passengerCapacity >= 25) { event.entityPlayer.addStat(Skyline.achievementAirshipCaptain, 1); } else if(AssembleResult.passengerCapacity < 25 && AssembleResult.passengerCapacity >= 15) { event.entityPlayer.addStat(Skyline.achievementLargeShipCaptain, 1); } else if(AssembleResult.passengerCapacity < 15 && AssembleResult.passengerCapacity >= 10) { event.entityPlayer.addStat(Skyline.achievementMediumShipCaptain, 1); } else if(AssembleResult.passengerCapacity < 10 && AssembleResult.passengerCapacity > 0) { event.entityPlayer.addStat(Skyline.achievementSmallShipCaptain, 1); } } else if(AssembleResult.actualCargoCapacity > AssembleResult.passengerCapacity && AssembleResult.actualCargoCapacity > AssembleResult.actualWeaponCount) { event.entityPlayer.addStat(Skyline.achievementCivilianCaptain, 1); if(AssembleResult.actualCargoCapacity >= 50) { event.entityPlayer.addStat(Skyline.achievementFreighterCaptain, 1); } else if(AssembleResult.actualCargoCapacity < 50 && AssembleResult.actualCargoCapacity >= 25) { event.entityPlayer.addStat(Skyline.achievementCargoShipCaptain, 1); } else if(AssembleResult.actualCargoCapacity < 25 && AssembleResult.actualCargoCapacity > 0) { event.entityPlayer.addStat(Skyline.achievementTradeShipCaptain, 1); } } else if(AssembleResult.actualWeaponCount > AssembleResult.passengerCapacity && AssembleResult.actualWeaponCount > AssembleResult.actualCargoCapacity) { event.entityPlayer.addStat(Skyline.achievementMilitaryCaptain, 1); if(AssembleResult.actualWeaponCount >= 25) { event.entityPlayer.addStat(Skyline.achievementDreadnoughtCaptain, 1); } else if(AssembleResult.actualWeaponCount < 25 && AssembleResult.actualWeaponCount >= 20) { event.entityPlayer.addStat(Skyline.achievementBattleshipCaptain, 1); } else if(AssembleResult.actualWeaponCount < 20 && AssembleResult.actualWeaponCount >= 15) { event.entityPlayer.addStat(Skyline.achievementBattlecruiserCaptain, 1); } else if(AssembleResult.actualWeaponCount < 15 && AssembleResult.actualWeaponCount >= 10) { event.entityPlayer.addStat(Skyline.achievementDestroyerCaptain, 1); } else if(AssembleResult.actualWeaponCount < 10 && AssembleResult.actualWeaponCount >= 5) { event.entityPlayer.addStat(Skyline.achievementCruiserCaptain, 1); } else if(AssembleResult.actualWeaponCount < 5 && AssembleResult.actualWeaponCount >= 3) { event.entityPlayer.addStat(Skyline.achievementFrigateCaptain, 1); } else if(AssembleResult.actualWeaponCount < 3 && AssembleResult.actualWeaponCount > 0) { event.entityPlayer.addStat(Skyline.achievementFighterCaptain, 1); } } } } I realised that my GUI blocks actually extended BlockDirectional, so I changed it to BlockContainer. However, it's still not triggering everything else is working fine after changing it to BlockContainer, but there's nothing actually happening.
  2. Oh, sorry, one more thing- do I have to call the new method or will it run whenever a container is opened? If I have to call it, what parameters should I use, just null?
  3. Ah, I think I get what you mean. I suppose that opening a container may apply to opening the GUI, as it's opened when you right-click on the block. I can use that, I hope. I'll give it a try and post how it goes alter on. Thanks again
  4. Alright, I agree with you that the most likely is probably that it's because I'm calling it rather than the event calling it. Like I said before, however, I removed the event, and I replaced it with a reference to EntityPlayer. Should I call it differently maybe?
  5. Thanks Line 244 is the line which actually adds the achievement. i tried it with the crafting event (event.player.addstat), and it crashed. So, I got rid of the ItemCraftedEvent altogether (not the method has no parameters), and registered this at the top of my class; public static EntityPlayer entityplayer; Now I can use entityplayer.addStat instead of the method. I also had to replace @SubscribeEvent with @EventHandler. Anyway, like you said, there's a NPE at line 244, which is where the achievement is added. I got the same crash when I used entityplayer. So, from what you're saying, when I go to add the achievement, it's returning null, right? I don't know where to go from here, but I thought that I should mention that I had to return something because it's a string. That's why I returned null at the bottom of the method. I doubt that this is linked, but it's probably worth noting. EDIT: While I'm waiting to see if anyone has any further ideas, I'm going to try calling another method to trigger the achievements, instead of just calling them directly from there. EDIT 2: I get the exact same error, at the line where I trigger the achievement (although it's now inside of a different method). It's definitely a problem with the actual triggering of the achievement. So, I got rid of the new methods, and went back to just adding the achievements from inside of the getShipType method.
  6. Hi, So, I have to custom method to call achievements. I want my achievements to unlock when the player builds a ship of a certain size, with certain weapons, or with a certain cargo capacity (this is for my airship mod). So, this is the code I use to get the type of ship that the player has built: public static String getShipType(ItemCraftedEvent event) { if(passengerCapacity > actualCargoCapacity && passengerCapacity > actualWeaponCount) { event.player.addStat(Skyline.achievementCivilianCaptain, 1); if(passengerCapacity >= 50) { return "Passenger- Skyliner"; } else if(passengerCapacity < 50 && passengerCapacity >= 25) { return "Passenger- Airship"; } else if(passengerCapacity < 25 && passengerCapacity >= 15) { return "Passenger- Large Ship"; } else if(passengerCapacity < 15 && passengerCapacity >= 10) { return "Passenger- Medium Ship"; } else if(passengerCapacity < 10 && passengerCapacity >= 2) { return "Passenger- Small Ship"; } } else if(actualCargoCapacity > passengerCapacity && actualCargoCapacity > actualWeaponCount) { event.player.addStat(Skyline.achievementCivilianCaptain, 1); if(actualCargoCapacity >= 50) { return "Transport- Freighter"; } else if(actualCargoCapacity < 50 && actualCargoCapacity >= 25) { return "Transport- Cargo Ship"; } else if(actualCargoCapacity < 25 && actualCargoCapacity >= 10) { return "Transport- Trade Ship"; } } else if(actualWeaponCount > passengerCapacity && actualWeaponCount > actualCargoCapacity) { event.player.addStat(Skyline.achievementMilitaryCaptain, 1); if(actualWeaponCount >= 25) { return "Military- Dreadnought"; } else if(actualWeaponCount < 25 && actualWeaponCount >= 20) { return "Military- Battleship"; } else if(actualWeaponCount < 20 && actualWeaponCount >= 15) { return "Military- Battlecruiser"; } else if(actualWeaponCount < 15 && actualWeaponCount >= 10) { return "Military- Cruiser"; } else if(actualWeaponCount < 10 && actualWeaponCount >= 5) { return "Military- Destroyer"; } else if(actualWeaponCount < 5 && actualWeaponCount >= 3) { return "Military- Frigate"; } else if(actualWeaponCount < 3 && actualWeaponCount >= 1) { return "Military- Fighter"; } } return null; } Now, this is just for aesthetic purposes. But, I have an achievement for each type of ship. So, am I right in thinking that I should be able to unlock the achievements by doing this? Because it crashes. @SubscribeEvent public static String getShipType(ItemCraftEvent event) { if(passengerCapacity > actualCargoCapacity && passengerCapacity > actualWeaponCount) { event.player.addStat(Skyline.achievementCivilianCaptain, 1); And so on, obviously I'd do this for the rest of the achievements as well. I've used @SubscribeEvent, and registered it using the FMLCommonHandler. I've used ItemCraftEvent because you need an Event to use this with, so I presumed (and I'm guessing this is where I've gone wrong) that I can just use any event here to add the achievement. When I call this method ingame (by opening the GUI), it crashes, and i get this: ---- Minecraft Crash Report ---- // There are four lights! Time: 28/08/14 18:03 Description: Rendering screen java.lang.NullPointerException: Rendering screen at esvdefcon.skyline.chunk.AssembleResult.getShipType(AssembleResult.java:244) at esvdefcon.skyline.gui.GuiHelm.drawGuiContainerForegroundLayer(GuiHelm.java:218) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:138) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1145) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) at net.minecraft.client.Minecraft.run(Minecraft.java:961) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at esvdefcon.skyline.chunk.AssembleResult.getShipType(AssembleResult.java:244) at esvdefcon.skyline.gui.GuiHelm.drawGuiContainerForegroundLayer(GuiHelm.java:218) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:138) -- Screen render details -- Details: Screen name: esvdefcon.skyline.gui.GuiHelm Mouse location: Scaled: (213, 119). Absolute: (427, 240) Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['ForgeDevName'/334, l='MpServer', x=50.09, y=75.91, z=421.87]] Chunk stats: MultiplayerChunkCache: 103, 103 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (88,64,256), Chunk: (at 8,4,0 in 5,16; contains blocks 80,0,256 to 95,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 43402 game time, 4241 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 95 total; [EntityZombie['Zombie'/137, l='MpServer', x=9.50, y=37.00, z=436.50], EntityZombie['Zombie'/136, l='MpServer', x=3.50, y=38.00, z=439.50], EntityPig['Pig'/139, l='MpServer', x=7.25, y=64.00, z=432.34], EntityPig['Pig'/138, l='MpServer', x=15.13, y=64.00, z=433.97], EntityHorse['Horse'/141, l='MpServer', x=4.91, y=64.00, z=453.44], EntityPig['Pig'/140, l='MpServer', x=2.09, y=63.00, z=459.03], EntitySkeleton['Skeleton'/129, l='MpServer', x=12.22, y=60.00, z=370.63], EntitySpider['Spider'/128, l='MpServer', x=15.03, y=19.00, z=375.88], EntityZombie['Zombie'/131, l='MpServer', x=15.91, y=44.00, z=414.59], EntitySkeleton['Skeleton'/130, l='MpServer', x=5.47, y=60.00, z=371.78], EntityZombie['Zombie'/133, l='MpServer', x=0.50, y=27.00, z=440.50], EntityHorse['Horse'/132, l='MpServer', x=15.16, y=67.00, z=423.56], EntityZombie['Zombie'/135, l='MpServer', x=1.50, y=38.00, z=437.50], EntityCreeper['Creeper'/134, l='MpServer', x=2.03, y=43.00, z=440.44], EntitySkeleton['Skeleton'/154, l='MpServer', x=29.50, y=28.00, z=379.50], EntityCreeper['Creeper'/155, l='MpServer', x=21.03, y=34.00, z=371.53], EntityBat['Bat'/156, l='MpServer', x=17.25, y=61.10, z=377.34], EntityBat['Bat'/157, l='MpServer', x=29.44, y=35.13, z=393.13], EntityPig['Pig'/158, l='MpServer', x=30.94, y=69.00, z=394.97], EntityClientPlayerMP['ForgeDevName'/334, l='MpServer', x=50.09, y=75.91, z=421.87], EntityPig['Pig'/159, l='MpServer', x=27.84, y=69.00, z=396.53], EntityPig['Pig'/163, l='MpServer', x=30.13, y=64.00, z=419.59], EntitySkeleton['Skeleton'/162, l='MpServer', x=20.91, y=43.00, z=417.34], EntityCreeper['Creeper'/161, l='MpServer', x=20.50, y=46.00, z=426.50], EntitySkeleton['Skeleton'/160, l='MpServer', x=22.00, y=48.00, z=412.69], EntityPig['Pig'/166, l='MpServer', x=17.88, y=64.00, z=450.16], EntityPig['Pig'/165, l='MpServer', x=23.03, y=64.00, z=443.88], EntityPig['Pig'/164, l='MpServer', x=21.50, y=64.00, z=419.50], EntityItem['item.item.rottenFlesh'/178, l='MpServer', x=45.50, y=66.13, z=365.44], EntityBat['Bat'/179, l='MpServer', x=32.25, y=49.10, z=413.75], EntityHorse['Horse'/182, l='MpServer', x=42.28, y=62.00, z=445.22], EntityZombie['Zombie'/183, l='MpServer', x=39.41, y=49.00, z=435.00], EntityBat['Bat'/180, l='MpServer', x=39.47, y=37.16, z=429.58], EntityZombie['Zombie'/181, l='MpServer', x=38.31, y=49.00, z=433.31], EntityCreeper['Creeper'/205, l='MpServer', x=49.00, y=27.00, z=462.56], EntitySquid['Squid'/204, l='MpServer', x=56.50, y=58.25, z=431.96], EntitySquid['Squid'/201, l='MpServer', x=56.01, y=58.65, z=428.50], EntitySquid['Squid'/200, l='MpServer', x=58.37, y=58.00, z=428.50], EntitySquid['Squid'/203, l='MpServer', x=57.23, y=58.28, z=429.08], EntityEnderman['Enderman'/336, l='MpServer', x=47.53, y=14.61, z=500.53], EntityCreeper['Creeper'/202, l='MpServer', x=60.38, y=61.72, z=420.41], EntityBat['Bat'/197, l='MpServer', x=48.42, y=37.23, z=376.72], EntityPig['Pig'/196, l='MpServer', x=61.81, y=68.00, z=353.63], EntitySkeleton['Skeleton'/199, l='MpServer', x=55.09, y=50.00, z=430.44], EntityCow['Cow'/198, l='MpServer', x=56.09, y=67.00, z=377.13], EntityZombie['Zombie'/345, l='MpServer', x=97.78, y=20.85, z=496.53], EntitySkeleton['Skeleton'/326, l='MpServer', x=74.50, y=19.00, z=478.16], EntitySkeleton['Skeleton'/327, l='MpServer', x=71.09, y=21.00, z=493.50], EntityCreeper['Creeper'/325, l='MpServer', x=64.00, y=25.00, z=477.63], EntityCreeper['Creeper'/216, l='MpServer', x=70.22, y=28.00, z=452.09], EntitySpider['Spider'/323, l='MpServer', x=30.56, y=67.00, z=490.63], EntityPig['Pig'/321, l='MpServer', x=-15.78, y=65.00, z=473.19], EntityZombie['Zombie'/93, l='MpServer', x=-27.50, y=12.00, z=406.50], EntityBat['Bat'/212, l='MpServer', x=69.43, y=32.76, z=387.74], EntityZombie['Zombie'/92, l='MpServer', x=-24.50, y=12.00, z=407.50], EntityZombie['Zombie'/335, l='MpServer', x=62.69, y=11.85, z=500.13], EntityBat['Bat'/213, l='MpServer', x=66.71, y=41.70, z=389.02], EntityCreeper['Creeper'/95, l='MpServer', x=-22.35, y=12.00, z=406.78], EntityPig['Pig'/214, l='MpServer', x=65.03, y=64.00, z=408.09], EntitySquid['Squid'/332, l='MpServer', x=90.03, y=59.19, z=470.71], EntityZombie['Zombie'/94, l='MpServer', x=-27.50, y=12.00, z=411.50], EntityZombie['Zombie'/333, l='MpServer', x=91.16, y=23.00, z=491.78], EntityBat['Bat'/215, l='MpServer', x=77.31, y=23.10, z=442.75], EntityPig['Pig'/89, l='MpServer', x=-25.47, y=67.00, z=364.50], EntityCreeper['Creeper'/330, l='MpServer', x=83.50, y=24.00, z=473.97], EntityZombie['Zombie'/331, l='MpServer', x=82.09, y=25.00, z=478.22], EntityCreeper['Creeper'/328, l='MpServer', x=75.41, y=22.00, z=481.84], EntityBat['Bat'/90, l='MpServer', x=-27.25, y=52.05, z=371.63], EntityCreeper['Creeper'/329, l='MpServer', x=76.69, y=22.00, z=483.91], EntitySkeleton['Skeleton'/211, l='MpServer', x=66.50, y=50.00, z=382.50], EntitySkeleton['Skeleton'/100, l='MpServer', x=-26.50, y=32.00, z=403.50], EntityCreeper['Creeper'/98, l='MpServer', x=-27.50, y=27.00, z=408.50], EntitySkeleton['Skeleton'/99, l='MpServer', x=-23.47, y=35.00, z=410.84], EntityCreeper['Creeper'/96, l='MpServer', x=-21.41, y=12.00, z=406.48], EntitySquid['Squid'/233, l='MpServer', x=89.56, y=61.85, z=456.02], EntityBat['Bat'/97, l='MpServer', x=-20.85, y=13.57, z=406.30], EntitySquid['Squid'/232, l='MpServer', x=88.97, y=62.47, z=460.96], EntitySkeleton['Skeleton'/231, l='MpServer', x=94.50, y=22.00, z=453.50], EntityEnderman['Enderman'/110, l='MpServer', x=-8.75, y=40.00, z=417.31], EntityBat['Bat'/230, l='MpServer', x=83.25, y=21.10, z=439.63], EntitySpider['Spider'/111, l='MpServer', x=-10.66, y=64.00, z=428.00], EntityCreeper['Creeper'/108, l='MpServer', x=-13.50, y=40.00, z=414.50], EntityZombie['Zombie'/229, l='MpServer', x=84.44, y=50.00, z=416.44], EntityCow['Cow'/228, l='MpServer', x=87.72, y=63.00, z=380.59], EntitySpider['Spider'/109, l='MpServer', x=-13.44, y=40.00, z=418.13], EntityCreeper['Creeper'/107, l='MpServer', x=-7.94, y=20.00, z=392.41], EntityZombie['Zombie'/112, l='MpServer', x=-6.03, y=39.00, z=437.50], EntityZombie['Zombie'/127, l='MpServer', x=8.50, y=14.00, z=369.50], EntityZombie['Zombie'/126, l='MpServer', x=8.50, y=14.00, z=371.50], EntityBat['Bat'/244, l='MpServer', x=102.08, y=25.48, z=458.59], EntityZombie['Zombie'/125, l='MpServer', x=7.50, y=14.00, z=373.50], EntityZombie['Zombie'/124, l='MpServer', x=6.50, y=14.00, z=374.50], EntityItem['item.item.rottenFlesh'/242, l='MpServer', x=101.78, y=65.13, z=360.78], EntityCreeper['Creeper'/123, l='MpServer', x=10.22, y=23.00, z=365.91], EntityCreeper['Creeper'/243, l='MpServer', x=108.69, y=20.00, z=458.59]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2568) at net.minecraft.client.Minecraft.run(Minecraft.java:982) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8 (amd64) version 6.2 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 873090064 bytes (832 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 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.18.1180 Minecraft Forge 10.13.0.1180 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available skyline{1.0.0 Pre-Alpha} [EsvDefcon's Skyline Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: AMD Radeon HD 7500G GL version 4.2.11764 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) So, is there another way entirely that I should be doing this? Or, if I can do it in this method, what should I replace the current event with to fix this? Thanks
  7. Alright, I have the entity bomb. Now, as opposed to having a button in the helm GUI, I have the keypress set up already. You said to make a boolean, which decreases the entity's y position when true, which I can understand fine (or at least I think so). I can just use a for loop for this. To actually spawn the bomb (and to make things a little less complicated a this point), I thought of just using the player's inventory to hold the bombs. So, here's the code I added to my update method (where I handle all of my controls) to spawn it: if(keys.bombkey.getIsKeyPressed()) { if(entityplayer.capabilities.isCreativeMode || entityplayer.inventory.consumeInventoryItem(Skyline.bomb)) { if(!world.isRemote) { world.spawnEntityInWorld(new EntityBomb(world, entityplayer)); decreaseEntityBombYPos = true; } } } And, then, I'd have to make the loop which decreases the y position when this is true. Then, once the bomb exploded, would I have to set it to false for the next bomb? Or can it just be left to true so that they will fall anyway?
  8. It's not really about the keypress itself (I didn't really word this question very well, to be honest), I've actually got controls for moving the ship set up already, I'm just not sure if I should just call the method which drops the bomb entity whenever the key is pressed, or whether I should detect the key and then use that inside of another method (or even something else). My real issue here is with getting the bomb to drop, I can detect the key fine. I guess that I should just make an entity which starts with a negative y velocity, or something along those lines. But, apart from that, I don't really know how to get the bomb to fall when it's spawned.
  9. Ok, So I just asked a question about making a bomb bay. It was a bad question, so let me rephrase it. Now, I'm trying to make a bomb bay. That is, essentially, just a block which spawns a bomb entity. I want the entity to spawn where the player is, and then fall down until it hits the ground. To make it spawn the entity, I want the player to press a key, and then have the entity spawn. Now, I've already set up the key press. When the "B" key is pressed, my mod detects it. Now I need to make a block which has an inventory (just like a chest), which the player can put bombs into. When there are bombs in it, and the key is pressed, I want a bomb to spawn, and then fall down to the ground. Now, I don't know how to spawn an entity at the player, and then have it fall down. I've made the entity, which explodes on impact, but I don't know how to make it fall. Something to bear in mind, here, is that I'm working on an airship mod. it works, and you can fly airships around, so when the bomb falls it will be falling from an airship (just to be clear that I'm not making the player suddenly explode when the key is pressed). So, my question is this: how can I make a method which checks to see if there is any bombs in the bomb bay, and then spawn an entity at the player, which will then fall? Thanks
  10. Sorry about all of the posts, but I can't believe that I missed this. I had a reference of one of the achievements with the wrong spelling. I didn't notice it because I had registered the correct reference, but I'd used the incorrect reference as the prerequisite achievement for other achievements. This didn't throw an error, but crashed because the incorrect reference was null. Thanks again
  11. I tried switching my .registerAchievementPage to the PostInit method, but with no luck. It worked yesterday when it was in the Init method along with the achievements, although I don't have a reference for it. Do I need to reference the achievement page, something like this? public static AchievementPage skylineAchievementPage; And then define it in init? skylineAchievementPage = new AchievementPage("Skyline", new Achievement[]{achievements}); Or just use AchievementPage.registerAchievementPage(new AchievementPage("Skyline", new Achievement[]{achievements}); Aside from this, I don't think that this is causing the error. Maybe some of the prerequisite achievements are incorrect. I'll check that everything makes sens and then post if it is fixed or not.
  12. Sorry about that, and thanks. So, the achievements aren't registered correctly, but I registered them in exactly the same way as the two which were working yesterday. I've obviously either missed something out somewhere, or there's something else causing them to not register. I'll read those threads, and take a look through my code again.
  13. Hi, So, I had an issue yesterday with achievements not being triggered. I fixed that, and had two working achievements. So, I decided to move on to adding more achievements, and I now have a total of 18 (they seem kinda pointless, in some cases, but they're part of a new levelling system in the mod). Anyway, when I went to test out the new achievement ingame, I loaded up the Minecraft achievements page, and hit my achievement page's button. Then, it crashed. I have the code, and the error report, and I'd be really grateful if anyone can help me. Also, you can't unlock the achievements yet, I've just registered them, although I doubt that this would make a difference. //Achievement Code There are registries before this code, i.e. public static Achievement achievementName; I did this for every single achievement. achievementTakeTheHelm = new Achievement("achievement.takeTheHelm", "takeTheHelm", 0, 0, new ItemStack(Skyline.blockMarkShip), (Achievement)null).initIndependentStat().registerStat(); achievementCiviianCaptain = new Achievement("achievement.civilianCaptain", "civilianCaptain", 1, -2, Skyline.blockBalloon, achievementTakeTheHelm).registerStat(); achievementTradeShipCaptain = new Achievement("achievement.tradeShipCaptain", "tradeShipCaptain", -2, -3, Skyline.blockMarkShip, achievementCivilianCaptain).registerStat(); achievementCargoShipCaptain = new Achievement("achievement.cargoShipCaptain", "cargoShipCaptain", 0, -1, Skyline.blockBalloon, achievementTradeShipCaptain).registerStat(); achievementFreighterCaptain = new Achievement("achievement.freighterCaptain", "freighterCaptain", -1, 2, Skyline.blockBalloon, achievementCargoShipCaptain).registerStat(); achievementSmallShipCaptain = new Achievement("achievement.smallShipCaptain", "smallShipCaptain", 4, -2, Skyline.blockBalloon, achievementCivilianCaptain).registerStat(); achievementMediumShipCaptain = new Achievement("achievement.mediumShipCaptain", "mediumShipCaptain", 2, 3, Skyline.blockBalloon, achievementSmallShipCaptain).registerStat(); achievementLargeShipCaptain = new Achievement("achievement.largeShipCaptain", "largeShipCaptain", 1, 4, Skyline.blockBalloon, achievementMediumShipCaptain).registerStat(); achievementAirshipCaptain = new Achievement("achievement.airshipCaptain", "arishipCaptain", 2, 3, Skyline.blockBalloon, achievementLargeShipCaptain).registerStat(); achievementSkylinerCaptain = new Achievement("achievement.skylinerCaptain", "skylinerCaptain", 1, -2, Skyline.blockBalloon, achievementAirshipCaptain).registerStat(); achievementMilitaryCaptain = new Achievement("achievement.militaryCaptain", "militaryCaptain", 2, -3, Skyline.blockMarkShip, achievementTakeTheHelm).registerStat(); achievementFighterCaptain = new Achievement("achievement.fighterCaptain", "fighterCaptain", 2, -4, Skyline.blockMarkShip, achievementMilitaryCaptain).registerStat(); achievementFrigateCaptain = new Achievement("achievement.frigateCaptain", "frigateCaptin", 3, -5, Skyline.blockMarkShip, achievementFighterCaptain).registerStat(); achievementCruiserCaptain = new Achievement("achievement.cruiserCaptain", "cruiserCaptain", 1, -5, Skyline.blockMarkShip, achievementFrigateCaptain).registerStat(); achievementDestroyerCaptain = new Achievement("achievement.destroyerCaptain", "destroyerCaptain", 2, 5, Skyline.blockMarkShip, achievementCruiserCaptain).registerStat(); achievementBattlecruiserCaptain = new Achievement("achievement.battlecruiserCaptain", "battlecruiserCaptain", 5, -2, Skyline.blockMarkShip, achievementDestroyerCaptain).registerStat(); achievementBattleshipCaptain = new Achievement("achievement.battleshipCaptain", "battleshipCaptain", 2, -2, Skyline.blockMarkShip, achievementBattlecruiserCaptain).registerStat(); achievementDreadnoughtCaptain = new Achievement("achievement.dreadnoughtCaptain", "dreadnoughtCaptain", 3, 5, Skyline.blockMarkShip, achievementBattleshipCaptain).registerStat(); //Achievement Page AchievementPage.registerAchievementPage(new AchievementPage("Skyline", new Achievement[]{achievementTakeTheHelm, achievementCivilianCaptain, achievementTradeShipCaptain, achievementCargoShipCaptain, achievementFreighterCaptain, achievementSmallShipCaptain, achievementMediumShipCaptain, achievementLargeShipCaptain, achievementAirshipCaptain, achievementSkylinerCaptain, achievementMilitaryCaptain, achievementFighterCaptain, achievementFrigateCaptain, achievementCruiserCaptain, achievementDestroyerCaptain, achievementBattlecruiserCaptain, achievementBattleshipCaptain, achievementDreadnoughtCaptain})); And here is the crash report: ---- Minecraft Crash Report ---- // Don't be sad. I'll do better next time, I promise! Time: 27/08/14 10:00 Description: Rendering screen java.lang.NullPointerException: Rendering screen at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385) at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1145) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) at net.minecraft.client.Minecraft.run(Minecraft.java:961) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385) at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219) -- Screen render details -- Details: Screen name: net.minecraft.client.gui.achievement.GuiAchievements Mouse location: Scaled: (177, 205). Absolute: (532, 130) Screen size: Scaled: (456, 249). Absolute: (1366, 745). Scale factor of 3 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['ForgeDevName'/139, l='MpServer', x=260.24, y=10.18, z=603.38]] Chunk stats: MultiplayerChunkCache: 570, 570 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (335,4,396), Chunk: (at 15,0,12 in 20,24; contains blocks 320,0,384 to 335,255,399), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 23502 game time, 8865 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 48 total; [EntitySlime['Slime'/141, l='MpServer', x=259.07, y=4.05, z=598.98], EntitySlime['Slime'/5, l='MpServer', x=193.26, y=4.00, z=563.21], EntitySlime['Slime'/140, l='MpServer', x=263.59, y=4.00, z=613.25], EntitySlime['Slime'/143, l='MpServer', x=287.82, y=4.00, z=602.10], EntitySlime['Slime'/142, l='MpServer', x=227.63, y=4.00, z=602.50], EntitySlime['Slime'/8, l='MpServer', x=217.06, y=4.00, z=523.78], EntitySlime['Slime'/9, l='MpServer', x=203.44, y=4.00, z=564.69], EntitySlime['Slime'/10, l='MpServer', x=206.75, y=4.00, z=580.44], EntitySlime['Slime'/13, l='MpServer', x=230.66, y=4.00, z=537.03], EntitySlime['Slime'/14, l='MpServer', x=230.67, y=4.00, z=534.21], EntitySlime['Slime'/15, l='MpServer', x=241.06, y=4.00, z=558.73], EntitySlime['Slime'/152, l='MpServer', x=212.69, y=4.02, z=639.26], EntitySlime['Slime'/17, l='MpServer', x=235.86, y=4.00, z=588.53], EntitySlime['Slime'/153, l='MpServer', x=313.97, y=4.00, z=648.88], EntitySlime['Slime'/16, l='MpServer', x=226.37, y=4.00, z=574.27], EntitySlime['Slime'/154, l='MpServer', x=323.38, y=4.00, z=630.23], EntitySlime['Slime'/19, l='MpServer', x=236.77, y=4.00, z=558.13], EntitySlime['Slime'/155, l='MpServer', x=321.92, y=4.65, z=633.57], EntitySlime['Slime'/156, l='MpServer', x=213.49, y=4.00, z=662.46], EntitySlime['Slime'/157, l='MpServer', x=215.38, y=4.00, z=657.78], EntitySlime['Slime'/158, l='MpServer', x=214.90, y=4.70, z=670.42], EntitySlime['Slime'/23, l='MpServer', x=259.01, y=4.00, z=565.02], EntitySlime['Slime'/22, l='MpServer', x=253.29, y=4.95, z=534.70], EntitySlime['Slime'/144, l='MpServer', x=274.00, y=4.00, z=625.00], EntitySlime['Slime'/25, l='MpServer', x=277.33, y=4.00, z=568.56], EntitySlime['Slime'/145, l='MpServer', x=231.65, y=4.00, z=620.92], EntitySlime['Slime'/24, l='MpServer', x=286.93, y=4.00, z=561.53], EntitySlime['Slime'/146, l='MpServer', x=276.76, y=4.00, z=628.65], EntitySlime['Slime'/27, l='MpServer', x=283.88, y=4.00, z=581.71], EntitySlime['Slime'/147, l='MpServer', x=225.59, y=4.00, z=628.00], EntitySlime['Slime'/26, l='MpServer', x=268.71, y=4.98, z=573.70], EntitySlime['Slime'/148, l='MpServer', x=293.14, y=4.00, z=634.73], EntitySlime['Slime'/149, l='MpServer', x=307.47, y=3.00, z=617.07], EntitySlime['Slime'/150, l='MpServer', x=334.06, y=4.00, z=590.06], EntitySlime['Slime'/31, l='MpServer', x=295.38, y=4.00, z=572.69], EntitySlime['Slime'/151, l='MpServer', x=256.41, y=4.00, z=659.48], EntitySlime['Slime'/30, l='MpServer', x=295.38, y=4.00, z=576.99], EntitySlime['Slime'/171, l='MpServer', x=333.79, y=4.00, z=681.52], EntitySlime['Slime'/42, l='MpServer', x=322.18, y=4.00, z=553.88], EntitySlime['Slime'/162, l='MpServer', x=263.72, y=4.00, z=678.91], EntitySlime['Slime'/43, l='MpServer', x=314.35, y=4.95, z=560.93], EntitySlime['Slime'/161, l='MpServer', x=254.58, y=4.00, z=670.44], EntitySlime['Slime'/166, l='MpServer', x=332.31, y=3.00, z=662.09], EntitySlime['Slime'/164, l='MpServer', x=183.93, y=4.00, z=630.02], EntitySlime['Slime'/77, l='MpServer', x=320.21, y=4.00, z=549.58], EntitySlime['Slime'/78, l='MpServer', x=323.35, y=4.82, z=582.44], EntitySlime['Slime'/79, l='MpServer', x=331.76, y=4.60, z=589.10], EntityClientPlayerMP['ForgeDevName'/139, l='MpServer', x=260.24, y=10.18, z=603.38]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2568) at net.minecraft.client.Minecraft.run(Minecraft.java:982) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8 (amd64) version 6.2 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 930543432 bytes (887 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 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.18.1180 Minecraft Forge 10.13.0.1180 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available skyline{1.0.0 Pre-Alpha} [EsvDefcon's Skyline Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: AMD Radeon HD 7500G GL version 4.2.11764 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) If anyone knows how I can stop this from happening, please let me know!
  14. Alright, I already have the serverStarting(FMLServerStartingEvent event) method for registering my mod's commands, and I read that you can just register a new packet channel in this method. So, I gave it a go, but I didn't really get very far with it. Can you help me with sending a packet to the server to do this? And thanks for your help so far
  15. Alright, I tried using entityplayer.triggerAchievement inside of the method which handles when the buttons are pressed. Under the button I want to trigger the achievement, I put the entityplayer reference. Obviously I have to use a reference of this instead of using EntityPlayer.triggerAchievement (correct me if I'm wrong), so I added the parameter EntityPlayer entityplayer into the moethod's parameters. I get no errors, open up Minecraft, but when I go to test it out the buttons press but now have no functionality. So, this whole method was f***d up by this, basically. So, after this, I tried making a new method to give the achievement (with the parameter EntityPlayer entityplayer), and I tried calling that from inside of my GUI button method. Now, that (for some reason) didn't work. When I call this method, I may be using the wrong parameter, or at least I'm guessing so. Here's the method I made: public void getAchievementShipwright(EntityPlayer entityplayer) { entityplayer.triggerAchievement(Skyline.achievementShipwright); } To call it, I have to use getAchievementShipwright(), but what parameter should I use when calling it? Thanks to anyone who can help, and sorry for the stupid questions, I've been working on fixing bugs with the mod for the past few hours and I'm getting tired now.
  16. Thanks, I was looking at using the existing events I could find in forge's class, I hadn't even thought of that. I'll give it a go now and see if I can get it to run from the GUI's base class
  17. Thanks, any idea on how to go about doing this? I get the idea behind it, but I need to use a method which I can actually call the player from to be able to add the achievement to them. And (just in case it makes any difference), my buttons run straight to another class which handles them.
  18. Hi, So, I am trying to add achievements to my mod. Well, I say trying, but I've got the first achievement working fine (which is unlocked when you craft a block). What I'm trying to do now is to add an achievement when a certain button is activated in my GUI. What I'm looking for is a method that I can use to add my achievement to the player when the GUI button is pressed. i tried assigning an int veriable to it (I have the int change to 1 when the button was pressed, and an if statement saying that if the int was equalt to 1, then it would add the achievement to the player, but I couldn't do this because I needed to use an existing method to call whatever.player.addStat(achievement, 1). Anyway, does anyone know how I can add the achievement when the button is pressed? Thanks in advance
  19. Thanks, that's definitely something that I should be able to handle!
  20. Thanks again to everyone for all of the help, and when you were talking about making submods, would you know how to do this exactly? Sorry if I'm sounding like I haven't got a clue about java as well by the way, it's just that I'm really confused on this one.
  21. Thanks again, and yeah, I'll have a look into the mod annotation class. Hopefully I'll find something!
  22. Thanks for your reply, I think that you know exactly what I'm trying to do! So unfortunately I'm still pretty new to java, so I'd need a little more explanation of how to do it. So if I use this @Mod annotation, then I will obviously be putting it inside of a new class file? Which I'm guessing that you would also need to make a new workspace for it, because it's a different mod. I'm probably wrong, so please correct me if I am
  23. I was thinking about making it so that my main mod can detect that there is a file in it's content packs folder, which would then be able to allow the items in the content pack to work using my main mod's code. Anyone know if this is possible, or how at all to to do it?
  24. I mean coding it in java, so just like I would with a normal mod (public static Item... and so on), but I need my main mod to be able to read the new content packs somehow, and to be able to add their items into the game
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.