package net.paladrill.paladrillmod.procedure; import net.paladrill.paladrillmod.ElementsPaladrillmodMod; import net.minecraftforge.common.DimensionManager; import net.minecraft.world.WorldServer; import net.minecraft.world.World; import net.minecraft.world.Teleporter; import net.minecraft.util.SoundCategory; import net.minecraft.util.ResourceLocation; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.Entity; import java.util.Map; @ElementsPaladrillmodMod.ModElement.Tag public class ProcedureEndCommandExecuted extends ElementsPaladrillmodMod.ModElement { public ProcedureEndCommandExecuted(ElementsPaladrillmodMod instance) { super(instance, 243); } public static void executeProcedure(Map dependencies) { if (dependencies.get("entity") == null) { System.err.println("Failed to load dependency entity for procedure EndCommandExecuted!"); return; } if (dependencies.get("x") == null) { System.err.println("Failed to load dependency x for procedure EndCommandExecuted!"); return; } if (dependencies.get("y") == null) { System.err.println("Failed to load dependency y for procedure EndCommandExecuted!"); return; } if (dependencies.get("z") == null) { System.err.println("Failed to load dependency z for procedure EndCommandExecuted!"); return; } if (dependencies.get("world") == null) { System.err.println("Failed to load dependency world for procedure EndCommandExecuted!"); return; } Entity entity = (Entity) dependencies.get("entity"); int x = (int) dependencies.get("x"); int y = (int) dependencies.get("y"); int z = (int) dependencies.get("z"); World world = (World) dependencies.get("world"); if ((entity.canUseCommand((int) 4, ""))) { { Entity _ent = entity; if (!_ent.world.isRemote && !_ent.isRiding() && !_ent.isBeingRidden() && _ent instanceof EntityPlayerMP) { int dimensionID = 1; class TeleporterDirect extends Teleporter { public TeleporterDirect(WorldServer worldserver) { super(worldserver); } @Override public void placeInPortal(Entity entity, float yawrotation) { } @Override public boolean placeInExistingPortal(Entity entity, float yawrotation) { return true; } @Override public boolean makePortal(Entity entity) { return true; } } EntityPlayerMP _player = (EntityPlayerMP) _ent; _player.mcServer.getPlayerList().transferPlayerToDimension(_player, dimensionID, new TeleporterDirect(_player.getServerWorld())); _player.connection.setPlayerLocation(DimensionManager.getWorld(dimensionID).getSpawnPoint().getX(), DimensionManager.getWorld(dimensionID).getSpawnPoint().getY() + 1, DimensionManager.getWorld(dimensionID).getSpawnPoint().getZ(), _player.rotationYaw, _player.rotationPitch); } } world.playSound((EntityPlayer) null, x, y, z, (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY .getObject(new ResourceLocation("entity.endermen.teleport")), SoundCategory.NEUTRAL, (float) 1, (float) 1); } } }