Is there something wrong with my procedure? please help me out if you know

Started by Galinho_Nerd on

Topic category: Help with MCreator software

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there something wrong with my procedure? please help me out if you know

Hi, i am making a moon mod, and i want that to make the player teleport to the moon dimension when he gets at a Y level of 700, i cant show the photo of my actual procedure ( in blockly editor) because my MCreator is bugged and there is no letters in the procedure boxes, what i can do i show the generated code that i've made:

package net.mcreator.themoon.procedures;

/* imports omitted */

@Mod.EventBusSubscriber

public class MoonTeleportProcedure {

    @SubscribeEvent

    public static void onWorldTick(TickEvent.LevelTickEvent event) {

        if (event.phase == TickEvent.Phase.END) {

            execute(event);

        }

    }



    public static void execute(Entity entity) {

        execute(null, entity);

    }



    private static void execute(@Nullable Event event, Entity entity) {

        if (entity == null)

            return;

        if (entity.getY() == 700) {

            if (entity instanceof ServerPlayer _player && !_player.level.isClientSide()) {

                ResourceKey<Level> destinationType = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_moon:moon"));

                if (_player.level.dimension() == destinationType)

                    return;

                ServerLevel nextLevel = _player.server.getLevel(destinationType);

                if (nextLevel != null) {

                    _player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 0));

                    _player.teleportTo(nextLevel, _player.getX(), _player.getY(), _player.getZ(), _player.getYRot(), _player.getXRot());

                    _player.connection.send(new ClientboundPlayerAbilitiesPacket(_player.getAbilities()));

                    for (MobEffectInstance _effectinstance : _player.getActiveEffects())

                        _player.connection.send(new ClientboundUpdateMobEffectPacket(_player.getId(), _effectinstance));

                    _player.connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false));

                }

            }

        }

    }

}

If anyone knows what this means and could help, please let me know, and if you are seeing this, please reply fast, dont wanna wait 3 years for an reply :D