Skip to content
Permalink
Browse files

Portals now use the new teleporter function from MDX. No more in-wall…

… teleporting.
  • Loading branch information...
Ri5ux committed Jun 14, 2019
1 parent 1ca567e commit 9f12f532a46babdcf3ec87538d855aaa64b0df33
Showing with 2 additions and 22 deletions.
  1. +2 −22 src/main/java/org/avp/block/BlockPortal.java
@@ -14,9 +14,7 @@
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.Teleporter;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -73,31 +71,13 @@ public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, En
if (player.dimension != this.dimension.getId())
{
player.timeUntilPortal = 10;
teleportPlayerToDimension(player, this.dimension.getId());
dimension.transferEntityTo(player);
}
else
{
player.timeUntilPortal = 10;
teleportPlayerToDimension(player, 0);
Dimension.transferEntityTo(player, 0);
}
}
}

public static void teleportPlayerToDimension(EntityPlayerMP player, int dimension)
{
player.getServer().getPlayerList().transferPlayerToDimension(player, dimension, new Teleporter(player.getServerWorld())
{
@Override
public void placeInPortal(Entity entityIn, float rotationYaw)
{
int x = MathHelper.floor(entityIn.posX);
int y = MathHelper.floor(entityIn.posY) - 1;
int z = MathHelper.floor(entityIn.posZ);
entityIn.setLocationAndAngles((double) x, (double) y, (double) z, entityIn.rotationYaw, 0.0F);
entityIn.motionX = 0.0D;
entityIn.motionY = 0.0D;
entityIn.motionZ = 0.0D;
}
});
}
}

0 comments on commit 9f12f53

Please sign in to comment.
You can’t perform that action at this time.