Jump to content

Tikaji

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by Tikaji

  1. I've updated the file in data/<mymodid>/loot_modifiers to the following and still get the same result: { "type": "exnihilosequentia:use_hammer", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "tag": "exnihilosequentia:hammer" } } ] } A tag file does exist and the modifier still fires for the same blocks in the previous post, except for coral blocks.
  2. Ok, so my modifier looks like the following: public class UseHammerModifier extends LootModifier { public UseHammerModifier(ILootCondition[] conditionsIn) { super(conditionsIn); } @Nonnull @Override public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { LogUtil.info("Fired Modifier"); ItemStack tool = context.get(LootParameters.TOOL); BlockState blockState = context.get(LootParameters.BLOCK_STATE); if (tool != null && blockState != null) { if (tool.getItem() instanceof HammerBaseItem) { List<ItemStack> newLoot = new ArrayList<>(); Block returnBlock = ModRegistries.HAMMER .getResult(blockState.getBlock().getRegistryName()); newLoot.add(new ItemStack(returnBlock)); return newLoot; } } return generatedLoot; } public static class Serializer extends GlobalLootModifierSerializer<UseHammerModifier> { @Override public UseHammerModifier read(ResourceLocation location, JsonObject object, ILootCondition[] ailootcondition) { LogUtil.info("UseHammerModifier.Serializer.read"); return new UseHammerModifier(ailootcondition); } } } I have a file under data/<mymodid>/loot_modifiers that looks like: { "type": "exnihilosequentia:use_hammer", "conditions": [ { "condition": "minecraft:alternative", "terms": [ { "condition": "minecraft:block_state_property", "block": "minecraft:cobblestone" }, { "condition": "minecraft:block_state_property", "block": "minecraft:gravel" }, { "condition": "minecraft:block_state_property", "block": "minecraft:sand" }, { "condition": "minecraft:block_state_property", "block": "minecraft:andesite" }, { "condition": "minecraft:block_state_property", "block": "minecraft:diorite" }, { "condition": "minecraft:block_state_property", "block": "minecraft:granite" }, { "condition": "minecraft:block_state_property", "block": "minecraft:netherrack" }, { "condition": "minecraft:block_state_property", "block": "minecraft:end_stone" }, { "condition": "minecraft:block_state_property", "block": "minecraft:tube_coral_block" }, { "condition": "minecraft:block_state_property", "block": "minecraft:brain_coral_block" }, { "condition": "minecraft:block_state_property", "block": "minecraft:bubble_coral_block" }, { "condition": "minecraft:block_state_property", "block": "minecraft:fire_coral_block" }, { "condition": "minecraft:block_state_property", "block": "minecraft:horn_coral_block" } ] } ] } The modifier is fired for all the blocks in the list, except for the coral blocks. What is wrong with my modifier to cause it to only fire with those blocks? You said that it should fire even when an empty drop happens, but that's not the case here.
  3. So then how would I go about modifying the loot drops of coral blocks? My modifier will fire when the block is broken with a silk touch pickaxe, but not with my custom tool.
  4. I'm having issues modifying the loot table specifically for the coral blocks. I have a global loot modifier set up that works for other blocks (cobblestone, gravel, etc), however it does not work on the coral blocks. I assume that it has something to do with the conditions already set in the loot table. I notice that when I mine coral blocks with a silk touch pickaxe my loot modifier is run, but when attempting to mine it with a custom item (my hammer) it does not work. I attempted to modify the table as follows: { "type": "minecraft:block", "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:alternative", "terms": [ { "condition": "minecraft:match_tool", "predicate": { "tag": "exnihilosequentia:hammer" } }, { "condition": "minecraft:match_tool", "predicate": { "enchantments": [ { "enchantment": "minecraft:silk_touch", "levels": { "min": 1 } } ] } } ] } ], "name": "minecraft:tube_coral_block" }, { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:survives_explosion" } ], "name": "minecraft:dead_tube_coral_block" } ] } ] } ] } For the predicate that I added, I did add the tag I specified and my items are registered to that tag. What am I missing to get this to work? (Also, sorry about the big code block, I've forgotten how to do spoilers....)
  5. You know...somehow I missed that one in my search. Thanks!
  6. I've been doing some digging and I'm having a hard time figuring out how to go about checking to see if another mod is loaded. I would like to remove items from the creative menu depending on if a mod is loaded or not. Suggestions on how to go about doing this?
  7. Ok that makes sense. I updated my points to the following: builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.0625F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(minU, minV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.0625F, fillAmount, 0.9375F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(minU, maxV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.9375F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(maxU, maxV).lightmap(0, 240).normal(0, 1, 0).endVertex(); builder.pos(matrixStackIn.getLast().getMatrix(),0.9375F, fillAmount, 0.0625F).color(1.0F, 1.0F, 1.0F, 1.0F).tex(maxU, minV).lightmap(0, 240).normal(0, 1, 0).endVertex(); This stops the crash from happening. However, I'm not getting anything to render still. I've tried reversing the points because I know that planes are one directional and that still didn't get me anything. Also, do I want to use the SOLID RenderType, or should I be using something else?
  8. I'm getting the following error when I go to create a TER: java.lang.IllegalStateException: Not filled all elements of the vertex Here is the stack trace that follows: I'm following McJty's tutorial (at least pretty closely) and I'm not entirely sure what I'm missing. Here's the TER: Here is the getTexture on the Tile Entity: Any help would be greatly appreciated! (And yes, I am aware that my mod id is too short. I haven't gotten around to changing it yet.)
  9. Ah, I see. Perfect. Thanks that did it.
  10. I do return something other than PASS. PASS is the default return if none of the cases are met.
  11. How do I go about preventing a block placement from happening on block activation? I currently have a block that has overridden onBlockActivated and it works as expected, however the block that is in the players hand is placed for a split second and then is removed, which then causes my itemstack to be decreased (I'm making the assumption that this is the default behavior of placing a block). I also looked at the EntityPlaceEvent and tried cancelling it, but I still got the same behavior. I would like to prevent that split second block placement and stack decrease. Here is the onBlockActivated if it helps. In addition, I know that there are four ActionResultTypes, when exactly should each of those types be returned? I notice that I get a slightly different behavior based on which type I return.
  12. Ah I see what you're saying. My JSON was incorrect.
  13. Is that not what I have in my blockstate? If you look at the block state for oak fence or redstone wire it's pretty similar.
  14. No crash. The default model displays as a missing texture. I suppose I should have reported the following with my issue. I do get a warning saying that models are missing. However, I believe I'm doing something wrong because if I understand correctly, I should be able to create a multipart mode. [26Apr2020 22:31:46.206] [Server-Worker-5/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Exception loading blockstate definition: 'ens:blockstates/block_sieve.json' missing model for variant: 'ens:block_sieve#mesh=diamond' [26Apr2020 22:31:46.207] [Server-Worker-5/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Exception loading blockstate definition: 'ens:blockstates/block_sieve.json' missing model for variant: 'ens:block_sieve#mesh=none' [26Apr2020 22:31:46.207] [Server-Worker-5/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Exception loading blockstate definition: 'ens:blockstates/block_sieve.json' missing model for variant: 'ens:block_sieve#mesh=iron' [26Apr2020 22:31:46.207] [Server-Worker-5/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Exception loading blockstate definition: 'ens:blockstates/block_sieve.json' missing model for variant: 'ens:block_sieve#mesh=string' [26Apr2020 22:31:46.207] [Server-Worker-5/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Exception loading blockstate definition: 'ens:blockstates/block_sieve.json' missing model for variant: 'ens:block_sieve#mesh=flint'
  15. I'm attempting to add a block that has a base model that is always rendered and has a specific part that is rendered based on a property in the block class. I'm following the redstone wire block class as a reference, but I'm having issues just getting the default model to display. What am I missing to get just the default model to render? And then going forward, am I missing anything to get the other variants to display? All I should need to do is update the property correct? Block class Blockstate JSON One of the mesh JSON Mesh base JSON
  16. Ok, that's what I thought. Figured I would ask though. Follow up question then. I want to use the same item class for each ore type (which would mean needing different instances of the class), but the model location is based off the registry name. Is there a way to use the same model file for different registry values so that I don't have to create a bunch of model files that are exactly the same?
  17. I've followed TGG's example on how to create items with variants (https://github.com/TheGreyGhost/MinecraftByExample/tree/1-15-2-working/src/main/java/minecraftbyexample/mbe11_item_variants) and would now like to add recipes for them. I have ore pieces of one type of ore that would combine into ore chunks of the same ore type. That ore type is stored via NBT. I know that the normal way to create recipes is through JSONs. However, I don't believe that this will work for my situation, and I feel like there should be a way to add recipe variants much like I was able to add item variants. I'm not entirely sure where to even begin looking to figure this one out, nor am I sure what code to share to help out here. Feel free to ask for particulars of my code.
  18. I'm not sure that it's possible, but I figured I would ask. Is it possible to register items after the main item registration? I would like to be able to read some JSON files and then register items based on those files. Is it even possible to do that?
  19. I would assume that I need to add an event handler for this, but I'm not entirely sure exactly what I need within the handler. Got a good place to point me to for this?
  20. What does this look like? Do you add cobblestone to it? I do add cobblestone to the registry. Its simply a map that takes a block as input and determines the output. I also updated the JSON to see if any other blocks would work. The only two that work and trigger the modifier are sand and gravel. I also stripped it down to just cobblestone and it doesn't work. Updated JSON: As far as I can tell Blocks.getDrops (which does the correct calls to use the loot table modifiers) isn't called when my custom tool is used on anything except sand and gravel.
  21. Ok, so I got rid of the onBlockDestroyed method, which caused doApply to only get called once, and I'm getting block drops from sand and gravel, only one item which is the expected result, but now I'm not getting anything from cobblestone. The modifier isn't being fired. My guess is something is wrong with the JSON file because that's what determines when the modifier gets fired, correct?
  22. Here's the modifier: Here is the loot modifier json: And here is the item. I assumed that I have to use the onBlockDestroyed in order to cause block drops for a custom tool. I was getting no drops with it otherwise. Let me know if there is anything else. I'll step through the code and it calls the spawnDrops method twice.
  23. Ok, so I got the Loot Modifier to work, but now I have the issue that gravel and sand will drop two of the same item. However, cobblestone drops one item using the same functionality. Why would that be?
×
×
  • Create New...

Important Information

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