Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

MrMarnic

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by MrMarnic

  1. And I believe the import should look like this: import net.minecraft.item.Item; without the world
  2. Firstly you forgot the semicolon at the end of this line public static final RegistryObject<Item> TESTITEM = ITEMS.register("testitem", () -> new TestItem(new Item.Properties())) The second thing: In this line here: private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); You are using the variable MODID but you have never created it. You need to create it like this: public static final String MODID = "<your modid>"; Then it should work
  3. @LexManos and @diesieben07 I have found the real reason for the error message. It was the formatting of drive. Steps to reproduce (on Windows): Use a working drive/flash drive. Format it with NTFS => put the project folder on it => everything works fine Format it with ExFAT or FAT32 => put the project folder on it => I get the error message I have tested it out with a working usb stick. On NTFS => everything is working ON FAT32/ExFat =>I get the error I don't know why this is happening, but this seems to be the reason.
  4. This could be, but in this post for example https://mcreator.net/forum/75274/build-and-launch-errors-need-help they say that they have the project on a flash drive and get same error. And when it is really failing, why does it work for any other version? Could it have something to do with the partitioning of the drive?
  5. I am not using MCCreator. I just googled for the error message and found these posts. But it is just like this. If the project is on the E drive I get the error. If it is C drive it works.
  6. I found the "solution" or better workaround. The runClient task works fine if the project directory is on the C drive. But on any other drive I am getting the error mentioned above. This only happens on 1.16.5, so there must be something that changed with the paths or something idk.
  7. Not even that did fix it. But it seems like I am not the only one with this problem. Here is the same error https://mcreator.net/forum/73623/116-upgrade-not-working . And here: https://mcreator.net/forum/75274/build-and-launch-errors-need-help I really have no idea anymore. I just hope I won't get the error in 1.17 .
  8. I don't have an answer either. I just tried out the 1.16.3 MDK and it works flawlessly. It's only the 1.16.5 version thats gives this error everytime, no matter how many times I reinstall it.
  9. I have done that. But it works only one time. When I try to start Minecraft again, I get the same error. This didn't happen in 1.16.4
  10. full log: https://pastebin.com/HuKtAuKK build.gradle: https://pastebin.com/b2WwAhFw
  11. Hello, when I try to run the runClient task to start Minecraft, I get this error: A problem was found with the configuration of task ':createSrgToMcp' (type 'GenerateSRG'). > File 'E:\MinecraftMods\SchulMod\build\extractSrg\output.srg' specified for property 'srg' does not exist. I hope you can help me. I am using Forge 1.16.5 - 36.1.25
  12. Thank you very much. It is working now with getShareTag and readShareTag.
  13. Ok I undestand that. But can I maybe send the capability trough getShareTag() ? Or is this not possible at all and I can not create a Backpack item with capabilites?
  14. I have attached an inventory to an item with the slot size of one (At the beggining the slot is empty). When you right click with this item a gold ingot will be set in the slot. If you sneak and right click the Display name of the inserted item will be printed. (At first "Air" because not item is set) The issue was already adressed here, but there was never as solution. Old issue public class InventoryTestItem extends Item { public InventoryTestItem(Properties properties) { super(properties); setRegistryName("inv_test"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { if(playerIn.isSneaking()) { playerIn.getHeldItem(handIn).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null).ifPresent((h)-> { ItemStackHandler handler = (ItemStackHandler) h; handler.setStackInSlot(0,new ItemStack(Items.GOLD_INGOT)); }); }else { playerIn.getHeldItem(handIn).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,null).ifPresent((h)-> { ItemStackHandler handler = (ItemStackHandler) h; System.out.println(handler.getStackInSlot(0).getDisplayName()); }); } return super.onItemRightClick(worldIn, playerIn, handIn); } @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return new InventoryTestProvider(); } public class InventoryTestProvider implements ICapabilityProvider, ICapabilitySerializable<CompoundNBT> { public ItemStackHandler handler; public InventoryTestProvider() { this.handler = new ItemStackHandler(1); } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction side) { if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return LazyOptional.of(()->(T)handler); } return LazyOptional.empty(); } @Override public CompoundNBT serializeNBT() { CompoundNBT tag = new CompoundNBT(); tag.put("itemHandler",handler.serializeNBT()); return tag; } @Override public void deserializeNBT(CompoundNBT nbt) { handler.deserializeNBT(nbt.getCompound("itemHandler")); } } } The ItemStack will always keep the Gold Ingot (if set), even when moved in inventories (like chests). But when I move the Item in the Creative Inventory (for example from slot 1 to 2) the capability is reset and the "Air" is printed as Displayname.
  15. Sorry. I was stupid and did override getNBTShareTag in a class that extends BasicBow.
  16. Hello, I have a custom Item which needs to be synced with the client. To do that I have looked up several threads and they suggested to override getNBTShareTag. But when I try to use it in the addInformation method the stack never has the values which are in getNBTShareTag. Item class: public class BasicBow extends Item { @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if(stack.hasTagCompound()) { System.out.println(stack.getTagCompound().hasKey("test")); } System.out.println(getNBTShareTag(stack).hasKey("test")); } @Override public boolean getShareTag() { return true; } @Nullable @Override public NBTTagCompound getNBTShareTag(ItemStack stack) { NBTTagCompound tag = super.getNBTShareTag(stack); if(tag == null) { tag = new NBTTagCompound(); } tag.setString("test","Hello world"); return tag; } } But the "test" key specified in getNBTShareTag is always empty in addInformation. I hope you can help me.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.