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

[SOLVED] [1.18.2] How to properly pre-enchant an Item in Creative Inventory?


JimiIT92
 Share

Recommended Posts

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?

Edited by JimiIT92
solved

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

11 minutes ago, diesieben07 said:

If allowdedIn (SIC) returns true for the given tab, fill it with whatever stacks you want.

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?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

  • JimiIT92 changed the title to [SOLVED] [1.18.2] How to properly pre-enchant an Item in Creative Inventory?

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Basically a backpack, I would like to know how to store this type of variable inside my Item. What should I use? Item Nbt and json serialize? how?
    • Hey Guys, my Server crashed randomly when my friend clicked on the wandering Traider. Similar Cras happend when he placed multiple Backpacks next to each other. I think its the End Remastered Mod but i could never just remove it cuz of the Progress we've made there. Can someone help me i would be very thankful. Thats the Crash Log:   java.lang.NoSuchMethodError: 'net.minecraft.util.text.ITextComponent net.minecraft.util.text.ITextComponent.func_244388_a(java.lang.String)'     at com.teamremastered.endrem.items.ERMap.createMap(ERMap.java:43) ~[endrem:5.0-R-1.16.5] {re:classloading}     at com.teamremastered.endrem.items.ERMap$ERMapTrade.func_221182_a(ERMap.java:54) ~[endrem:5.0-R-1.16.5] {re:classloading}     at net.minecraft.entity.merchant.villager.AbstractVillagerEntity.func_213717_a(AbstractVillagerEntity.java:235) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:supplementaries.mixins.json:AbstractVillagerEntityMixin,pl:mixin:APP:survive.mixins.json:AbstractVillagerEntityMixin,pl:mixin:APP:architectury-common.mixins.json:AbstractVillagerMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.entity.merchant.villager.WanderingTraderEntity.func_213712_ef(SourceFile:129) ~[?:?] {re:mixin,re:classloading,pl:mixin:APP:architectury-common.mixins.json:WanderingTraderMixin,pl:mixin:A}     at net.minecraft.entity.merchant.villager.AbstractVillagerEntity.func_213706_dY(AbstractVillagerEntity.java:99) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:supplementaries.mixins.json:AbstractVillagerEntityMixin,pl:mixin:APP:survive.mixins.json:AbstractVillagerEntityMixin,pl:mixin:APP:architectury-common.mixins.json:AbstractVillagerMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.entity.merchant.villager.WanderingTraderEntity.func_230254_b_(SourceFile:105) ~[?:?] {re:mixin,re:classloading,pl:mixin:APP:architectury-common.mixins.json:WanderingTraderMixin,pl:mixin:A}     at net.minecraft.entity.MobEntity.func_184230_a(MobEntity.java:1049) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:pehkui.mixins.json:MobEntityMixin,pl:mixin:APP:library_of_exile-mixins.json:MobEntityMixin,pl:mixin:APP:environmental.mixins.json:MobEntityMixin,pl:mixin:APP:buzzier_bees.mixins.json:MobEntityMixin,pl:mixin:APP:charm.mixins.json:accessor.MobEntityAccessor,pl:mixin:APP:pehkui.mixins.json:compat116plus.MobEntityMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.entity.player.PlayerEntity.func_190775_a(PlayerEntity.java:940) ~[?:?] {re:computing_frames,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:PlayerEntityMixin,pl:mixin:APP:origins.mixins.json:PlayerEntityMixin,pl:mixin:APP:mixins.adorn.json:PlayerEntityMixin,pl:mixin:APP:dungeons_gear.mixins.json:PlayerEntityMixin,pl:mixin:APP:pehkui.mixins.json:EntityVehicleHeightOffsetMixin,pl:mixin:APP:pehkui.mixins.json:PlayerEntityMixin,pl:mixin:APP:pehkui.mixins.json:compat115plus.PlayerEntityMixin,pl:mixin:APP:pehkui.mixins.json:compat116minus.PlayerEntityMixin,pl:mixin:APP:pehkui.mixins.json:reach.PlayerEntityMixin,pl:mixin:APP:caelus.mixins.json:PlayerEntityMixin,pl:mixin:APP:tetra.mixins.json:MixinPlayerEntity,pl:mixin:APP:blue_skies.mixins.json:PlayerEntityMixin,pl:mixin:APP:unionlib.mixins.json:PlayerEntityMixin,pl:mixin:APP:ars_nouveau.mixins.json:ElytraPlayerMixin,pl:mixin:APP:survive.mixins.json:PlayerEntityMixin,pl:mixin:APP:environmental.mixins.json:PlayerEntityMixin,pl:mixin:APP:endergetic.mixins.json:PlayerEntityMixin,pl:mixin:APP:personality.mixins.json:PlayerEntityMixin,pl:mixin:APP:charm.mixins.json:PlayerEntityMixin,pl:mixin:APP:charm.mixins.json:accessor.PlayerEntityAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.network.play.ServerPlayNetHandler.func_147340_a(ServerPlayNetHandler.java:1194) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:randompatches.mixins.json:ServerPlayNetHandlerPlayerSpeedLimitsMixin,pl:mixin:APP:randompatches.mixins.json:timeouts.ServerPlayNetHandlerKeepAliveMixin,pl:mixin:APP:betterendforge.mixins.json:ServerPlayNetHandlerMixin,pl:mixin:APP:origins.mixins.json:ServerPlayNetworkHandlerMixin,pl:mixin:APP:graveyard.mixins.json:ServerPlayNetworkHandlerMixin,pl:mixin:APP:pehkui.mixins.json:ServerPlayNetworkHandlerMixin,pl:mixin:APP:pehkui.mixins.json:reach.ServerPlayNetworkHandlerMixin,pl:mixin:APP:tetra.mixins.json:MixinServerPlayNetHandler,pl:mixin:APP:endergetic.mixins.json:ServerPlayNetHandlerMixin,pl:mixin:A}     at net.minecraft.network.play.client.CUseEntityPacket.func_148833_a(SourceFile:74) ~[?:?] {re:classloading}     at net.minecraft.network.play.client.CUseEntityPacket.func_148833_a(SourceFile:13) ~[?:?] {re:classloading}     at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[?:?] {re:mixin,re:classloading}     at net.minecraft.util.concurrent.TickDelayedTask.run(SourceFile:18) ~[?:?] {re:classloading}     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?] {re:mixin,re:computing_frames,re:classloading}     at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:734) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:159) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:717) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.server.MinecraftServer.func_213168_p(MinecraftServer.java:711) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(SourceFile:103) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}     at net.minecraft.server.MinecraftServer.func_213202_o(MinecraftServer.java:696) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:646) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:paxi.mixins.json:MixinMinecraftServer,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:mixins.shrines.json:MixinMinecraftServer,pl:mixin:APP:roadrunner.mixins.json:world.light_batching.MinecraftServerMixin,pl:mixin:APP:charm.mixins.json:accessor.MinecraftServerAccessor,pl:mixin:A,pl:runtimedistcleaner:A}     at java.lang.Thread.run(Thread.java:832) [?:?] {}  
    • now I have this issue https://gist.github.com/xquao/34697afb553a8c4b75d61995b7602aa1  
    • alredy passed this issue, problem was with one of mods, now trying to find it
  • Topics

×
×
  • Create New...

Important Information

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