Everything posted by kwpugh
-
[1.14.2] How to add custom food items
I think I understand, but let me run through it. I declare a method to setup the food item in my FoodList.java: public static Food gooFood = (new Food.Builder()).hunger(4).saturation(0.6F).build(); Then I setup an item in my ItemList.java: public static Item gobber2_goo; Lastly, I setup a line to register the item in my main class, Gobber2.java and pass it the food properties: ItemList.gobber2_goo = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_goo")).food(FoodList.gooFood) At which point, I get an error saying "The method food(Food) is undefined for the type Item" In referencing the Minecraft Item.class, I reviewed this section, which appears to list the available Item.Properties: public Item(Item.Properties properties) { this.addPropertyOverride(new ResourceLocation("lefthanded"), LEFTHANDED_GETTER); this.addPropertyOverride(new ResourceLocation("cooldown"), COOLDOWN_GETTER); this.addPropertyOverride(new ResourceLocation("custom_model_data"), MODELDATA_GETTER); this.group = properties.group; this.rarity = properties.rarity; this.containerItem = properties.containerItem; this.maxDamage = properties.maxDamage; this.maxStackSize = properties.maxStackSize; this.food = properties.food; if (this.maxDamage > 0) { this.addPropertyOverride(new ResourceLocation("damaged"), DAMAGED_GETTER); this.addPropertyOverride(new ResourceLocation("damage"), DAMAGE_GETTER); } this.canRepair = properties.canRepair; this.toolClasses.putAll(properties.toolClasses); Object tmp = properties.teisr == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, properties.teisr); this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp; If I am reading correctly, .food is a valid property for type Item. So, I must have something else goofed up. The last one mentioned in the main class, Gobber2.java looks like this: @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.gobber2_goo = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_goo")).food(FoodList.gooFood), ); logger.info("Items registered."); }
-
[1.14.2] How to add custom food items
ah yes, I have been reading through the reference libraries to try to figure out how things work. So, would it be formed something like this: ItemList.gobber2_goo = new Food(new Item.Properties().group(gobber2), "gobber2_foo").value(4).saturation(0.6F).build() But it seems the Item.Properties works with that. Is that what the Food.Builder is for?
-
[1.14.2] How to add custom food items
In Eclipse, I get an error "ItemFood cannot be resolved to a type", which makes sense that the class got renamed. I then change the ItemFood reference to Food as seen below: ItemList.gobber2_goo = new Food(8, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_goo")), ItemList.gobber2_gooey_bread = new Food(9, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_gooey_bread")), Eclipse gives the error "Food cannot be resolved to a type". I take the suggested fix to "import 'Food' (net.minecraft.item)". Eclipse then gives the error "The constructor Food(int, int, boolean, Item.Properties) is undefined". I'm stuck there.
-
[1.14.2] How to add custom food items
Hi, Here is the full main class: https://gist.github.com/kwpugh/3a0d58b3b188b0af08389de69f81c7e0 and here is ItemList class: https://gist.github.com/kwpugh/a4e40ee1231ba6807d75071da593569d Hopefully that helps. Regards.
-
[1.14.2] How to add custom food items
Hi, Looking for some guidance . I had ported some of my mod from 1.12.2 -> 1.13.2 which worked, but the food items do not work moving from 1.13.2 -> 1.14.2. Here is what I had in 1.13.2 in my main class: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll { ItemList.gobber2_goo = new ItemFood(8, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_goo")), ItemList.gobber2_gooey_bread = new ItemFood(9, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_gooey_bread")) ); logger.info("Items registered."); } Since I am quite new to programming, if the above was the incorrect way to do it, feedback is welcome. I saw that ItemFood changed to Food, but am unclear how to properly form the registration. Here is the ItemList class: public class ItemList { public static Item gobber2_goo; public static Item gobber2_gooey_bread; } Any guidance would be appreciated. Regards
-
[1.14.2] Trouble with onArmorTick
Thanks, I figured it out.
-
[1.14.2] Trouble with onArmorTick
Hi, Looking for some help with this. package com.kwpugh.gobber2.items.armor; import com.kwpugh.gobber2.lists.ItemList; import net.minecraft.entity.LivingEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.IArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemCustomBoots extends ArmorItem { public ItemCustomBoots(IArmorMaterial materialIn, EquipmentSlotType slots, Properties builder) { super(materialIn, slots, builder); } public void onArmorTick(World world, LivingEntity entity, ItemStack itemStack) { ItemStack boots = entity.getItemStackFromSlot(EquipmentSlotType.FEET); if(boots.getItem() == ItemList.gobber2_boots) { entity.stepHeight = 3.0F; } else { entity.stepHeight = 0.0F; } } } The step height does not appear to be kicking in, any suggestions to what I am doing wrong? I thought you normally have to @Override it, but that creates an error: "The method onArmorTick(World, LivingEntity, ItemStack) of type ItemCustomBoots must override or implement a supertype method" Thank you in advance.
-
[1.14.2] :runclient doesnt work
Ok, I found I had the wrong value for the loaderVersion in mods.toml file. Changed it from 24 to 25 and launching works. loaderVersion="[25,)" #mandatory (24 is current forge version)
-
[1.14.2] :runclient doesnt work
I'm getting this as well using runClient and trying to launch the client from the Mojang launcher (forged) without any other mods added. ---- Minecraft Crash Report ---- // You're mean. Time: 6/9/19 9:31 AM Description: Rendering screen java.lang.NullPointerException: Rendering screen at net.minecraftforge.fml.ModList.size(ModList.java:164) ~[?:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraftforge.fml.BrandingControl.computeBranding(BrandingControl.java:59) ~[?:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraftforge.fml.BrandingControl.getBrandings(BrandingControl.java:68) ~[?:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraftforge.fml.BrandingControl.forEachLine(BrandingControl.java:77) ~[?:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.MainMenuScreen.render(MainMenuScreen.java:248) ~[?:?] {pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:358) ~[?:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:554) ~[?:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:898) ~[?:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:384) ~[?:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(SourceFile:154) ~[1.14.2-forge-26.0.12.jar:?] {pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.14.2-26.0.12.jar:26.0] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraftforge.fml.ModList.size(ModList.java:164) at net.minecraftforge.fml.BrandingControl.computeBranding(BrandingControl.java:59) at net.minecraftforge.fml.BrandingControl.getBrandings(BrandingControl.java:68) at net.minecraftforge.fml.BrandingControl.forEachLine(BrandingControl.java:77) at net.minecraft.client.gui.screen.MainMenuScreen.render(MainMenuScreen.java:248) at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:358) -- Screen render details -- Details: Screen name: net.minecraft.client.gui.screen.MainMenuScreen Mouse location: Scaled: (0, 0). Absolute: (0.000000, 0.000000) Screen size: Scaled: (570, 320). Absolute: (1708, 960). Scale factor of 3.000000 Stacktrace: at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:554) at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:898) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:384) at net.minecraft.client.main.Main.main(SourceFile:154) 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:498) at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) -- System Details -- Details: Minecraft Version: 1.14.2 Operating System: Mac OS X (x86_64) version 10.14.5 Java Version: 1.8.0_74, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1364859008 bytes (1301 MB) / 2147483648 bytes (2048 MB) up to 2147483648 bytes (2048 MB) JVM Flags: 8 total; -Xss1M -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M FML: New FML! Loaded coremods (and transformers): Nothing Launched Version: 1.14.2-forge-26.0.12 LWJGL: 3.2.1 build 12 OpenGL: AMD Radeon Pro 560 OpenGL Engine GL version 2.1 ATI-2.9.26, ATI Technologies 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: Yes Is Modded: Definitely; Client brand changed to 'forge' Type: Client (map_client.txt) Resource Packs: mod:xaerominimap, mod:forge, vanilla Current Language: English (US) CPU: 8x Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
-
1.10.2 Server crash
Crash report: http://pastebin.com/raw/b2VMwWEL This crash has been happening once or twice a day since the upgrade to Forge 2046. It does not point to any specific mod (that I can see). I need some expert help trying figure this one out. Regards
IPS spam blocked by CleanTalk.