Jump to content

1.8.9 'mcmod.info'


Sigjaw

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks for your answer and sorry I forgot to mention that I already tried getting rid of byg but then it just does the same thing with ars nouveau that barely adds 1 biome and a few trees here and there. That's why I thought it might not be strictly mod related since I already played a few times with those two mods without issues in the same minecraft version.    
    • 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; } }  
    • Add the latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here
    • Replace it with this build: https://www.curseforge.com/minecraft/mc-mods/crafttweaker/files/4886430
  • Topics

×
×
  • Create New...

Important Information

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