Jump to content

lionel5116

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

lionel5116's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks for the response, based on your observation and "me" looking at the code closer (a second pair of eyes), there were "2" mistakes I was making, first "all" of the strings for each row in the grid "MUST" be of the same size (or you will get an indexOutRangeException), then the last row item for the common character must be in ' ' (single quotes), I don't know how I missed that.. (looking at to hard I guess), now "all of my patterns work"... so even if I use: GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), "R", "RR", 'R', Blocks.cobblestone); - that crashed..., but once I modified the code to: GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), "R ", "RR", 'R', Blocks.cobblestone); - that worked !! Thanks guys..
  2. I have an issue concerning a recipe that I created for rendering an item that I created based on the itemPickAxe class. I don't think it has to do with the class that it extends itself, but with the way the recipe is working. I have attached the code on GitHub (like you suggested) at: https://gist.github.com/lionel5116/ If you look at the file "ModRecipes.java", you notice a block of code: For some reason, If I use a pattern: GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), new Object[]{ "R", "RR", 'R', Blocks.cobblestone[/b] }); It will not create the item using the pattern shown, but the weird thing is, it will create the pickaxe if I remove the segment on the second row of the pattern, like the pattern shown below: GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), new Object[]{ "R", "R", 'R', Blocks.cobblestone }); If look at the code for sword here: //let's make a recipe for my bad ass sword GameRegistry.addRecipe(new ItemStack(ModItems.ljonesmastersword), new Object[]{ "SS", "SS", "SS", 'S', Blocks.cobblestone }); This pattern works as it should using the pattern outlined. I have attached all of my main files on Git as mentioned: https://gist.github.com/lionel5116/
  3. THANK YOU ..THANK YOU.. THANK YOU...!! that worked... you rock man. trying to learn modding from those teach yourself Mod development books from amazon and google books only gives you basic code (and it's always a couple of versions off) can really be a headache. They give you concepts.. basic code, but the real education from from you guys.. Thanks again man for all of your help, I have driving myself crazy on this issue for a week .. (now I can sleep -
  4. Thanks Man.. In a nutshell here is the layout of the code (condensed), I will also include the crash report details at the end. This is my ItemModFood.java class *** public class ItemModFood extends ItemFood{ public ItemModFood(String unLocalizedName, int healAmount,float saturationModifier,boolean wolvsFavorite) { super(healAmount,saturationModifier,wolvsFavorite); this.setUnlocalizedName(unLocalizedName); this.setCreativeTab(CreativeTabs.tabMaterials); } } This is my ModItems.java class *** public final class ModItems { public static Item berry; public static void createItems(){ //below would be to register a basic item instead //GameRegistry.registerItem(berry = new BasicItem("berry"), "berry"); //let's change this to register a food item instead GameRegistry.registerItem(berry = new ItemModFood("berry",3,0.3F,true),"berry"); } } This is my ItemRenderRegister class**** public final class ItemRenderRegister { public static void reg(Item myitem){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(myitem, 0, new ModelResourceLocation("ljonesmodding" + ":" + myitem.getUnlocalizedName().substring(5), "inventory")); } public static void registerItemRender(){ reg(ModItems.berry); } } This is my Main class details: In my preInit @EventHandler public void preInit(FMLPreInitializationEvent event) { ModItems.createItems(); } In my Init: @EventHandler public void init(FMLInitializationEvent event) { GameRegistry.addRecipe(new ItemStack(berry, 4), new Object[]{ "A", "A", "A", 'A', Items.apple }); if(event.getSide() == Side.CLIENT) /*it will place this is a proxy class later */ { /*THIS IS WHERE THE PROBLEM STILL EXISTS WITH REGISTERING THE RENDERS */ ItemKey.registerRenders(); //register my food item //ItemBerry.registerRenders(); ItemRenderRegister.registerItemRender(); } } Everything comes up find in regards to the texture and and item being seen in my inventory. But as I said earlier, when I try to create the Item, my game crashes with the following report: ---- Minecraft Crash Report ---- // This doesn't make any sense! Time: 2/26/16 7:35 PM Description: Rendering screen java.lang.NullPointerException: Rendering screen at net.minecraft.client.renderer.entity.RenderItem.renderItemOverlayIntoGUI(RenderItem.java:466) at net.minecraft.client.gui.inventory.GuiContainer.drawSlot(GuiContainer.java:293) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:113) at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:306) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1157) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) at net.minecraft.client.Minecraft.run(Minecraft.java:380) at net.minecraft.client.main.Main.main(Main.java:116) 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:135) 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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.client.renderer.entity.RenderItem.renderItemOverlayIntoGUI(RenderItem.java:466) at net.minecraft.client.gui.inventory.GuiContainer.drawSlot(GuiContainer.java:293) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:113) at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:306) -- Screen render details -- Details: Screen name: net.minecraft.client.gui.inventory.GuiCrafting Mouse location: Scaled: (129, 96). Absolute: (387, 456) Screen size: Scaled: (357, 249). Absolute: (1070, 745). Scale factor of 3 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player533'/182, l='MpServer', x=-197.16, y=64.00, z=-153.33]] Chunk stats: MultiplayerChunkCache: 621, 621 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: -204.00,64.00,-160.00 - World: (-204,64,-160), Chunk: (at 4,4,0 in -13,-10; contains blocks -208,0,-160 to -193,255,-145), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Level time: 226982 game time, 228176 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: 76 total; [EntitySquid['Squid'/139, l='MpServer', x=-147.03, y=58.00, z=-157.59], EntityBat['Bat'/138, l='MpServer', x=-158.31, y=38.84, z=-198.75], EntitySkeleton['Skeleton'/131, l='MpServer', x=-162.47, y=37.00, z=-195.94], EntitySquid['Squid'/133, l='MpServer', x=-166.09, y=54.38, z=-159.47], EntitySquid['Squid'/132, l='MpServer', x=-166.41, y=61.75, z=-188.59], EntitySkeleton['Skeleton'/134, l='MpServer', x=-170.50, y=17.00, z=-109.50], EntitySquid['Squid'/152, l='MpServer', x=-140.19, y=59.47, z=-108.88], EntityCreeper['Creeper'/145, l='MpServer', x=-137.50, y=23.00, z=-205.00], EntityCreeper['Creeper'/147, l='MpServer', x=-139.50, y=21.00, z=-164.50], EntityItem['item.item.arrow'/148, l='MpServer', x=-137.84, y=19.00, z=-160.06], EntityItem['item.item.bone'/149, l='MpServer', x=-137.81, y=17.00, z=-162.28], EntityZombie['Zombie'/150, l='MpServer', x=-134.50, y=23.00, z=-168.50], EntitySkeleton['Skeleton'/151, l='MpServer', x=-137.59, y=19.00, z=-156.94], EntitySkeleton['Skeleton'/34, l='MpServer', x=-277.56, y=40.00, z=-189.94], EntitySkeleton['Skeleton'/35, l='MpServer', x=-273.31, y=67.00, z=-177.16], EntityCreeper['Creeper'/32, l='MpServer', x=-275.56, y=30.00, z=-209.03], EntityZombie['Zombie'/33, l='MpServer', x=-274.50, y=14.00, z=-201.09], EntitySkeleton['Skeleton'/38, l='MpServer', x=-271.44, y=49.00, z=-163.84], EntityZombie['Zombie'/36, l='MpServer', x=-263.97, y=45.00, z=-168.56], EntitySkeleton['Skeleton'/37, l='MpServer', x=-276.69, y=43.00, z=-165.88], EntitySkeleton['Skeleton'/47, l='MpServer', x=-259.50, y=64.00, z=-233.50], EntityCreeper['Creeper'/51, l='MpServer', x=-267.50, y=29.00, z=-207.50], EntityCreeper['Creeper'/50, l='MpServer', x=-271.91, y=29.00, z=-205.00], EntityCreeper['Creeper'/49, l='MpServer', x=-265.97, y=30.00, z=-209.47], EntityCreeper['Creeper'/48, l='MpServer', x=-267.94, y=29.00, z=-210.38], EntityCow['Cow'/55, l='MpServer', x=-261.50, y=69.00, z=-188.50], EntityCow['Cow'/54, l='MpServer', x=-261.50, y=69.00, z=-188.50], EntityCreeper['Creeper'/52, l='MpServer', x=-270.31, y=29.00, z=-206.91], EntityEnderman['Enderman'/59, l='MpServer', x=-253.50, y=47.00, z=-160.28], EntitySkeleton['Skeleton'/58, l='MpServer', x=-267.50, y=37.00, z=-173.50], EntitySkeleton['Skeleton'/57, l='MpServer', x=-274.50, y=43.00, z=-175.84], EntitySkeleton['Skeleton'/56, l='MpServer', x=-273.47, y=43.00, z=-176.91], EntitySquid['Squid'/63, l='MpServer', x=-253.34, y=53.41, z=-122.41], EntitySquid['Squid'/62, l='MpServer', x=-260.97, y=57.34, z=-130.19], EntitySquid['Squid'/61, l='MpServer', x=-253.19, y=61.88, z=-129.28], EntitySquid['Squid'/60, l='MpServer', x=-253.63, y=48.03, z=-131.91], EntityBat['Bat'/68, l='MpServer', x=-253.25, y=45.10, z=-160.25], EntityBat['Bat'/69, l='MpServer', x=-254.25, y=45.10, z=-157.25], EntityCreeper['Creeper'/70, l='MpServer', x=-246.94, y=42.00, z=-156.38], EntitySquid['Squid'/71, l='MpServer', x=-242.66, y=58.72, z=-128.25], EntityPlayerSP['Player533'/182, l='MpServer', x=-197.16, y=64.00, z=-153.33], EntitySkeleton['Skeleton'/67, l='MpServer', x=-248.69, y=11.00, z=-157.88], EntityCreeper['Creeper'/76, l='MpServer', x=-229.41, y=21.00, z=-193.13], EntityItem['item.item.rottenFlesh'/78, l='MpServer', x=-231.69, y=72.00, z=-182.75], EntityZombie['Zombie'/79, l='MpServer', x=-239.47, y=25.00, z=-172.06], EntitySquid['Squid'/72, l='MpServer', x=-251.16, y=50.59, z=-136.09], EntitySquid['Squid'/73, l='MpServer', x=-244.97, y=61.75, z=-94.31], EntitySkeleton['Skeleton'/87, l='MpServer', x=-219.66, y=24.00, z=-194.91], EntityZombie['Zombie'/81, l='MpServer', x=-229.53, y=21.00, z=-158.72], EntityZombie['Zombie'/80, l='MpServer', x=-235.19, y=20.00, z=-167.31], EntityCreeper['Creeper'/82, l='MpServer', x=-232.50, y=22.00, z=-82.50], EntitySkeleton['Skeleton'/93, l='MpServer', x=-210.16, y=18.00, z=-114.53], EntityZombie['Zombie'/92, l='MpServer', x=-215.56, y=18.00, z=-116.50], EntitySquid['Squid'/94, l='MpServer', x=-215.16, y=61.56, z=-120.56], EntityCreeper['Creeper'/89, l='MpServer', x=-212.00, y=28.00, z=-167.41], EntityCreeper['Creeper'/88, l='MpServer', x=-215.50, y=25.00, z=-198.50], EntitySquid['Squid'/91, l='MpServer', x=-212.45, y=61.70, z=-137.12], EntityBat['Bat'/90, l='MpServer', x=-203.94, y=17.06, z=-136.03], EntityBat['Bat'/102, l='MpServer', x=-204.69, y=52.10, z=-175.34], EntityBat['Bat'/103, l='MpServer', x=-204.09, y=52.10, z=-173.47], EntityCreeper['Creeper'/100, l='MpServer', x=-197.31, y=54.00, z=-218.97], EntitySkeleton['Skeleton'/101, l='MpServer', x=-207.78, y=27.00, z=-191.84], EntityCreeper['Creeper'/99, l='MpServer', x=-194.22, y=52.00, z=-225.97], EntityZombie['Zombie'/108, l='MpServer', x=-197.50, y=18.00, z=-121.50], EntityBat['Bat'/377, l='MpServer', x=-251.47, y=33.10, z=-186.08], EntityBat['Bat'/106, l='MpServer', x=-196.19, y=17.69, z=-142.81], EntitySkeleton['Skeleton'/107, l='MpServer', x=-194.50, y=29.00, z=-120.50], EntityBat['Bat'/104, l='MpServer', x=-204.13, y=52.10, z=-174.94], EntitySquid['Squid'/119, l='MpServer', x=-170.91, y=57.31, z=-91.59], EntitySkeleton['Skeleton'/118, l='MpServer', x=-184.09, y=18.00, z=-109.72], EntityZombie['Zombie'/117, l='MpServer', x=-181.72, y=14.00, z=-110.28], EntityBat['Bat'/116, l='MpServer', x=-180.31, y=56.91, z=-182.56], EntityBat['Bat'/115, l='MpServer', x=-183.81, y=56.75, z=-180.25], EntityBat['Bat'/114, l='MpServer', x=-187.78, y=56.00, z=-181.56], EntityBat['Bat'/113, l='MpServer', x=-186.16, y=58.10, z=-181.44], EntityBat['Bat'/112, l='MpServer', x=-185.13, y=26.00, z=-198.31]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:383) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2645) at net.minecraft.client.Minecraft.run(Minecraft.java:401) at net.minecraft.client.main.Main.main(Main.java:116) 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:135) 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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Mac OS X (x86_64) version 10.11.3 Java Version: 1.7.0_80, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 733602128 bytes (699 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP 9.19 Powered by Forge 11.15.1.1756 5 mods loaded, 5 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.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1756.jar) UCHIJAAAA Forge{11.15.1.1756} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1756.jar) UCHIJAAAA examplemod{1.0} [Example Mod] (bin) UCHIJAAAA ljonesmodding{1.0} [ljonesCustomMods] (bin) Loaded coremods (and transformers): Launched Version: 1.8.9 LWJGL: 2.9.2 OpenGL: Intel HD Graphics 4000 OpenGL Engine GL version 2.1 INTEL-10.12.13, Intel Inc. GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because ARB_framebuffer_object is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: No 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) CPU: 4x Intel® Core i7-3667U CPU @ 2.00GHz
  5. Thanks guys for your help. I refactored the code to be cleaner (like you guys suggested) and it compiled and my Items are still showing the proper textures. However I am getting a "java.lang.NullPointerException: Rendering screen" whenever I try to create the "custom" food item from a recipe. I can do a /give .. and can get the item without a problem, it just crashes whenever I try to "addRecipe it" Thanks
  6. When ever I create a custom item and then try to create it on the crafting table, it will be created with name: item.null.name and the texture (image is not rendered). -it renders with just the standard "purple/black" cube But if I do a \give [player] [modid}:item, the proper image and name appears correctly on the quick bar My pre-init function @EventHandler public void preInit(FMLPreInitializationEvent event) { /*THIS IS FINE, REGISTERING OUR ITEM */ ItemKey.init(); ItemKey.register(); /*Initialize our food item */ berry = new ItemBerry(3,0.3F,true); ItemBerry.init(); ItemBerry.register(); } ******************************************************************************** The init function's recipe method & register render, both in the init function in my main class: The code for the recipe: //the custom berry was created without a crash, but I lost the item.name abd textures GameRegistry.addRecipe(new ItemStack(berry, 4), new Object[]{ "A", "A", "A", 'A', Items.apple }); also, the code to register the render: //code for initializing your custom items - this goes in your post-init class if(event.getSide() == Side.CLIENT) { /*THIS IS WHERE THE PROBLEM STILL EXISTS WITH REGISTERING THE RENDERS */ ItemKey.registerRenders(); //register my food item ItemBerry.registerRenders(); } ************************************************************************************ The code for the berry class: package com.lionel.ljonesmodding; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraftforge.fml.common.registry.GameRegistry; public class ItemBerry extends ItemFood{ public static Item berry; public ItemBerry(int amount, float saturation, boolean wolfFood) { super(amount,saturation,wolfFood); setCreativeTab(CreativeTabs.tabMisc); } public static void init() { berry = new Item().setUnlocalizedName("berry"); } public static void register() { GameRegistry.registerItem(berry,"berry"); } public static void registerRenders() { registerRender(berry); } public static void registerRender(Item myitem) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(myitem, 0, new ModelResourceLocation("ljonesmodding" + ":" + myitem.getUnlocalizedName().substring(5), "inventory")); } }
×
×
  • Create New...

Important Information

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