Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.ocmd.procedures;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.event.TickEvent;
- import net.minecraftforge.common.MinecraftForge;
- import net.minecraft.world.IWorld;
- import net.minecraft.util.text.StringTextComponent;
- import net.minecraft.item.ItemStack;
- import net.minecraft.entity.player.ServerPlayerEntity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.entity.Entity;
- import net.mcreator.ocmd.OcmMod;
- import java.util.Map;
- import java.util.Collections;
- public class TeleportationcrystalEvenementAuClicDroitDansLairProcedure {
- public static void executeProcedure(Map<String, Object> dependencies) {
- if (dependencies.get("world") == null) {
- if (!dependencies.containsKey("world"))
- OcmMod.LOGGER.warn("Failed to load dependency world for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- if (dependencies.get("x") == null) {
- if (!dependencies.containsKey("x"))
- OcmMod.LOGGER.warn("Failed to load dependency x for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- if (dependencies.get("y") == null) {
- if (!dependencies.containsKey("y"))
- OcmMod.LOGGER.warn("Failed to load dependency y for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- if (dependencies.get("z") == null) {
- if (!dependencies.containsKey("z"))
- OcmMod.LOGGER.warn("Failed to load dependency z for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- if (dependencies.get("entity") == null) {
- if (!dependencies.containsKey("entity"))
- OcmMod.LOGGER.warn("Failed to load dependency entity for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- if (dependencies.get("itemstack") == null) {
- if (!dependencies.containsKey("itemstack"))
- OcmMod.LOGGER.warn("Failed to load dependency itemstack for procedure TeleportationcrystalEvenementAuClicDroitDansLair!");
- return;
- }
- IWorld world = (IWorld) dependencies.get("world");
- double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
- double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y");
- double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
- Entity entity = (Entity) dependencies.get("entity");
- ItemStack itemstack = (ItemStack) dependencies.get("itemstack");
- if (entity.isSneaking()) {
- itemstack.getOrCreateTag().putDouble("posx", x);
- itemstack.getOrCreateTag().putDouble("posy", y);
- itemstack.getOrCreateTag().putDouble("posz", z);
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("Position sauvegard\u00E9"), (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble("playertpposx", x);
- itemstack.getOrCreateTag().putDouble("playertpposy", y);
- itemstack.getOrCreateTag().putDouble("playertpposz", z);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world, int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS.register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("T\u00E9l\u00E9portation dans 5 secondes..."), (false));
- }
- if (itemstack.getOrCreateTag().getDouble("playeractualposz") != itemstack.getOrCreateTag().getDouble("playertpposx")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"), (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposy") != itemstack.getOrCreateTag().getDouble("playertpposy")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"), (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposx") != itemstack.getOrCreateTag().getDouble("playertpposz")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble("playeractualposz", z);
- itemstack.getOrCreateTag().putDouble("playeractualposy", y);
- itemstack.getOrCreateTag().putDouble("playeractualposx", x);
- itemstack.getOrCreateTag().putDouble("playeractualposz", z);
- itemstack.getOrCreateTag().putDouble("playeractualposy", y);
- itemstack.getOrCreateTag().putDouble("playeractualposx", x);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world, int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS.register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation dans 4 secondes..."), (false));
- }
- if (itemstack.getOrCreateTag().getDouble("playeractualposz") != itemstack.getOrCreateTag()
- .getDouble("playertpposx")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity)
- .sendStatusMessage(new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"), (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposy") != itemstack.getOrCreateTag()
- .getDouble("playertpposy")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"), (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposx") != itemstack.getOrCreateTag()
- .getDouble("playertpposz")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"), (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble("playeractualposz", z);
- itemstack.getOrCreateTag().putDouble("playeractualposy", y);
- itemstack.getOrCreateTag().putDouble("playeractualposx", x);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world, int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS.register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation dans 3 secondes..."),
- (false));
- }
- if (itemstack.getOrCreateTag().getDouble("playeractualposz") != itemstack.getOrCreateTag()
- .getDouble("playertpposx")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposy") != itemstack
- .getOrCreateTag().getDouble("playertpposy")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble("playeractualposx") != itemstack
- .getOrCreateTag().getDouble("playertpposz")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent("T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble("playeractualposz", z);
- itemstack.getOrCreateTag().putDouble("playeractualposy", y);
- itemstack.getOrCreateTag().putDouble("playeractualposx", x);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world, int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS.register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation dans 2 secondes..."),
- (false));
- }
- if (itemstack.getOrCreateTag()
- .getDouble("playeractualposz") != itemstack.getOrCreateTag()
- .getDouble("playertpposx")) {
- if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag()
- .getDouble("playeractualposy") != itemstack
- .getOrCreateTag().getDouble("playertpposy")) {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag()
- .getDouble("playeractualposx") != itemstack
- .getOrCreateTag().getDouble("playertpposz")) {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble("playeractualposz",
- z);
- itemstack.getOrCreateTag().putDouble("playeractualposy",
- y);
- itemstack.getOrCreateTag().putDouble("playeractualposx",
- x);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world, int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS.register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation dans 1 secondes..."),
- (false));
- }
- if (itemstack.getOrCreateTag().getDouble(
- "playeractualposz") != itemstack
- .getOrCreateTag()
- .getDouble("playertpposx")) {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity).sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble(
- "playeractualposy") != itemstack
- .getOrCreateTag()
- .getDouble("playertpposy")) {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity)
- .sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- if (itemstack.getOrCreateTag().getDouble(
- "playeractualposx") != itemstack
- .getOrCreateTag()
- .getDouble(
- "playertpposz")) {
- if (entity instanceof PlayerEntity
- && !entity.world.isRemote()) {
- ((PlayerEntity) entity)
- .sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation annul\u00E9 !"),
- (false));
- }
- } else {
- itemstack.getOrCreateTag().putDouble(
- "playeractualposz", z);
- itemstack.getOrCreateTag().putDouble(
- "playeractualposy", y);
- itemstack.getOrCreateTag().putDouble(
- "playeractualposx", x);
- new Object() {
- private int ticks = 0;
- private float waitTicks;
- private IWorld world;
- public void start(IWorld world,
- int waitTicks) {
- this.waitTicks = waitTicks;
- MinecraftForge.EVENT_BUS
- .register(this);
- this.world = world;
- }
- @SubscribeEvent
- public void tick(
- TickEvent.ServerTickEvent event) {
- if (event.phase == TickEvent.Phase.END) {
- this.ticks += 1;
- if (this.ticks >= this.waitTicks)
- run();
- }
- }
- private void run() {
- if (entity instanceof PlayerEntity
- && !entity.world
- .isRemote()) {
- ((PlayerEntity) entity)
- .sendStatusMessage(
- new StringTextComponent(
- "T\u00E9l\u00E9portation !"),
- (false));
- }
- {
- Entity _ent = entity;
- _ent.setPositionAndUpdate(
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posx")),
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posy")),
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posz")));
- if (_ent instanceof ServerPlayerEntity) {
- ((ServerPlayerEntity) _ent).connection
- .setPlayerLocation(
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posx")),
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posy")),
- (itemstack
- .getOrCreateTag()
- .getDouble(
- "posz")),
- _ent.rotationYaw,
- _ent.rotationPitch,
- Collections
- .emptySet());
- }
- }
- MinecraftForge.EVENT_BUS
- .unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
- MinecraftForge.EVENT_BUS.unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
- MinecraftForge.EVENT_BUS.unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
- MinecraftForge.EVENT_BUS.unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
- MinecraftForge.EVENT_BUS.unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
- MinecraftForge.EVENT_BUS.unregister(this);
- }
- }.start(world, (int) 20);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment