use of net.minecraft.util.IThreadListener in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class SetShipPilotMessageHandler method onMessage.
@Override
public IMessage onMessage(final SetShipPilotMessage message, final MessageContext ctx) {
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
UUID entityId = message.entityUniqueID;
if (entityId.getLeastSignificantBits() == 0L && entityId.getMostSignificantBits() == 0L) {
ClientPilotingManager.setPilotedWrapperEntity(null);
// System.out.println("got set to null");
} else {
Entity foundEntity = null;
for (Entity entity : Minecraft.getMinecraft().theWorld.getLoadedEntityList()) {
if (entity.entityUniqueID.equals(entityId)) {
ClientPilotingManager.setPilotedWrapperEntity((PhysicsWrapperEntity) entity);
// System.out.println("Found the Pilot on client side");
foundEntity = entity;
}
}
if (foundEntity == null) {
ClientPilotingManager.setPilotedWrapperEntity(null);
}
}
}
});
return null;
}
use of net.minecraft.util.IThreadListener in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EntityFixMessageHandler method onMessage.
@Override
public IMessage onMessage(final EntityFixMessage message, MessageContext ctx) {
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
PhysicsWrapperEntity toFixOn = (PhysicsWrapperEntity) Minecraft.getMinecraft().theWorld.getEntityByID(message.shipId);
if (toFixOn != null) {
if (message.isFixing) {
toFixOn.wrapping.fixEntityUUID(message.entityUUID, message.localPosition);
} else {
toFixOn.wrapping.removeEntityUUID(message.entityUUID);
}
}
}
});
return null;
}
use of net.minecraft.util.IThreadListener in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysWrapperPositionHandler method onMessage.
@Override
public IMessage onMessage(final PhysWrapperPositionMessage message, MessageContext ctx) {
if (Minecraft.getMinecraft().thePlayer == null) {
return null;
}
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
Entity ent = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityID);
if (ent != null && ent instanceof PhysicsWrapperEntity) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) ent;
wrapper.wrapping.coordTransform.stack.pushMessage(message);
// wrapper.wrapping.centerCoord = message.centerOfMass;
//
// wrapper.posX = message.posX;
// wrapper.posY = message.posY;
// wrapper.posZ = message.posZ;
//
// wrapper.pitch = message.pitch;
// wrapper.yaw = message.yaw;
// wrapper.roll = message.roll;
//
// wrapper.wrapping.coordTransform.updateAllTransforms();
}
}
});
return null;
}
use of net.minecraft.util.IThreadListener in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class HovercraftControllerGUIInputHandler method onMessage.
@Override
public IMessage onMessage(final HovercraftControllerGUIInputMessage message, final MessageContext ctx) {
IThreadListener mainThread = ctx.getServerHandler().serverController;
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(ctx.getServerHandler().playerEntity.worldObj, message.tilePos);
TileEntity tileEnt = wrapper.wrapping.VKChunkCache.getTileEntity(message.tilePos);
if (tileEnt != null) {
if (tileEnt instanceof TileEntityHoverController) {
((TileEntityHoverController) tileEnt).handleGUIInput(message, ctx);
}
} else {
System.out.println("Player: " + ctx.getServerHandler().playerEntity.getName() + " sent a broken packet");
}
}
});
return null;
}
use of net.minecraft.util.IThreadListener in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PilotControlsMessageHandler method onMessage.
@Override
public IMessage onMessage(final PilotControlsMessage message, final MessageContext ctx) {
IThreadListener mainThread = ctx.getServerHandler().serverController;
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
World worldObj = ctx.getServerHandler().playerEntity.worldObj;
if (ValkyrienWarfareMod.physicsManager.getManagerForWorld(worldObj) != null) {
UUID shipId = message.shipFor;
for (PhysicsWrapperEntity entity : ValkyrienWarfareMod.physicsManager.getManagerForWorld(worldObj).physicsEntities) {
if (entity.getUniqueID().equals(shipId)) {
entity.wrapping.pilotingController.receivePilotControlsMessage(message, ctx.getServerHandler().playerEntity);
}
}
}
}
});
return null;
}
Aggregations