use of net.minecraft.server.MinecraftServer in project BloodMagic by WayofTime.
the class ComplexNetworkHandler method getPlayerFromUUID.
public static EntityPlayer getPlayerFromUUID(UUID uuid) {
MinecraftServer server = MinecraftServer.getServer();
GameProfile gameProfile;
gameProfile = server.func_152358_ax().func_152652_a(uuid);
String str = uuid.toString();
// TODO ServerConfigurationManager d.createPlayerForUser
UUID.fromString(str);
return null;
}
use of net.minecraft.server.MinecraftServer in project artisan-worktables by codetaylor.
the class Util method anyPlayerHasContainerOpen.
public static boolean anyPlayerHasContainerOpen(WorldServer world, BlockPos pos) {
MinecraftServer minecraftServer = world.getMinecraftServer();
PlayerList playerList = minecraftServer.getPlayerList();
List<EntityPlayerMP> players = playerList.getPlayers();
for (EntityPlayerMP entityPlayerMP : players) {
if (entityPlayerMP.openContainer instanceof AWContainer) {
TileEntityBase tile = ((AWContainer) entityPlayerMP.openContainer).getTile();
if (tile.getPos().equals(pos)) {
return true;
}
}
}
return false;
}
use of net.minecraft.server.MinecraftServer in project Galacticraft by micdoodle8.
the class VenusTickHandlerServer method onServerTick.
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
// Prevent issues when clients switch to LAN servers
if (server == null) {
return;
}
if (event.phase == Phase.END) {
for (SolarModuleNetwork network : new ArrayList<>(solarModuleNetworks)) {
if (!network.getTransmitters().isEmpty()) {
// network.tickEnd();
} else {
solarModuleNetworks.remove(network);
}
}
int maxPasses = 10;
while (!solarTransmitterUpdates.isEmpty()) {
LinkedList<TileEntitySolarTransmitter> pass = new LinkedList<>();
pass.addAll(solarTransmitterUpdates);
solarTransmitterUpdates.clear();
for (TileEntitySolarTransmitter newTile : pass) {
if (!newTile.isInvalid()) {
newTile.refresh();
}
}
if (--maxPasses <= 0) {
break;
}
}
}
}
use of net.minecraft.server.MinecraftServer in project Galacticraft by micdoodle8.
the class EntityTieredRocket method onUpdate.
@Override
public void onUpdate() {
if (this.getWaitForPlayer()) {
if (!this.getPassengers().isEmpty()) {
Entity passenger = this.getPassengers().get(0);
if (this.ticks >= 40) {
if (!this.world.isRemote) {
this.removePassengers();
passenger.startRiding(this, true);
GCLog.debug("Remounting player in rocket.");
}
this.setWaitForPlayer(false);
this.motionY = -0.5D;
} else {
this.motionX = this.motionY = this.motionZ = 0.0D;
passenger.motionX = passenger.motionY = passenger.motionZ = 0;
}
} else {
this.motionX = this.motionY = this.motionZ = 0.0D;
}
}
super.onUpdate();
if (!this.world.isRemote) {
if (this.launchCooldown > 0) {
this.launchCooldown--;
}
if (this.preGenIterator != null) {
if (this.preGenIterator.hasNext()) {
MinecraftServer mcserver;
if (this.world instanceof WorldServer) {
mcserver = ((WorldServer) this.world).getMinecraftServer();
BlockVec3 coords = this.preGenIterator.next();
World w = mcserver.getWorld(coords.y);
if (w != null) {
w.getChunkFromChunkCoords(coords.x, coords.z);
// Pregen a second chunk if still on launchpad (low strain on server)
if (this.launchPhase < EnumLaunchPhase.LAUNCHED.ordinal() && this.preGenIterator.hasNext()) {
coords = this.preGenIterator.next();
w = mcserver.getWorld(coords.y);
w.getChunkFromChunkCoords(coords.x, coords.z);
}
}
}
} else {
this.preGenIterator = null;
EntityTieredRocket.preGenInProgress = false;
}
}
}
if (this.rumble > 0) {
this.rumble--;
} else if (this.rumble < 0) {
this.rumble++;
}
final double rumbleAmount = this.rumble / (double) (37 - 5 * Math.max(this.getRocketTier(), 5));
for (Entity passenger : this.getPassengers()) {
passenger.posX += rumbleAmount;
passenger.posZ += rumbleAmount;
}
if (this.launchPhase >= EnumLaunchPhase.IGNITED.ordinal()) {
this.performHurtAnimation();
this.rumble = (float) this.rand.nextInt(3) - 3;
}
if (!this.world.isRemote) {
this.lastLastMotionY = this.lastMotionY;
this.lastMotionY = this.motionY;
}
}
use of net.minecraft.server.MinecraftServer in project Galacticraft by micdoodle8.
the class WorldUtil method transferEntityToDimension.
/**
* It is not necessary to use entity.setDead() following calling this method.
* If the entity left the old world it was in, it will now automatically be removed from that old world before the next update tick.
* (See WorldUtil.removeEntityFromWorld())
*/
public static Entity transferEntityToDimension(Entity entity, int dimensionID, WorldServer world, boolean transferInv, EntityAutoRocket ridingRocket) {
if (!world.isRemote) {
// GalacticraftCore.packetPipeline.sendToAll(new PacketSimple(EnumSimplePacket.C_UPDATE_PLANETS_LIST, WorldUtil.getPlanetList()));
MinecraftServer mcServer = world.getMinecraftServer();
if (mcServer != null) {
final WorldServer var6 = mcServer.getWorld(dimensionID);
if (var6 == null) {
System.err.println("Cannot Transfer Entity to Dimension: Could not get World for Dimension " + dimensionID);
return null;
}
final ITeleportType type = GalacticraftRegistry.getTeleportTypeForDimension(var6.provider.getClass());
if (type != null) {
return WorldUtil.teleportEntity(var6, entity, dimensionID, type, transferInv, ridingRocket);
}
}
}
return null;
}
Aggregations