diff --git a/src/main/java/me/planetguy/remaininmotion/core/ModRiM.java b/src/main/java/me/planetguy/remaininmotion/core/ModRiM.java index ab11223..2964338 100644 --- a/src/main/java/me/planetguy/remaininmotion/core/ModRiM.java +++ b/src/main/java/me/planetguy/remaininmotion/core/ModRiM.java @@ -1,6 +1,8 @@ package me.planetguy.remaininmotion.core; import java.io.File; +import java.util.HashMap; +import java.util.UUID; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -24,7 +26,10 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; @Mod(modid = ModRiM.Handle, name = ModRiM.Title, version = ModRiM.Version, dependencies = "required-after:planetguyLib;after:CoFHCore;after:BuildCraft|Transport") public class ModRiM { @@ -41,7 +46,9 @@ public class ModRiM { public static PLHelper plHelper; @Instance(ModRiM.Handle) - public static Object instance; + public static ModRiM instance; + + //public HashMap playerMountMap = new HashMap(); @EventHandler public void PreInit(FMLPreInitializationEvent Event) { @@ -130,4 +137,15 @@ public void onJoin(PlayerEvent.PlayerLoggedInEvent event){ if(((EntityPlayerMP) event.player).isClientWorld()) PacketSpecterVelocity.send((EntityPlayerMP) event.player); } + + /*@SubscribeEvent + public void onFinishTeleporting(EntityJoinWorldEvent event){ + if(!(event.entity instanceof EntityPlayerMP)) return; + Integer mount = playerMountMap.get(event.entity.getUniqueID()); + if(mount != null) { + Entity entity = event.world.getEntityByID(mount); + ((EntityPlayerMP)event.entity).mountEntity(entity); + playerMountMap.remove(event.entity.getUniqueID()); + } + }*/ } diff --git a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java index 9fcfce2..dd52678 100644 --- a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java +++ b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java @@ -464,7 +464,7 @@ public void fixLagError(CapturedEntity capture, Entity entity) { capture.SetYPosition(motionDirection.deltaY + 0.025); } else { if(motionX != 0 || motionZ != 0) { - double[] motion = handleCollision(entity, motionX, motionZ); + double[] motion = handleEntityCollision(entity, motionX, motionZ); capture.netMotionX += motion[0]; capture.netMotionZ += motion[1]; } @@ -472,7 +472,7 @@ public void fixLagError(CapturedEntity capture, Entity entity) { } - public void doPerSpectreUpdate(CapturedEntity capture, Entity entity) { + public void doPerSpectreEntityUpdate(CapturedEntity capture, Entity entity) { entity.fallDistance = 0; if(motionDirection.deltaX != capture.netMotionX || motionDirection.deltaZ != capture.netMotionZ || motionDirection.deltaY != capture.netMotionY) { @@ -490,7 +490,7 @@ public void doPerSpectreUpdate(CapturedEntity capture, Entity entity) { capture.SetPosition(motionX, 0, motionZ); capture.SetYPosition(capture.netMotionY); } else { - double[] motion = handleCollision(entity, motionX, motionZ); + double[] motion = handleEntityCollision(entity, motionX, motionZ); motionX = motion[0]; motionZ = motion[1]; @@ -507,7 +507,7 @@ public void doPerSpectreUpdate(CapturedEntity capture, Entity entity) { } } - private double[] handleCollision(Entity entity, double motionX, double motionZ) { + private double[] handleEntityCollision(Entity entity, double motionX, double motionZ) { double X = motionX; double Z = motionZ; List list = this.worldObj.getCollidingBoundingBoxes(entity, entity.boundingBox.addCoord(X, 0, Z)); @@ -752,7 +752,7 @@ public void SetYPosition(double OffsetY) { } public void Update() { - doPerSpectreUpdate(this, entity); + doPerSpectreEntityUpdate(this, entity); } public void stop() { diff --git a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityRotativeSpectre.java b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityRotativeSpectre.java index 3024a6e..1aa1d7e 100644 --- a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityRotativeSpectre.java +++ b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityRotativeSpectre.java @@ -52,7 +52,7 @@ public void announceTEConstruction(BlockRecord record) { } @Override - public void doPerSpectreUpdate(CapturedEntity capture, Entity entity) { + public void doPerSpectreEntityUpdate(CapturedEntity capture, Entity entity) { if(capture.startingPosition == null) { capture.startingPosition=new Matrix(new double[][] { { entity.posX }, { entity.posY }, { entity.posZ } }); } diff --git a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityTeleportativeSpectre.java b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityTeleportativeSpectre.java index 159f197..0e3ed62 100644 --- a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityTeleportativeSpectre.java +++ b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityTeleportativeSpectre.java @@ -1,5 +1,6 @@ package me.planetguy.remaininmotion.spectre; +import me.planetguy.remaininmotion.core.ModRiM; import me.planetguy.remaininmotion.motion.CarriagePackage; import me.planetguy.remaininmotion.util.position.BlockRecord; import me.planetguy.remaininmotion.util.position.BlockRecordSet; @@ -209,6 +210,7 @@ public Entity TeleportEntity(Entity entity) { entity.mountEntity(null); Mount = TeleportEntity(Mount); + //ModRiM.instance.playerMountMap.put(entity.getUniqueID(), Mount.getEntityId()); } if (entity instanceof EntityPlayerMP) {