Player can now fall out of Aether with mount.

This commit is contained in:
bconlon 2020-07-19 21:12:19 -07:00
parent 79c68d68b5
commit affa56095d
2 changed files with 14 additions and 6 deletions

View file

@ -1,12 +1,15 @@
package com.legacy.aether.events;
import com.legacy.aether.AetherConfig;
import com.legacy.aether.api.AetherAPI;
import com.legacy.aether.player.PlayerAether;
import com.legacy.aether.world.TeleporterAether;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.living.LivingEvent;
@ -38,15 +41,12 @@ public class AetherEntityEvents {
if (entity.posY <= 0)
{
if (entity.riddenByEntity != null)
if (entity.riddenByEntity instanceof EntityPlayer)
{
entity.riddenByEntity = null;
((PlayerAether) AetherAPI.get((EntityPlayer) entity.riddenByEntity)).riddenEntity = entity;
}
if (entity.ridingEntity != null)
{
entity.ridingEntity = null;
}
entity.riddenByEntity.ridingEntity = null;
entity.timeUntilPortal = 300;
transferEntity(false, entity, server.worldServerForDimension(previousDimension), server.worldServerForDimension(transferDimension));

View file

@ -91,6 +91,8 @@ public class PlayerAether implements IPlayerAether {
public float prevTimeInPortal;
public Entity riddenEntity;
private ChunkCoordinates bedLocation;
public PlayerAether() {
@ -173,6 +175,12 @@ public class PlayerAether implements IPlayerAether {
if (this.getEntity().dimension == AetherConfig.getAetherDimensionID()) {
if (this.getEntity().posY < -2) {
this.teleportPlayer(false);
if (this.riddenEntity != null)
{
this.getEntity().mountEntity(this.riddenEntity);
this.riddenEntity = null;
}
}
}