Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by JimiIT92

  1. Thank you, for some reasone I didn't tried that and I thought it wasn't necessary since you override it ๐Ÿ˜… Added outside the base object, now it works
  2. I'm porting my mod to 1.19.2 and I noticed that Items with the forge:separate_transforms loader in the Item Model are rendered too dark inside the Inventory. This is how one of them looks right now And this is how it looks inside an Item Frame (which is correct) This is the Item model file { "loader": "forge:separate_transforms", "base": { "parent": "builtin/entity", "gui_light": "front", "textures": { "particle": "blazersmod:item/spear" }, "display": { "thirdperson_righthand": { "rotation": [ 0, 60, 0 ], "translation": [ 11, 17, -2 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 0, 60, 0 ], "translation": [ 3, 17, 12 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ -3, 17, 1], "scale": [ 1, 1, 1 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 13, 17, 1], "scale": [ 1, 1, 1 ] } } }, "perspectives": { "gui": { "parent": "blazersmod:item/spear_inventory" }, "fixed": { "parent": "blazersmod:item/spear_inventory" }, "ground": { "parent": "blazersmod:item/spear_inventory" } }, "overrides": [ { "predicate": { "throwing": 1 }, "model": "blazersmod:item/spear_throwing" } ] } And this is the Inventory model file { "parent": "item/generated", "gui_light": "front", "textures": { "layer0": "blazersmod:item/spear" } } As you can see I already tried to add the gui_light: front property to the Inventory model, but it looks like is ignored. What should I add to light those items correctly?
  3. You don't need mixins for this. If you want to follow the "entity path" you can either summon an invisible, unkillable and uncollidable shulker with the glowing effect where the arrow lands or either create your own entity that by default has no rendering (it's just a transparent cube) or can camouflage to a blockstate you pass in when summoning (and then render the block as the entity texture)
  4. I suspected that ๐Ÿ˜… And what about the "vanilla events", the ones that are used for Sculk Sensors? Will we eventually switch to use that instead of Forge ones?
  5. So I was recently talking with another user in the "Modder Support" category, which asked if there was a way to catch when a block ticks. So that got me thinking: why there isn't such event? What are the reasons behind the choice to not fire an event when a block ticks? And in general what are the reasons that lead to fire/not firing an event?
  6. I ended up using an AT to make the FallingBlockEntity constructor with the pos public, as this is what I need in the dripstone code and so I can create an extended entity that overrides the fall method and set the dropItem property to false
  7. You can get the collision shape of a block using the BlockState#getCollisionShape method. You can then call the isEmpty method on the result, and if is true it means that the block you get the collision shape from has no collision
  8. Yes, this is exactly what I want to change. Not the fact that the block is placed (although it never does), but rather the "drops". I was trying to avoid using mixins as much as I can, and was rather curious about if there was a "proper" event to listen to change this behaviour
  9. A Feature is generally used (or at least in 99% of the cases is what I've used them for) for something that can be "placed" naturally inside the world (like ores, flowers, trees, structures....). An Event is something that Forge fires when something particular occurs (like an entity being spawned, a block being placed, a message bein sent...). So in this case what you want to use is an Event that listens for a blocks ticking and then, if some random criteria you decide are met, you can turn it into your own custom block. Unfortunately, as warjort said... So unless it comes out you need to find a "manual" solution to achieve what you want
  10. I made a custom Pointed Dripstone that, when the block above is broken, it falls and on landing it spawns some dripstone drops (like vanilla dripstone does). However what if I don't want those drops but instead I just want the FallingBlockEntity that is spawned to just be destroyed? I tried this in the onFall and onBrokenAfterFall methods fallingBlockEntity.dropItem = false; but that doesn't seem to do anything. I also tried to listen for the LivingDropsEvent but since the dropped dripstone aren't technically drops, but rather ItemEntitys added to the world, that event never gets called. I even tried to listen to the EntityJoinWorldEvent and indeed I can cancel it and no dripstone will be "dropped". However there's no way that I've found to actually tell if the ItemEntity has been "spawned" by the Falling Entity or not. I can only check if it has been tossed as a drop by an entity (checking the entity owner), but I guess that's not ideal. So how can I stop the falling entity to "drop" items when it lands?
  11. Thank you For reference if anyone has the same issue, this is what the JSON file now looks like { "loader": "forge:separate-perspective", "base": { "parent": "blazersmod:item/spear_in_hand" }, "perspectives": { "gui": { "parent": "blazersmod:item/spear_inventory" }, "fixed": { "parent": "blazersmod:item/spear_inventory" }, "ground": { "parent": "blazersmod:item/spear_inventory" } } } You don't need to specify the whole model inside, you can just reference an existing JSON file as "parent" for the given perspective (for instance, here I've set the "in_hand" model as my base model and the "inventory" model for when the Item is in Inventory, dropped on the ground or inside an Item Frame
  12. I have an Item that is also associated with an entity, and so the entity model is rendered in inventory. However how can I make so in Inventory a plain texture is rendered? This is what I tried so far: the JSON file for the Item is the following { "parent": "minecraft:builtin/entity", "gui_light": "front", "textures": { "particle": "blazersmod:item/spear" }, "display": { "thirdperson_righthand": { "rotation": [ 0, 60, 0 ], "translation": [ 11, 17, -2 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 0, 60, 0 ], "translation": [ 3, 17, 12 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ -3, 17, 1], "scale": [ 1, 1, 1 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 13, 17, 1], "scale": [ 1, 1, 1 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ -2, 4, -5], "scale":[ 0.5, 0.5, 0.5] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 4, 4, 2], "scale":[ 0.25, 0.25, 0.25] }, "gui": { "rotation": [ 15, -25, -5 ], "translation": [ 2, 3, 0 ], "scale": [ 0.65, 0.65, 0.65 ] } }, "overrides": [ { "predicate": { "throwing": 1 }, "model": "blazersmod:item/spear_throwing" } ] } And in the Item class I override the initializeClient method to return my custom ItemRenderer instance @Override public void initializeClient(Consumer<IItemRenderProperties> consumer) { consumer.accept(new IItemRenderProperties() { @Override public BlockEntityWithoutLevelRenderer getItemStackRenderer() { return BlazersMod.getItemsRenderer(); } }); } for which, in the renderByItem method, I do this @Override public void renderByItem(ItemStack stack, ItemTransforms.@NotNull TransformType transformType, @NotNull PoseStack pose, @NotNull MultiBufferSource buffer, int packedLight, int packedOverlay) { if(stack.getItem() instanceof SpearItem) { pose.pushPose(); pose.scale(1.0F, -1.0F, -1.0F); EntityModel<ThrownSpear> model = this.spearModel; ResourceLocation layerLocation = ThrownSpearRenderer.SPEAR_LOCATION; VertexConsumer vertexConsumer = ItemRenderer.getFoilBufferDirect(buffer, model.renderType(layerLocation), false, stack.hasFoil()); model.renderToBuffer(pose, vertexConsumer, packedLight, packedOverlay, 1.0F, 1.0F, 1.0F, 1.0F); pose.popPose(); } } What should I specify to render not the model but a plain texture in Inventory? Or where can I look at? I tried looking at the Trident but can't find anything related
  13. I think a good starting point, as you already mentioned it, is to look at Zombie entity class and see what happens when the Zombie starts breaking a door. Specifically you can look at the BreakDoorGoal class that is used by the Zombie. Inside it, in the tick method, you will find this line this.mob.level.destroyBlockProgress(this.mob.getId(), this.doorPos, i); Essentially the function destroyBlockProgress is called by the zombie on its world (level) instance. I'm not sure if this is the actual method that shows the breaking overlay and also what values the last parameter (progress) should have, but by the name is definitively something I would try and see what it does
  14. Ok, so I've created the Recipe Category, but in the log I have this Unknown recipe category: blazersmod:fletching/blazersmod:carbon_bow carbon bow being an Item that can be crafted using the custom recipe type. I've created it like this RecipeBookCategories.create(BlazersMod.MOD_ID + ":fletching", new ItemStack(BLItems.CARBON_BOW.get())); and the JSON file for the recipe is the following { "type": "blazersmod:fletching", "addition": { "item": "blazersmod:carbon" }, "base": { "item": "minecraft:bow" }, "result": { "item": "blazersmod:carbon_bow" } } So I don't understand why is actually trying to recognize that category instead of the "main" fletching category
  15. Got it, during which event should I call the create method?
  16. So I made a custom recipe type to add functionalities to the Fletching Table. Everything works, but I want to show the toast "Recipe unlocked" when the Player either meets the criteria (like for any other recipe) or craft the item at the fletching table. The idea is that in the upper-right corner it should pop-up a notification similar to the one for smithing table, but with the fletching table icon and the craft result item icon instead. I tried to use the RecipeBookCategories#create method, since it looks like every recipe category is hardcoded into that enum, however that method has an hardcoded IllegalStateException. So how can I add my own custom crafting category into the game?
  17. If he's using a custom block, yes, absolutely no need for mixins. But since he didn't mention it I assume he's just using the Vanilla Smithing Table, in which specify the NBT Tags in the recipe JSON is not sufficient (unless there's a way to bind custom recipe serializer to Vanilla Blocks, which I'm not aware of)
  18. I was also thinking: if you are NOT using a custom block, but rather you want to change the output from the vanilla smithing table, you could use a mixin. The smithing recipe JSON file actually can read NBT tags from the output, however they are straight up ignored in the UpgradeRecipe class, specifically the assemble method public ItemStack assemble(Container pInv) { ItemStack itemstack = this.result.copy(); CompoundTag compoundtag = pInv.getItem(0).getTag(); if (compoundtag != null) { itemstack.setTag(compoundtag.copy()); } return itemstack; } The Vanilla class essentially takes whatever tags the first Item has (the "base" ingredient), if any, and copy them to the output Item, ignoring whatever tags that Item could have. By using a mixin for this method you can change how it work and make so the result Item tags are not ignored, but rather merged with the base ingredient tags. You can see how to configure the project for using mixins here: https://github.com/SpongePowered/Mixin/wiki/Mixins-on-Minecraft-Forge. You can also check this repository that contains an example of how to actually use it
  19. In 1.18 there was the Item#isFoil method. I think it is the same in 1.19, however you can always look at the NetherStar Item class or how the Item is registered to ser how this is achieved in Vanilla
  20. Didn't know that, I never tried something similar in the past Thanks for the explanation
  21. This will make me add "manually" the item stack to the appropriate tab. But if the Item already has a tab set, won't this duplicate it inside the tab?
  22. So it means that by deafult the Item should not have a pre-defined Creative Tab set in the Item Properties?
  23. I made a custom Sword Item that should be always pre-enchanted with a specific enchant set via code. Right now I am using the Item#inventoryTick method to show the enchantment (kinda how Enchanted Books does). However this means that every tick the Word tries to get enchanted (of course it fails after the first tick where is actually enchanted), so I guess is not ideal. So what would it be an optimal way to have an enchanted Item in the Creative Inventory where the enchant is not applied every tick?
  • Create New...

Important Information

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