File Details
Teleporter mod
- R
- Aug 2, 2021
- 154.97 KB
- 2.4K
- 1.16.5
- Forge
File Name
Teleporte mod 1.16.5.jar
Supported Versions
- 1.16.5
Curse Maven Snippet
The code:
package net.mcreator.testtwo.procedures;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraft.world.World;
import net.minecraft.world.IWorld;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.block.BlockState;
import net.mcreator.testtwo.TeleporterModModElements;
import net.mcreator.testtwo.TeleporterModMod;
import java.util.Map;
import java.util.Collections;
@TeleporterModModElements.ModElement.Tag
public class TeleporterWennBlockRechtsGeklicktWirdProcedure extends TeleporterModModElements.ModElement {
public TeleporterWennBlockRechtsGeklicktWirdProcedure(TeleporterModModElements instance) {
super(instance, 1);
}
public static void executeProcedure(Map<String, Object> dependencies) {
if (dependencies.get("entity") == null) {
if (!dependencies.containsKey("entity"))
TeleporterModMod.LOGGER.warn("Failed to load dependency entity for procedure TeleporterWennBlockRechtsGeklicktWird!");
return;
}
if (dependencies.get("x") == null) {
if (!dependencies.containsKey("x"))
TeleporterModMod.LOGGER.warn("Failed to load dependency x for procedure TeleporterWennBlockRechtsGeklicktWird!");
return;
}
if (dependencies.get("y") == null) {
if (!dependencies.containsKey("y"))
TeleporterModMod.LOGGER.warn("Failed to load dependency y for procedure TeleporterWennBlockRechtsGeklicktWird!");
return;
}
if (dependencies.get("z") == null) {
if (!dependencies.containsKey("z"))
TeleporterModMod.LOGGER.warn("Failed to load dependency z for procedure TeleporterWennBlockRechtsGeklicktWird!");
return;
}
if (dependencies.get("world") == null) {
if (!dependencies.containsKey("world"))
TeleporterModMod.LOGGER.warn("Failed to load dependency world for procedure TeleporterWennBlockRechtsGeklicktWird!");
return;
}
Entity entity = (Entity) dependencies.get("entity");
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");
IWorld world = (IWorld) dependencies.get("world");
if ((((entity instanceof LivingEntity) ? ((LivingEntity) entity).getHeldItemMainhand() : ItemStack.EMPTY)
.getItem() == new ItemStack(Items.ENDER_EYE, (int) (1)).getItem())) {
if (((new Object() {
public boolean getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getBoolean(tag);
return false;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "isBlockLinked")) == (false))) {
if (((entity.getPersistentData().getBoolean("playerHasStoredTeleporter")) == (true))) {
if (((x == (entity.getPersistentData().getDouble("playerTeleporterPosX")))
&& ((y == (entity.getPersistentData().getDouble("playerTeleporterPosY")))
&& (z == (entity.getPersistentData().getDouble("playerTeleporterPosZ")))))) {
if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("You can't link the portal to it's self!"), (false));
}
} else {
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosX",
(entity.getPersistentData().getDouble("playerTeleporterPosX")));
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosY",
(entity.getPersistentData().getDouble("playerTeleporterPosY")));
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosZ",
(entity.getPersistentData().getDouble("playerTeleporterPosZ")));
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")));
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosX", x);
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")));
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosY", y);
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")));
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putDouble("blockTeleporterPosZ", z);
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putBoolean("isBlockLinked", (true));
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
if (!world.isRemote()) {
BlockPos _bp = new BlockPos((int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), (int) (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")));
TileEntity _tileEntity = world.getTileEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_tileEntity != null)
_tileEntity.getTileData().putBoolean("isBlockLinked", (true));
if (world instanceof World)
((World) world).notifyBlockUpdate(_bp, _bs, _bs, 3);
}
entity.getPersistentData().putBoolean("playerHasStoredTeleporter", (false));
if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("The teleporter has been linked"), (false));
}
if (world instanceof World && !world.isRemote()) {
((World) world).playSound(null, new BlockPos((int) x, (int) y, (int) z),
(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS
.getValue(new ResourceLocation("block.end_portal_frame.fill")),
SoundCategory.NEUTRAL, (float) 1, (float) 1);
} else {
((World) world).playSound(x, y, z,
(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS
.getValue(new ResourceLocation("block.end_portal_frame.fill")),
SoundCategory.NEUTRAL, (float) 1, (float) 1, false);
}
}
} else {
entity.getPersistentData().putDouble("playerTeleporterPosX", x);
entity.getPersistentData().putDouble("playerTeleporterPosY", y);
entity.getPersistentData().putDouble("playerTeleporterPosZ", z);
entity.getPersistentData().putBoolean("playerHasStoredTeleporter", (true));
if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
((PlayerEntity) entity).sendStatusMessage(new StringTextComponent(
(("Current Portal Location: ") + "" + ("X: ") + "" + ((entity.getPersistentData().getDouble("playerTeleporterPosX")))
+ "" + (" Y: ") + "" + ((entity.getPersistentData().getDouble("playerTeleporterPosY"))) + "" + (" Z: ") + ""
+ ((entity.getPersistentData().getDouble("playerTeleporterPosZ"))) + "" + (" Stored: ") + ""
+ ((entity.getPersistentData().getBoolean("playerHasStoredTeleporter"))))),
(false));
}
}
}
} else {
if (((new Object() {
public boolean getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getBoolean(tag);
return false;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "isBlockLinked")) == (true))) {
{
Entity _ent = entity;
_ent.setPositionAndUpdate(((new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")) + 0.5), (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), ((new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")) + 0.5));
if (_ent instanceof ServerPlayerEntity) {
((ServerPlayerEntity) _ent).connection.setPlayerLocation(((new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosX")) + 0.5), (new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosY")), ((new Object() {
public double getValue(IWorld world, BlockPos pos, String tag) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity != null)
return tileEntity.getTileData().getDouble(tag);
return -1;
}
}.getValue(world, new BlockPos((int) x, (int) y, (int) z), "blockTeleporterPosZ")) + 0.5), _ent.rotationYaw,
_ent.rotationPitch, Collections.emptySet());
}
}
entity.rotationYaw = (float) ((entity.rotationYaw));
entity.setRenderYawOffset(entity.rotationYaw);
entity.prevRotationYaw = entity.rotationYaw;
if (entity instanceof LivingEntity) {
((LivingEntity) entity).prevRenderYawOffset = entity.rotationYaw;
((LivingEntity) entity).rotationYawHead = entity.rotationYaw;
((LivingEntity) entity).prevRotationYawHead = entity.rotationYaw;
}
entity.rotationPitch = (float) ((entity.rotationPitch));
if (entity instanceof PlayerEntity && !entity.world.isRemote()) {
((PlayerEntity) entity).sendStatusMessage(new StringTextComponent("\u00A72You have been teleported!"), (false));
}
}
}
}
}