Jump to content

JimiIT92

Members
  • Posts

    866
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JimiIT92

  1. I'm making custom doors in my mod and I noticed something odd. I've added my door to the needs_iron_tool tag and the mineable/pickaxe tag, both inside the minecraft namespace (although I don't think the namespace matters). But, when I mine the door with a wooden or stone pickaxe, I still get the drop. I've then tried to do the same with the vanilla Iron Door, adding it to the iron_tools tag as well, and sure enough I stil get the drop. The function isCorrectToolFroDrops inside the DiggerItem class is returning false when trying to mine my door with a lower tier pickaxe, so I really don't know why it gets ignored. I have other blocks in that tags as well and they all function as expected (drops when using iron or above tier pickaxe, no drop when using stone or wood pickaxe). Just for context this is how I register my custom door BLOCKS_REGISTRY.register("golden_door", () -> new DoorBlock(BlockBehaviour.Properties.copy(Blocks.IRON_DOOR), BlockSetType.GOLD)); Then, inside the minecraft/tags/blocks/mineable/pickaxe.json and minecraft/tags/blocks/needs_iron_tool.json I have this { "replace": false, "values": [ "mineworld:golden_door" ] } If you need more context I've everything available on GitHub Here is where I register the door: https://github.com/JimiIT92/MineWorld/blob/ab04acfee10569f2339f9877fddd95b58e34336a/src/main/java/org/mineworld/core/MWBlocks.java#L263 While here you can find the block tags: https://github.com/JimiIT92/MineWorld/tree/master/src/main/resources/data/minecraft/tags/blocks
  2. It looks like your model has a property called serpyan:storage, which isn't in the blockstate file. Show your block class as well so we can see what's going on
  3. I don't know if you can change the vanilla behavior, never thought about this. However one quick way I can think of is to create your own custom book item that defines how many pages or character per page to have, and of course create the GUI accordingly
  4. I'm creating some custom armors, and in doing so I'm also creating the corresponding armor materials. Now, when I created the tools and their materials I used the ForgeTier constructor to create a material, like so ForgeTier myTier = new ForgeTier(level, uses, speed, attackDamage, enchantmentValue, tag, repairIngredient); But now, for armors, I can't seem to find anything similar, so I'm just writing my own copy of the vanilla ArmorMaterial enum, which works but I'm curious to know if there's a way to avoid this like for tool materials. And if not why hasn't Forge provided this?
  5. Show the updated code. Please use the appropriate code tag (is the < > symbol in the post toolbar)
  6. Surprisingly I don't have any warning in the log, nor when I apply the material or wear the armor with the trim material (i looked for "ruby" inside the log and found nothing. The console also shows no warning/error while running and applying the trim). Anyway, adding the two files under assets/minecraft/atlases make the trim shows up inside the armor model. It still doesn't show inside the item, but I think is because I need an item model file too for that if I understand correctly. Now, while this works, I don't like this approach, since you have to rewrite mostly of the atlas file. Specifically you need to specify all the different textures, which lead to the mod's trim being incompatible with other mods that may be adding custom trim patterns. I guess I'll wait the full release of 1.20 to see what changes this feature gets and whether a proper implementation will be supplied by Forge, unless there's a way to "attach" values to the existing atlas without partially rewrite it. The two files I ended up with are the followings assets/minecraft/atlases/armor_trims.json { "sources": [ { "type": "paletted_permutations", "textures": [ "trims/models/armor/coast", "trims/models/armor/coast_leggings", "trims/models/armor/sentry", "trims/models/armor/sentry_leggings", "trims/models/armor/dune", "trims/models/armor/dune_leggings", "trims/models/armor/wild", "trims/models/armor/wild_leggings", "trims/models/armor/ward", "trims/models/armor/ward_leggings", "trims/models/armor/eye", "trims/models/armor/eye_leggings", "trims/models/armor/vex", "trims/models/armor/vex_leggings", "trims/models/armor/tide", "trims/models/armor/tide_leggings", "trims/models/armor/snout", "trims/models/armor/snout_leggings", "trims/models/armor/rib", "trims/models/armor/rib_leggings", "trims/models/armor/spire", "trims/models/armor/spire_leggings", "trims/models/armor/wayfinder", "trims/models/armor/wayfinder_leggings", "trims/models/armor/shaper", "trims/models/armor/shaper_leggings", "trims/models/armor/silence", "trims/models/armor/silence_leggings", "trims/models/armor/raiser", "trims/models/armor/raiser_leggings", "trims/models/armor/host", "trims/models/armor/host_leggings" ], "palette_key": "trims/color_palettes/trim_palette", "permutations": { "ruby": "mineworld:trims/color_palettes/ruby" } } ] } assets/minecraft/atlases/blocks.json { "sources": [ { "type": "paletted_permutations", "textures": [ "trims/items/leggings_trim", "trims/items/chestplate_trim", "trims/items/helmet_trim", "trims/items/boots_trim" ], "palette_key": "trims/color_palettes/trim_palette", "permutations": { "ruby": "mineworld:trims/color_palettes/ruby" } } ] } For the Item I've also added the model override files, but it falls back to the diamond trim. I found this guide also explaining how to add those trims (https://misode.github.io/guides/custom-armor-trims/#adding-a-custom-trim-material), and even there it mentions this fallback, so it may be that it still doesn't work properly? I guess
  7. You need to change the value of this variable to be one of type ExplosionInteraction
  8. Yeah, I've just edited the post since I found out that the trim_material json file was in the wrong location. All I got now is a rendering issue, but looking through the vanilla files I have no clue what it also missing. As for the code you can find it here: https://github.com/JimiIT92/MineWorld
  9. Well.... seems pretty obvious: you are passing a BlockInteraction object to a method that accepts an ExplosionInteraction object. You should set one of the followings: ExplosionInteraction.BLOCK ExplosionInteraction.MOB ExplosionInteraction.TNT ExplosionInteraction.NONE TNT is what is getting used by, well... TNT. The other 3 values I'm not sure what they does, but you can play with them and see what fits your need
  10. I'm trying to add a custom trimming material using one of my mod items. However when I load a world I get this error [23:06:47] [Render thread/ERROR] [minecraft/ArmorTrim]: Failed to get element ResourceKey[minecraft:trim_material / mineworld:ruby] So far I've registered my new material like this public static final ResourceKey<TrimMaterial> RUBY = ResourceKey.create(Registries.TRIM_MATERIAL, new ResourceLocation("mineworld", "ruby")); public static void bootstrap(BootstapContext<TrimMaterial> context) { TrimMaterial trimmaterial = TrimMaterial.create( RUBY.location().getPath(), MWItems.RUBY.get(), 0.85F, Component.translatable(Util.makeDescriptionId("trim_material", RUBY.location())).withStyle(Style.EMPTY.withColor(0x9F3535)), Map.of()); context.register(resourceKey, trimmaterial); } I've then created the file `data/mineworld/trim_material/ruby.json` like so { "asset_name": "ruby", "description": { "color": "#9F3535", "translate": "trim_material.mineworld.ruby" }, "ingredient": "mineworld:ruby", "item_model_index": 0.85 } And referenced the new trim in `data/minecraft/tags/items/trim_materials.json` { "replace": false, "values": [ "mineworld:ruby" ] } I've also added the color palette texture inside `assets/mineworld/textures/trims/color_palettes/ruby.png` Do I need to specify something else in order for this to work? EDIT: The item texture uses an incorrect color (it should be red), while the model texture shows the black/purple texture
  11. Yeah, maybe that would break things... Will try at some point to do so to see if I can add this. Meanwhile what I've tried is to listen to the event, check the ingredients and if they matches two items for a custom recipe I set the output of the event to the desired result. However for some reason I see the output but can't pick up from the anvil
  12. I'm trying to create a custom anvil recipe, to make so when you combine two items you get a new one (kinda like the pre 1.20 smithing table recipe system, but for the anvil). So I was curious to see if there is a way to make the recipe like usual, with a json file specifying the recipe type. Apparently there's currently no way of doing this (at least in vanilla Minecraft), so I'm wondering how can you create such recipes? Is there a custom forge recipe type that you can use? Or you have to rely on the AnvilUpdateEvent only?
  13. Marking this as solved, the issue has been fixed (tested with the current latest build 45.0.39, but I think it has been fixed since 45.0.30)
  14. I did these steps: From IntellJ > File > Invalidate caches. Checked all checkboxes and restart the IDE After I opened up the Forge project and let the indexing going on. When the indexing stops I ran the setup task and then the genIntellijRuns task. Finally I ran the forge_test_client task, but still got the issue Don't really know what could it be, I even tried deleting the whole .gradle folder from my pc, just in case something was left from the invalidate cache process, but still no luck
  15. Quick update on this. I tried to setup Forge locally to made the change myself, but ran into some issues described here (which I hope to fix, so any help would be much appreciated). So I did something different: I cloned the MutableHashedLinkedMap inside my project and then "clone" the vanilla map entries to my object. Inside my object I removed the null assignments and that seems to fix the issue. If I remove all paintings and then iterate over the leftover entries the breakpoint inside the check for a painting is never hit, which is what I expect. If I apply a filter to exclude only the modded variants, the breakpoint is hit only for the vanilla ones. So it seems that is just that null assignments on both previous and next that breaks the iterator. This is how I debugged using my own local class if(tab.equals(CreativeModeTabs.FUNCTIONAL_BLOCKS)) { org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility> test = new org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility>(ItemStackLinkedSet.TYPE_AND_TAG); event.getEntries().forEach(entry -> test.put(entry.getKey(), entry.getValue())); var iterator = test.iterator(); ArrayList<ItemStack> itemsToRemove = new ArrayList<>(); while (iterator.hasNext()) { ItemStack stack = iterator.next().getKey(); if(stack.is(Items.PAINTING)) { itemsToRemove.add(stack); } } itemsToRemove.forEach(test::remove); var iterator2 = test.iterator(); while (iterator2.hasNext()) { ItemStack stack = iterator2.next().getKey(); if(stack.is(Items.PAINTING)) { LOG.info(stack + " " + stack.getOrCreateTag()); } } } I'm submitting a PR now that I know that removing those null assignments fixes this, hopefully that's really what it needs to solve it
  16. I'm trying to setup a local Forge workspace to work on an issue I found recently (https://github.com/MinecraftForge/MinecraftForge/issues/9426) So I've forked the Forge repo, followed all the steps described in the documentation (https://docs.minecraftforge.net/en/latest/forgedev/) and run the forge_client task. However when I do this I get this error Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:32) ... Caused by: java.lang.ClassNotFoundException: net.minecraftforge.logging.CrashReportExtender Am I missing some step? If I run the "clean_client" task it opens up the client just fine (but can't debug forge since it appears to not be loaded). I've also noticed that there are some small test mods inside the test folder, which would be perfect to run and debug for my use case, but I can't find any documentation about how to debug these mods, so how can I do this?
  17. Sure, the only difference is that I'm now passing the previous tab to the method I use to register all my tabs. So now I have this BUILDING_BLOCKS = registerTab(event, "building_blocks", CreativeModeTabs.SPAWN_EGGS, () -> new ItemStack(BLBlocks.RUBY_BLOCK.get())); COLORED_BLOCKS = registerTab(event, "colored_blocks", BUILDING_BLOCKS,() -> new ItemStack(BLBlocks.YELLOW_CONCRETE_STAIRS.get())); NATURAL = registerTab(event, "natural", COLORED_BLOCKS, () -> new ItemStack(BLBlocks.HOLLOW_BIRCH_LOG.get())); FUNCTIONAL = registerTab(event, "functional", NATURAL, () -> new ItemStack(Items.PAINTING)); REDSTONE = registerTab(event, "redstone", FUNCTIONAL, () -> new ItemStack(BLBlocks.COPPER_BUTTON.get())); TOOLS = registerTab(event, "tools", REDSTONE, () -> new ItemStack(BLItems.EMERALD_PICKAXE.get())); COMBAT = registerTab(event, "combat", TOOLS, () -> new ItemStack(BLItems.KATANA.get())); FOOD_AND_DRINK = registerTab(event, "food_and_drink", COMBAT, () -> new ItemStack(BLItems.SASHIMI.get())); INGREDIENTS = registerTab(event, "ingredients", FOOD_AND_DRINK, () -> new ItemStack(BLItems.RUBY.get())); SPAWN_EGGS = registerTab(event, "spawn_eggs", INGREDIENTS, () -> new ItemStack(BLItems.COPPER_GOLEM_SPAWN_EGG.get())); where I pass the previous tab to all the registerTab methods. So my register tab method now simply adds the provided the tab to the "afterTab" list parameter provided to the registerCreativeModeTab function private static CreativeModeTab registerTab(CreativeModeTabEvent.Register event, String name, CreativeModeTab afterTab, Supplier<ItemStack> iconSupplier) { return event.registerCreativeModeTab(new ResourceLocation(BlazersMod.MOD_ID, name), List.of(), List.of(afterTab), builder -> builder .icon(iconSupplier) .title(Component.translatable("itemGroup." + BlazersMod.MOD_ID + "." + name)) .build()); } It would be cool if the ordering was automatic like it was before, but I guess is not the end of the world to provide an extra parameter 😅
  18. If I inspect the entries after my removal I get these results 1 painting {} 1 painting {EntityTag:{variant:"minecraft:kebab"}} 1 painting {EntityTag:{variant:"minecraft:aztec"}} 1 painting {EntityTag:{variant:"minecraft:alban"}} 1 painting {EntityTag:{variant:"minecraft:aztec2"}} 1 painting {EntityTag:{variant:"minecraft:bomb"}} 1 painting {EntityTag:{variant:"minecraft:plant"}} 1 painting {EntityTag:{variant:"minecraft:wasteland"}} 1 painting {EntityTag:{variant:"blazersmod:ebl_cheer"}} with the last one being one of my mod's variants. I'm trying to dig into the remove function and a red flag I'm noticing is in MutableHashedLinkMap on line 249. There is a null check on entry.previous with a comment "Should never be null". What I've noticed is that the first time it executes this code the check passes (entry.previous is not null), however the second time it does fail (entry.previous is null). Now I've temporarly removed my paintings from the "placeable" tag, which causes them to be added to the creative inventory, and inside the event I'm also removing every painting from the tab, so I'm effectively running the code you posted above and indee in game I only have the "kebab" painting which also breaks the rest of the tab. Moving on with the remove, the first execution is trying to remove the default painting (the one with a random variant). When entering the remove function, entry.previous corresponds to the Glow Item Frame, while entry.next corresponds to the "kebab" painting. So entry.previous.next become the "kebab" painting while entry.previous become null (why setting the first value if we are setting the parent to null anyway?). After that, on line 257, there is another check o nentry.next, which in this case is the "kebab" painting. Here something similar happens: the entry.next.previous value is set to entry.previous, which we just set it to null, and entry.next is set to null (again, we are setting the parent to null anyway) That concludes the first iteration. On second iteration the code is trying to remove the "kebab" painting variant. When hitting the remove function this happens: entry.previous is now null, so the first check fails, but entry.next is not null (it is the "aztec" painting variant), so entry.next.previous is set to the value of entry.previous (which is null), while entry.next is set to null directly This goes on for all consecutive variants, and I assume it also accounts for the modded ones. Not sure if that's helpful since I'm not totally sure what's going on here, but maybe the first null set is what's causing the issue (which causes susequent checks to fail)
  19. I think OP is referring to a custom Recipe Type implementation, not a custom recipe for an Item. In that case you can see/extend the ShapedRecipe class to check which logic you need to apply in your own class
  20. The entries iterator does not support the remove operation (you get an UnsupportedOperationException). What I tried is storing the keys (the ItemStacks) I want to remove in a separate list and then iterate over that list to remove the stack from the entries var iterator = event.getEntries().iterator(); ArrayList<ItemStack> itemsToRemove = new ArrayList<>(); while (iterator.hasNext()) { var entry = iterator.next(); if(isEblPainting(entry.getKey())) { itemsToRemove.add(entry.getKey()); } } itemsToRemove.forEach(stack -> event.getEntries().remove(stack)); However that seems to break the iterator too for some reason
  21. Ok, so I did this if(tab.equals(CreativeModeTabs.FUNCTIONAL_BLOCKS)) { event.getEntries().forEach(stack -> { ItemStack itemStack = stack.getKey(); if(isEblPainting(itemStack)) { event.getEntries().remove(itemStack); } }); } to remove entries from the map if they met the criteria. What I'm getting now is that the creative tab gets cut off at some point, with the last painting variant being one of the excluded ones If I try to remove all paintings from the tab (so changing the condition to itemStack.is(Items.PAINTING) ) I get a similar result where the tab gets cut off and a single painting still remains as the last Item. This doesn't happen if I remove another Item (for example the Lightning Rod). I really have no clue why is doing this
  22. Yeah I know you can use an access transformer, and honestly I have no problem using that. However at the end of the day the source method is just calling that constructor accessing the registry, so I don't know what real advantages would give an access transformer.
×
×
  • Create New...

Important Information

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