Jump to content

Armadelix

Members
  • Posts

    20
  • Joined

  • Last visited

Armadelix's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Well, what I was referring to is Forge compatibility with 1.14.4 but was wrong about that too. is Forge for 1.14.4 considered stable? probably it would be better off for me if so. It was just a simple idea of a process to what I want to achieve but nevermind I guess.
  2. Not really a desired option as I want to work with Forge and that's not quite possible at the moment. I thought of a different approach, instead of messing with explosion logic directly. Explosion occurs(to its fullest and a block "pickup" is dropped) -> Get explosion coords -> Perform proximity check on its coords -> Find which block "pickups" are in that proximity -> Clear them out and have desired item(s) "pickup" placed there instead So a couple of questions: 1) Is it possible to get coordinates of an explosion? 2) Is it possible to perform a "proximity check" that gets which block "pickup" entities are in it? Thanks!
  3. The only practice I see viable as of now is subscribing to ExplosionEvent.Detonate and using : List<BlockPos> affectedBlocks = event.getAffectedBlocks(); A little struggling to understand how I can use it at the moment, as I am still learning.
  4. Can I somehow write into this boolean? make it false somehow?
  5. Fantastic! I did not understand it that well at first, but after you've referred me there again, I understood how to do that and it now works! Also added a guaranteed check for harvesting,randomizing amount up to 9 and another instance for the block check, so it covers the grass block as well. package com.hcmod.hardcoremod.init; import java.util.Random; import com.hcmod.hardcoremod.Reference; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; @Mod.EventBusSubscriber(modid=Reference.MODID) public class HCHarvest { @SubscribeEvent public void onHarvestDirt(HarvestDropsEvent event) { Random rnd = new Random(); int qty = 0; if (event.getHarvester() != null) //Checks if the player is performing harvest { if (event.getState().getBlock() == Blocks.DIRT || event.getState().getBlock() == Blocks.GRASS) //Note to self - Probably does not apply for all conditions of attaining a dirt block { qty = rnd.nextInt(9); event.getDrops().clear(); //Note to self - check if its the proper method to clear out default harvest drop event.getDrops().add(new ItemStack(ModItems.dirthandfulItem, qty)); //Note to self - check how to make the quantity randomize } } } } To actually register it I have added this line under Init: MinecraftForge.EVENT_BUS.register(new HCHarvest()); (I am writing my steps/results for those who are also willing to learn, I try to learn more through posts like these but I rarely find what I am looking for) I would like to know, is it possible to handle the event which drops the block on explosion?
  6. As I have already said, I am new to all this and not too sure of "what and how". I would like to make the dirt block yield exclusively dirt ball(s), so I did the following: package com.hcmod.hardcoremod.init; import com.hcmod.hardcoremod.Reference; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; public class HCHarvest { @SubscribeEvent public void onHarvestDirt(HarvestDropsEvent event) { if (event.getState().getBlock() == Blocks.DIRT) //Note to self - Probably does not apply for all conditions of attaining a dirt block { event.getDrops().clear(); //Note to self - check if its the proper method to clear out default harvest drop event.getDrops().add(new ItemStack(ModItems.dirthandfulItem, 1)); //Note to self - check how to make the quantity randomize } } } Several questions... 1) How do I get this to initialize? I tried adding to this class file the following: public static void init() { } and to call it under preInit using "HCHarvest.init();" in the main class file but it didn't work. 2) Is this the proper way of doing what I want to achieve? 3) What are the different types of events in which a block breaks and drops something(excluding HarvestDropsEvent)? Thanks.
  7. Ah *facepalm*, curly brackets and semicolons are the programming beginner's nightmare. This is it, this is the final thing that has been missing - the item now appears properly in-game. For some reason while editing the JSON file I expected Eclipse to point out my errors just like when working on regular code, I'll keep that in mind now!! Thank you very much for the help!!!
  8. As of now, only a single .json is used for this mod. This .json is a direct copy of the 'Clay Ball' item in the game with some editing in its text values via Eclipse. This is the content of it: { "parent": "item/generated", "textures": { "texture": "hcmod:items/dirt_ball" "layer0": "hcmod:items/dirt_ball" } I saw in several tutorials that only layer0 is used, but today I also added texture as an attempt to troubleshoot this problem. Any idea what I could be doing wrong?
  9. I have changed the "models" package from: assets.hcmod.models.items to assets.hcmod.models.item There still is the same type of mode/texture (visual) error of the item, however the log indicates on a different issue: [21:22:11] [main/ERROR] [FML]: Exception loading model for variant hcmod:dirt_ball#inventory for item "hcmod:dirt_ball", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model hcmod:item/dirt_ball with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:302) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 5 column 10 path $.textures.texture at com.google.gson.internal.Streams.parse(Streams.java:60) ~[Streams.class:?] at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65) ~[TreeTypeAdapter.class:?] at net.minecraft.util.JsonUtils.gsonDeserialize(JsonUtils.java:435) ~[JsonUtils.class:?] at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:51) ~[ModelBlock.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:338) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 5 column 10 path $.textures.texture at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414) ~[JsonReader.class:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:738) ~[TypeAdapters$29.class:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[TypeAdapters$29.class:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714) ~[TypeAdapters$29.class:?] at com.google.gson.internal.Streams.parse(Streams.java:48) ~[Streams.class:?] at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65) ~[TreeTypeAdapter.class:?] at net.minecraft.util.JsonUtils.gsonDeserialize(JsonUtils.java:435) ~[JsonUtils.class:?] at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:51) ~[ModelBlock.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:338) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more [21:22:11] [main/ERROR] [FML]: Exception loading model for variant hcmod:dirt_ball#inventory for item "hcmod:dirt_ball", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model hcmod:dirt_ball#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] Aren't variants are supposed to defined? because I did not define for the item to have variants.. Same for the blockstates, this is quite weird...
  10. Isn't it also meant to be items?? you have corrected me on that already.
  11. I did go over that log, but I couldn't understand what exactly the culprit is. Tbh, kind of losing my mind as the said .json file exists, the path/packaging is: src/main/resources/assets/hcmod/models/items/dirt_ball.json What I find weird is that the log message reads item and not items as part of the file path, I also tried to change items to item and the outcome is the same. Could it be that the .json file itself is not accessible by the game for some reason?
  12. I am not too familiar with Github, can I just post sections of the code? This is from the debug log: [20:11:12] [main/ERROR] [FML]: Exception loading model for variant hcmod:dirt_ball#inventory for item "hcmod:dirt_ball", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model hcmod:item/dirt_ball with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:302) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.io.FileNotFoundException: hcmod:models/item/dirt_ball.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more [20:11:12] [main/ERROR] [FML]: Exception loading model for variant hcmod:dirt_ball#inventory for item "hcmod:dirt_ball", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model hcmod:dirt_ball#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
  13. I did change item to items in the packages' label so that I have: Also made sure to check that these paths are actually that way, and they are. Normally, will the game actually log texture issues like this one into somewhere? (When running just fine without crashes) I have already acknowledged this, still thanks for the heads up!
  14. Oopsie, I overlooked the s... I want to try to make Minecraft a bit more challenging, supposedly more 'Hardcore' hence the abbreviation 'hc'. To be honest, I did not put much thought to this bit and did not know that using hc as my mod's ID could be troublesome. Thank you very much for your help! I will be using hcmod temporarily as the mod's ID until I come up with a better name for the mod, I have corrected the relevant lines of code but the issues still persists, though in a different manner... It still appears to have its texture missing but with the inscription hcmod:dirt_ball#inventory fixed to it. So what am I doing wrong now?
  15. Thank you very much! That was just too simple that it makes me feel a bit stupid... Thank you once again, went over the code a couple of more times and I think I finally got the hang of it. However, I am having an issue at the moment - after a lot of troubleshoot attempts I am getting quite helpless... I simply copied the .json and texture of the Clay Ball(clay_ball) and edited them accordingly to be a Dirt Ball. I just can't get the item to appear the way I intend to, it shows up as a 2D square with a missing texture... I hope you could help me out on this one as well: @Mod.EventBusSubscriber(modid=Reference.MODID) public class ModItems { static Item dirthandfulItem; public static void init() { dirthandfulItem = new ItemDirtHandful("dirt_ball"); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(dirthandfulItem); } @SubscribeEvent public static void registerRenders(ModelRegistryEvent event) { registerRender(dirthandfulItem); } private static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation( item.getRegistryName(), "inventory")); } } MODID is hc , the relevant .json and .png files are labled dirt_ball Packaging: assets.hc.models.item assets.hc.textures.item { "parent": "item/generated", "textures": { "layer0": "hc:items/dirt_ball" } }
×
×
  • Create New...

Important Information

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