Jump to content

1.19.2 - Entity not loading after teleportation to a forceloaded chunk


Povstalec
 Share

Recommended Posts

Hello,

I have a block entity that is using entity.teleportTo(x, y, z); to teleport an entity(Armor Stand in this case) into a chunk that's being kept loaded with
ForgeChunkManager.forceChunk(level.getServer().getLevel(Level.OVERWORLD), StargateJourney.MODID, getBlockPos(), level.getChunk(getBlockPos()).getPos().x, level.getChunk(getBlockPos()).getPos().z, true, true);

It works well, however, when I teleport the player alongside the entity, the entity doesn't load. It's still there, because if the player leaves to unload the chunk and then returns, the entity appears where it should.

I've tried fixing it by not forceloading the chunk and the entity loads without problems, but I actually need to have the chunk loaded, because I have a block entity in said chunk, that is ticking(essentially, it's the second end of a teleporter mechanism).

Is there a workaround to load the entity manually or even better, have it never unload in the first place?

Link to comment
Share on other sites

I mean, I don't believe you even need to keep the other chunk loaded, nor really need a block entity. You can just have a capability on the level that links the two spots and whenever a chunk isn't loaded, store the entity in an unloaded cache such that when the chunk is loaded, you add in the entity where it needs to go. You can use the `ChunkEvent$Load` for this. It may cause a deadlock, so you might just want to enqueue the adding back in of the entity using a flag to activate logic on a separate event (e.g. `LevelTickEvent`).

Link to comment
Share on other sites

Technically, yes, I don't neet to keep the chunk loaded, nor do I need the block entity just to teleport stuff there.

But I'm trying to recreate Transport Rings from Stargate, which work by having a platform on each end, that does its own thing. My block entities represent these platforms. Each one takes a different amount of time to get into position animation-wise, so when the first block entity is has already finished its animation, the second entity might still be in the middle of its own animation. Each block entity waits for a certain amount of ticks to change its blockstate at the end of the animation cycle(so that redstone can detect when it's done), so unloading it prematurely/not loading it at all would mean that the blockstate never gets changed and since mysystem works by only allowing block entities to connect to other block entities if they're done animating, the block entity would essentially become inaccesssible until a player loaded it and allowed it to finish its animation.

So unless there's a way to do what I want without a loaded chunk, I'd preferably like to keep the loaded chunk.

I haven't used Capabilities before, so maybe what you told me can be used to fix my problem without getting rid of the loaded chunk, I dunno. I'll see once I learn a bit more about them. But just in case it's not, any other ways to do it?

Link to comment
Share on other sites

5 hours ago, Povstalec said:

But I'm trying to recreate Transport Rings from Stargate, which work by having a platform on each end, that does its own thing. My block entities represent these platforms. Each one takes a different amount of time to get into position animation-wise, so when the first block entity is has already finished its animation, the second entity might still be in the middle of its own animation. Each block entity waits for a certain amount of ticks to change its blockstate at the end of the animation cycle(so that redstone can detect when it's done), so unloading it prematurely/not loading it at all would mean that the blockstate never gets changed and since mysystem works by only allowing block entities to connect to other block entities if they're done animating, the block entity would essentially become inaccesssible until a player loaded it and allowed it to finish its animation.

