Search the Community
Showing results for tags 'items'.
-
I have been working on recipes for my mod and have come across two errors. ERROR ONE: [19:38:01] [Render thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe echoingend:gazite_block com.google.gson.JsonParseException: Map entry 'A' : Failed to parse either. First: Input does not contain a key [type]: MapLike[{"item":"echoingend:gazite"}]; Second: Failed to parse either. First: Not a json array: {"item":"echoingend:gazite"}; Second: No key tag in MapLike[{"item":"echoingend:gazite"}]; Unknown registry key in ResourceKey[minecraft:root / minecraft:item]: echoingend:gazite LINKED CODE: { "type": "minecraft:crafting_shaped", "category": "misc", "key": { "A": { "item": "echoingend:gazite" } }, "pattern": [ "AAA", "AAA", "AAA" ], "result": { "count": 1, "id": "echoingend:gazite_block" } } ERROR TWO: [19:38:01] [Render thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe echoingend:gazite com.google.gson.JsonParseException: Unknown registry key in ResourceKey[minecraft:root / minecraft:item]: echoingend:gazite LINKED CODE: { "type": "minecraft:crafting_shapeless", "category": "misc", "ingredients": [ { "item": "echoingend:gazite_block" } ], "result": { "count": 9, "id": "echoingend:gazite" } } The tutorial I was following. The GitHub Repository from the tutorial. My file structure is: data/[MOD ID]/recipe/[ITEM/BLOCK], as it is in the tutorial.
-
I'm just new in modding Minecraft. And I want to edit vanilla items. How do i do that?
-
Hello, I'm trying to make my first mod. Now I'm trying to make an item that would save the type of animal that I right-clicked on with the item and display it in the lore of the item. I thought that this should be implemented through NBT tags and started looking at methods. In all the guides that I looked at and in the mods from GitHub, the setTag method was used to install new tags, but my IDE highlights this method in red, and when assembling, it gives an error. Same with hasTag and getOrCreateTag(). I use VS Code, 47.3.1 forge version, tried to update to 47.3.5. Sorry for bad English, I use Google translator. package net.zkera.genetic_horror.Item.Custom; import java.util.List; import javax.annotation.Nullable; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.level.Level; import net.zkera.genetic_horror.Item.ModItems; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.nbt.CompoundTag; public class SyringeItem extends Item { public SyringeItem(Properties pProperties) { super(pProperties); } private EntityType<?> storedGen = null; public static final EntityType[] permitteGenes = {EntityType.COW, EntityType.SQUID}; private static final String NBT_KEY_FOR_GEN = "Gen"; @Override public InteractionResult interactLivingEntity(ItemStack pStack, Player pPlayer, LivingEntity Target, InteractionHand pUsedHand) { if (CanFillSyringe(Target.getType())) { storedGen = Target.getType(); CompoundTag sharedGenTag = pStack.getOrCreateTag(); sharedGenTag.putString(NBT_KEY_FOR_GEN, storedGen.toString()); pStack.setTag(sharedGenTag); } return InteractionResult.SUCCESS; } @Override public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { if (pPlayer.getItemInHand(InteractionHand.OFF_HAND).getItem() == ModItems.FLASK.get()) { ItemStack toHand = new ItemStack(ModItems.PIECE.get(), 1); pPlayer.setItemInHand(InteractionHand.MAIN_HAND, toHand); pPlayer.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); } return InteractionResultHolder.success(pPlayer.getItemInHand(pUsedHand)); } @Override public void appendHoverText(ItemStack pStack, @Nullable Level p_41422_, List<Component> pTooltipComponents, TooltipFlag pTooltipFlag) { super.appendHoverText(pStack, p_41422_, pTooltipComponents, pTooltipFlag); if (pStack.hasTag()) { String sharedGenString = "item.genetic_horror.syringe.tooltip." + pStack.getTag().getString(NBT_KEY_FOR_GEN); sharedGenString = sharedGenString.replace("entity.minecraft.", ""); pTooltipComponents.add(Component.translatable(sharedGenString)); } } private boolean CanFillSyringe(EntityType<?> type) { if (storedGen != null) return false; for (var i : permitteGenes) { if (type == i) return true; } return false; } }
-
when i add item in minecraft 1.20.1 it doesn't load the textures the source code is at: https://github.com/randomusert/customcrafting-1.20.1-forge
-
Hi! I’m looking to commission a custom Minecraft mod for version 1.19.2 on Forge. I want to have a balanced Copper tools and armor mod that snugly fits the copper tier between the Stone/ Chainmail and Iron Tiers. Here are the stats I have planned: - Copper Helmet: 2 Armor Points, 121 Durability - Copper Chestplate: 5 Armor Points, 2 Armor Toughness, 177 Durability - Copper Leggings: 4 Armor Points, 2 Armor Toughness, 165 Durability - Copper Boots: 2 Armor Points, 143 Durability - Copper Tools: Same Efficiency, but 0.5 less damage than Iron Tier, and 181 Durability for each tool. I only want to add the basic tools such as a sword, pickaxe, axe, shovel, and hoe. Please let me know of any balancing changes you would make and where I could go right now to commission such a mod.
-
I am getting this exception (I am new and just trying to create an item) Caused by: java.io.FileNotFoundException: abrasmagics:models/item/ingot_test.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[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:?] However the directory is set up correctly and the file does exist idk how to upload images so here is a treeview of the directories: src ├───main │ ├───java │ │ └───net │ │ └───abrasmods │ │ └───abrasmagics │ │ ├───init │ │ ├───items │ │ └───utils │ │ ├───handlers │ │ ├───misc │ │ └───proxy │ └───resources │ └───assets │ └───abrasmagics │ ├───models │ │ ├───block │ │ └───item │ └───textures └───test ├───java └───resources the file ingot_test.json is under models/item. The directory seems fine and the file does exist so anyone plz help. i am using intellij and is coding for 1.12.2
-
I am wanting to add an axe to my mod though I do not want it to have a recipe, the reason for this being that I want you to only be able to find it in a structure. I have looked on both here and elsewhere on the internet and have found nothing... How would this be done? (Video for reference.)
-
1.20.4 (solved) The removal of the getTag() function on items
Podloot posted a topic in Modder Support
Hello, My mod quite heavily relies on the NBT data of an item. Before 1.20.4, this data could be retrieved using ItemStack.getTag(), however this seems to have changed in 1.20.4. Is there any documentation on this change, or does anyone know if the getTag() function could be replaced by something else? -> I think stack.get(DataComponents.CUSTOM_DATA) does the job. Greetings, Podloot. -
I have been working on my mod for some time now and I am wanting to add a drink item, I am new to modding and am currently self teaching myself java as I follow tutorials. I am hoping that the code would not need a massive reworking. public static final FoodProperties LEMON_JUICE = new FoodProperties.Builder().nutrition(3) .saturationMod(0.25f).effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500),0.01f) .effect(() -> new MobEffectInstance(MobEffects.CONFUSION,200),1).build(); In game the lemon juice acts like a food, making eating audio and creating particles. For the audio I would like to use the honey drinking sound. How would I get this to work as I am wanting it to?
-
In 1.20.6 any potion brewed in the brewing stand disappears upon completion.
-
I'm trying to apply effects to the emerald armor but it doesn't work, I read that the onArmorTick() method doesn't work anymore, but I tried with inventoryTick, onInventoryTick and onArmorTick but they don't apply the effect either, I don't know if I'm writing it wrong, so I need help to fix it. This is the code in question: public class ModArmorItem extends ArmorItem{ private static final Map<ArmorMaterial, MobEffectInstance> MATERIAL_TO_EFFECT_MAP = (new ImmutableMap.Builder<ArmorMaterial, MobEffectInstance>()) .put(ModArmorMaterials.EMERALD, new MobEffectInstance( MobEffects.HERO_OF_THE_VILLAGE, 200, 1, false, false, true)) .build(); public ModArmorItem(ArmorMaterial pMaterial, Type pType, Properties pProperties) { super(pMaterial, pType, pProperties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player){ if (!world.isClientSide()) { if (hasFullSuitOfArmorOn(player)) { evaluateArmorEffects(player); } } } private void evaluateArmorEffects(Player player) { for (Map.Entry<ArmorMaterial,MobEffectInstance> entry : MATERIAL_TO_EFFECT_MAP.entrySet()){ ArmorMaterial mapArmorMaterial = entry.getKey(); MobEffectInstance mapStatusEffect = entry.getValue(); if (hasCorrectArmorOn(mapArmorMaterial, player)) { addStatusEffectForMaterial(player, mapArmorMaterial, mapStatusEffect); } } } private void addStatusEffectForMaterial(Player player, ArmorMaterial mapArmorMaterial, MobEffectInstance mapStatusEffect) { boolean hasPlayerEffect = player.hasEffect(mapStatusEffect.getEffect()); if (hasCorrectArmorOn(mapArmorMaterial, player) && !hasPlayerEffect) { player.addEffect(new MobEffectInstance(mapStatusEffect)); } } private boolean hasCorrectArmorOn(ArmorMaterial material, Player player) { for (ItemStack armorStack : player.getInventory().armor){ if (!(armorStack.getItem() instanceof ArmorItem)) { return false; } } ArmorItem helmet = ((ArmorItem)player.getInventory().getArmor(3).getItem()); ArmorItem brestplace = ((ArmorItem)player.getInventory().getArmor(2).getItem()); ArmorItem leggins = ((ArmorItem)player.getInventory().getArmor(1).getItem()); ArmorItem boots = ((ArmorItem)player.getInventory().getArmor(0).getItem()); return helmet.getMaterial() == material && brestplace.getMaterial() == material && leggins.getMaterial() == material && boots.getMaterial() == material; } private boolean hasFullSuitOfArmorOn(Player player){ ItemStack helmet = player.getInventory().getArmor(3); ItemStack breastplace = player.getInventory().getArmor(2); ItemStack leggins = player.getInventory().getArmor(1); ItemStack boots = player.getInventory().getArmor(0); return !helmet.isEmpty() && !breastplace.isEmpty() && !leggins.isEmpty() && boots.isEmpty(); } } And here is the armor public static final RegistryObject<Item> EMERALD_HELMET = ITEMS.register( "emerald_helmet", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.HELMET, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_CHESTPLATE = ITEMS.register( "emerald_chestplate", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.CHESTPLATE, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_LEGGINS = ITEMS.register( "emerald_leggins", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.LEGGINGS, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_BOOTS = ITEMS.register( "emerald_boots", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.BOOTS, new Item.Properties()) ); I hope you can help me. Thanks.
-
As well all know in minecraft inventory items (that can have more then 1 item amount) show a number once there amount goes above 1 (3 for the acacia plank for example) as shown below: now im trying to not render the item amount I found the following way I could maybe do that: public class CustomItemRenderer extends ItemRenderer{ public CustomItemRenderer(TextureManager textureManagerIn, ModelManager modelManagerIn, ItemColors itemColorsIn) { super(textureManagerIn, modelManagerIn, itemColorsIn); } @Override public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text) { if (stack.getCount() > 1) { return; } super.renderItemOverlayIntoGUI(fr, stack, xPosition, yPosition, text); } } when I hover over renderItemOverlayIntoGUI I get the following tooltip in intelij: public void renderItemOverlayIntoGUI( Font Renderer fr, @NotNull » ItemStack stack, int position, int position, @Nullable String text From class: ItemRenderer Renders the stack size and/or damage bar for the given ItemStack. which shows me what I want, to to not render the stack size. but I have no clue how to register this class since it has a super as follows: public CustomItemRenderer(TextureManager textureManagerIn, ModelManager modelManagerIn, ItemColors itemColorsIn) { super(textureManagerIn, modelManagerIn, itemColorsIn); }
-
My issue is as simple and probably stupid as the title. So, I make add-on for mod missing loot table. I found wiki for dependencies and in an effort to use less effort wondered if it was necessary to make an extra convoluted dependency structure to simply call to some items. I will continue to use my circa 2006 google skills make it simpler for me to grasp. I no good at modding( Obviously), but me learn good. I will probably figure this out before I get a response. TLDR; is there a difference in structure between add-on and mod? Ty for reading this far. Enjoy the brain rot from my nooby question ❤️ Eternally Noob, The Noob *edit-1.0.0* I have the loot tables ready to shoot I just need to properly wrap me head around calling to another mod without doubling the files necessary. Currently there are no direct calls to bring data into my add-on/mod/failure just the ?standard? "mod_id:item" calls in loot table pools. I.E. { "type": "minecraft:chest", "pools": [ { "rolls": { "min": 0, "max": 1 }, "bonus_rolls": { "min": 1, "max": 2 }, "entries":[ { "type": "item", "weight": 2, "name": "other_mod_id:item", "quality": 1 }, ] }, { "rolls": 1 } ] } If possible I would love to just call to the "other_mod" from this. If this is enough then I will forehead wall for a while....
-
I have an item class "PavlovaCake", and I want to switch the model based on the status of the integer "stage". Say, when stage == 1, it will load model "item/pavlova/1", when stage == 2, it loads "item/pavlova/2" Can anyone tell me how I can achieve this? Thanks
-
What is my goal: Create an item with forge energy support. It is supposed to switch between an active and inactive state. It should drain energy while active and inside the inventory of an entity. What I am currently doing to archieve this: I have an override of inventoryTick() in my item class which currently looks like this: @Override public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean bl) { if(!level.isClientSide) { if(updateActive(stack, level, entity)) { // checks state of the 'active' boolean tag for(var stackInHand : entity.getHandSlots()) { if(stackInHand == stack) { updateLight(level, entity); // might cause some lag (places light blocks) break; } } // extractEnergy(stack, 1); stack.getOrCreateTag().putInt("energy", 1000 + (int)(1000*Math.random())); // for testing } } } Apart from that I have defined an ICapabilityProvider which provides an instance of my custom IEnergyStorage implementation (stores current energy of an ItemStack in the 'energy' tag). As can be seen in the snippet above I have disabled the the extractEnergy() call and modified the energy tag directly to ensure nothing is wrong with my IEnergyStorage implementation. What's the issue: It appears that sometimes when I drop an 'active' item into the world the entity is dropped but a ghost item stays in the slot of the player inventory. I could confirm with debug outputs that inventoryTick() is only called on the client side from that point on (checking the inventory slot with the data command also reports that no item exist in that slot). As soon as I open the inventory the ghost item becomes an actual item (i.e. it is beeing updated on the server side again) effectively duping the item. I have observed this behaviour only when dropping the item while the game is lagging (sometimes). Though even a minor lag spike could be enough I guess. In my case this can be caused by the updateLight() call (depending on the mod settings and the spec of the machine) since it places light blocks in the world causing some light updates. I use this call with high settings (i.e. placing many light blocks) to forcefully cause some lag to be able to somewhat consistently replicate this issue. I guess the information that the item was dropped does not reach the client. This is somewhat surprising to me since from my understanding this could happen to any item?! Though I have never observed this kind of bug with any other modded (or vanilla) item from what I can recall. Whats interesting is that if I remove the randomness from the tag value (e.g. stack.getOrCreateTag().putInt("energy", 1000)) the issue seems to be gone. Hence I came to the conclusion this might be tied to the tag values getting out of sync between the server and client. But I have no idea what to do about this. Minimal example: I have set up a project with a minimal example showcasing the bug. The repository can be found here: https://gitlab.com/hd-mc-mods/examples/item-tick-bug So this makes me wonder: Am I not supposed to change tag values in inventoryTick()? Is there a way to check on the client side if an item stack does not exist anymore on the server side (i.e. remove ghost items)? Is it wrong to put to much load on the server inside inventoryTick() (e.g. updateLight())? What would be alternatives? Am I doing something obviously wrong that is out of my grasp? I hope somebody with a little more insight can help me with this or point me to good examples matching my usecase.
-
I'm trying to add a custom enchantment that is only compatible with a new type of tiered weapon I made. I am using 1.19.3, forge version 44.0.1. I tried using EnchantmentCategory#create(), but it doesn't work. Here is the enchantment class: package everyblu.extendedarmory.common.enchantments; import everyblu.extendedarmory.common.item.LongswordItem; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; import org.jetbrains.annotations.NotNull; public class ThrustingEnchantment extends Enchantment { static EnchantmentCategory LONGSWORD_TYPE = EnchantmentCategory.create("thrusting", item -> item instanceof LongswordItem); public ThrustingEnchantment() { super(Rarity.RARE, LONGSWORD_TYPE, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND}); } @Override public int getMaxLevel() { return 3; } @Override public void doPostAttack(@NotNull LivingEntity attacker, @NotNull Entity target, int tier) { if (attacker.getLevel().isClientSide()) { ClientLevel level = ((ClientLevel) attacker.getLevel()); if (tier >= 1) level.addParticle(ParticleTypes.SONIC_BOOM, target.position().x,target.position().y, target.position().z, 0, 0, 0); //This part is not finished. } } } Here is my enchants init class: package everyblu.extendedarmory.common.register; import everyblu.extendedarmory.ExtendedArmory; import everyblu.extendedarmory.common.enchantments.CutlassLuckEnchantment; import everyblu.extendedarmory.common.enchantments.ThrustingEnchantment; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModEnchants { public static final DeferredRegister<Enchantment> ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, ExtendedArmory.MODID); public static RegistryObject<Enchantment> Thrusting = ENCHANTMENTS.register("thrusting", ThrustingEnchantment::new); public static RegistryObject<Enchantment> CutlassLuck = ENCHANTMENTS.register("cutlassluck", CutlassLuckEnchantment::new); public static void register(IEventBus eventBus) { ENCHANTMENTS.register(eventBus); } }
-
Topic for making tags
-
- 1.10.2
- 1.11.2
-
(and 81 more)
Tagged with:
- 1.10.2
- 1.11.2
- 1.12.2
- 1.13.2
- 1.14.4
- 1.15.2
- 1.16.5
- 1.17.1
- 1.18.2
- 1.19.0
- 1.19.1
- 1.19.2
- 1.19.3
- 1.19.4
- 1.2.5
- 1.20.0
- 1.3.2
- 1.4.7
- 1.5.2
- 1.6.4
- 1.7.10
- 1.8.9
- 1.9.4
- armour
- bad jvm args
- biomes
- blocks
- broken mod
- bug
- capabilities
- client
- client-only mods on server
- codecs
- commands
- dimensions
- effects
- enchantments
- entities
- events
- feature request
- fluids
- food
- gradle
- groovy
- guis
- ide
- installer
- items
- java
- kotlin
- launcher
- libraries
- loot
- metadata
- missing jar association
- missing java
- missing mods
- mixin
- needs more info
- networking
- news
- optifine
- ores
- out of memory
- outdated drivers
- particles
- performance
- porting
- potions
- recipes
- registries
- rendering
- scala
- server
- solved
- sounds
- textures
- tools
- tutorial
- weapons
- worldgen
- wrong java version
- wrong mod version