If I'm understanding correctly, all you are doing is waiting for x amount of time to pass before both can link; you're not actually rendering the other side, correct? In that case, you really could just use a level capability and just have the animation time attached to that, then just check it when teleporting to an unloaded chunk. It seems to me you are using block states to check whether you can teleport (no idea why you're using redstone). You essentially wouldn't need a separate block state anyways if you were just waiting for a given value to be something.

Link to comment
Share on other sites

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

    • The version you are using is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. Currently supported versions are 1.19.2 (Latest) and 1.18.2 (LTS).
    • [27Nov2022 00:00:56.274] [main/FATAL] [net.minecraftforge.fml.ModLoader/CORE]: Error during pre-loading phase 211net.minecraftforge.fml.ModLoadingException: Mod §epixelmon§r only supports §3byg§r §o1.3.4 or above§r 212§7Currently, §3byg§r§7 is §o1.1.6 213at net.minecraftforge.fml.ModLoadingException.lambda$fromEarlyException$0(ModLoadingException.java:64) ~[forge:?] 214at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_352] 215at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) ~[?:1.8.0_352] 216at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_352] 217at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_352] 218at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:1.8.0_352] 219at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:1.8.0_352] 220at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_352] 221at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) ~[?:1.8.0_352] 222at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:272) ~[?:1.8.0_352] 223at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384) ~[?:1.8.0_352] 224at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_352] 225at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_352] 226at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_352] 227at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_352] 228at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[?:1.8.0_352] 229at net.minecraftforge.fml.ModLoader.<init>(ModLoader.java:120) ~[forge:?] 230at net.minecraftforge.fml.ModLoader.get(ModLoader.java:154) ~[forge:?] 231at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge:?] 232at net.minecraft.server.Main.main(Main.java:95) ~[?:?] 233at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_352] 234at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_352] 235at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_352] 236at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_352] 237at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) ~[forge.jar:36.2] 238at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] 239at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] 240at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] 241at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] 242at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] 243at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [forge.jar:?] 244at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [forge.jar:?] 245at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) [forge.jar:?]
    • If you gave me that example in the first place, everything would have been faster and clearer. Sry that I ask so much questions around Capabilites... That system isn't that easy to understand and btw a "Modder Support" forum for me is like a place where I can definitely ask these things if I dont understand them.
    • Hard to say since you don't post the full debug.log   Guess: You are trying to use the 1.18 version of kubejs with 1.19.2?
    • [22:07:73] [main/FATAL]: Mixin prepare failed preparing components.MutableComponentMixin in kubejs-common.mixins.json: org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException @Mixin target type mismatch: net.minecraft.network.chat.MutableComponent is not an interface in org.spongepowered.asm.mixin.transformer.MixinInfo$SubType$Interface@4ea56bdb org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException: @Mixin target type mismatch: net.minecraft.network.chat.MutableComponent is not an interface in org.spongepowered.asm.mixin.transformer.MixinInfo$SubType$Interface@4ea56bdb     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo$SubType.validateTarget(MixinInfo.java:552)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.getTargetClass(MixinInfo.java:1026)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.readTargetClasses(MixinInfo.java:1007)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.parseTargets(MixinInfo.java:895)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinConfig.prepareMixins(MixinConfig.java:867)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinConfig.prepare(MixinConfig.java:775)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.prepareConfigs(MixinProcessor.java:539)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.select(MixinProcessor.java:462)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.checkSelect(MixinProcessor.java:438)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:290)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:113)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:632)     at java.base/java.lang.Class.forName(Class.java:545)     at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.47/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.run(Launcher.java:106)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)     at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) Exception in thread "main" java.lang.RuntimeException: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [kubejs-common.mixins.json:components.MutableComponentMixin] from phase [DEFAULT] in config [kubejs-common.mixins.json] FAILED during PREPARE     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:32)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.run(Launcher.java:106)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)     at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [kubejs-common.mixins.json:components.MutableComponentMixin] from phase [DEFAULT] in config [kubejs-common.mixins.json] FAILED during PREPARE     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinError(MixinProcessor.java:636)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinPrepareError(MixinProcessor.java:584)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.prepareConfigs(MixinProcessor.java:542)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.select(MixinProcessor.java:462)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.checkSelect(MixinProcessor.java:438)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:290)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:113)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229)     at cpw.mods.securejarhandler/cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:632)     at java.base/java.lang.Class.forName(Class.java:545)     at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.47/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27)     at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)     ... 7 more Caused by: org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException: @Mixin target type mismatch: net.minecraft.network.chat.MutableComponent is not an interface in org.spongepowered.asm.mixin.transformer.MixinInfo$SubType$Interface@4ea56bdb     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo$SubType.validateTarget(MixinInfo.java:552)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.getTargetClass(MixinInfo.java:1026)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.readTargetClasses(MixinInfo.java:1007)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinInfo.parseTargets(MixinInfo.java:895)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinConfig.prepareMixins(MixinConfig.java:867)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinConfig.prepare(MixinConfig.java:775)     at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.prepareConfigs(MixinProcessor.java:539)     ... 25 more
  • Topics

×
×
  • Create New...

Important Information

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