@Override public LivingEntity _INVALID_getShooter() { if (shooter instanceof LivingEntity) { return (LivingEntity)shooter; } if (shooter instanceof BlockProjectileSource) { Block block = ((BlockProjectileSource)shooter).getBlock(); if(!(block.getWorld() instanceof WorldServer))return null; int x = block.getX(), y = block.getY(), z = block.getZ(); WorldServer ws = (WorldServer)block.getWorld(); EntityPlayerMP fake_dropper = new EntityPlayerMP(MinecraftServer.getServer(), ws, dropper, new ItemInWorldManager(MinecraftServer.getServer().worldServerForDimension(0))); fake_dropper.posX = x; fake_dropper.posY = y; fake_dropper.posZ = z; CraftEntity ce = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(MinecraftServer.getServer().server, fake_dropper); if(ce instanceof LivingEntity) return (LivingEntity)ce; return null; } return null; }
public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { super(p_i45285_2_, p_i45285_3_); p_i45285_4_.thisPlayerMP = this; this.theItemInWorldManager = p_i45285_4_; ChunkCoordinates chunkcoordinates = p_i45285_2_.provider.getRandomizedSpawnPoint(); int i = chunkcoordinates.posX; int j = chunkcoordinates.posZ; int k = chunkcoordinates.posY; this.mcServer = p_i45285_1_; this.field_147103_bO = p_i45285_1_.getConfigurationManager().func_152602_a(this); this.stepHeight = 0.0F; this.yOffset = 0.0F; this.setLocationAndAngles((double)i + 0.5D, (double)k, (double)j + 0.5D, 0.0F, 0.0F); while (!p_i45285_2_.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) { this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } }
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) { super(worldIn, profile); interactionManager.thisPlayerMP = this; this.theItemInWorldManager = interactionManager; BlockPos blockpos = worldIn.getSpawnPoint(); if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) { int i = Math.max(5, server.getSpawnProtectionSize() - 6); int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); if (j < i) { i = j; } if (j <= 1) { i = 1; } blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos.add(this.rand.nextInt(i * 2) - i, 0, this.rand.nextInt(i * 2) - i)); } this.mcServer = server; this.statsFile = server.getConfigurationManager().getPlayerStatsFile(this); this.stepHeight = 0.0F; this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F); while (!worldIn.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D) { this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } }
public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile profile, ItemInWorldManager itemInWorldManager) { super(server, WorldUtil.getStartWorld(world), profile, itemInWorldManager); if (this.worldObj != world) { GCPlayerStats.get(this).startAdventure(WorldUtil.getDimensionName(this.worldObj.provider)); } }
public InteractionLiason(WorldServer world, ItemInWorldManager itemManager, EntityPlayerMP realPlayer, IDimensionSlice idc) { super(MinecraftServer.getServer(), world, realPlayer.getGameProfile(), itemManager); original_inventory = this.inventory; realPlayerRef = new WeakReference<EntityPlayerMP>(realPlayer); initLiason(); updateFromPlayerStatus(); NORELEASE.println("An interaction liason has channel: " + networkManager.channel()); }
public PacketProxyingPlayer(final DimensionSliceEntity dimensionSlice, World shadowWorld) { super(MinecraftServer.getServer(), (WorldServer) shadowWorld, proxyProfile, new ItemInWorldManager(shadowWorld)); invulnerable = true; isImmuneToFire = true; this.dimensionSlice = new WeakReference<DimensionSliceEntity>(dimensionSlice); Coord c = dimensionSlice.getCenter(); { Chunk chunk = c.getChunk(); int chunkX = c.x >> 4, chunkZ = c.z >> 4; if (chunk.xPosition != chunkX || chunk.zPosition != chunkZ) { Core.logSevere("Getting chunk at chunk coordinates " + chunkX + "," + chunkZ + " returned chunk with *wrong* coordinates: " + chunk.xPosition + "," + chunk.zPosition); } } c.y = -8; // lurk in the void; we should catch most mod's packets. DeltaCoord size = dimensionSlice.getMaxCorner().difference(dimensionSlice.getMinCorner()); size.y = 0; int width = Math.abs(size.x); int depth = Math.abs(size.z); double blockRadius = Math.max(width, depth) / 2; int chunkRadius = (int) ((blockRadius / 16) + 2); chunkRadius = Math.max(3, chunkRadius); c.setAsEntityLocation(this); preinitWrapping(); ServerConfigurationManager scm = MinecraftServer.getServer().getConfigurationManager(); if (useShortViewRadius) { int orig = savePlayerViewRadius(); restorePlayerViewRadius(chunkRadius); try { scm.preparePlayer(this, null /* previous world; allowed to be null */); } finally { restorePlayerViewRadius(orig); // altho the server might just crash anyways. Then again, there might be a handler higher up. } } else { scm.preparePlayer(this, null /* previous world; allowed to be null */); } initWrapping(); }
public GhostEntityPlayerMP(ICommandSender sender) { super(MinecraftServer.getServer(), (WorldServer) sender.getEntityWorld(), new GameProfile(null, sender.getCommandSenderName()), new ItemInWorldManager(sender.getEntityWorld())); name = sender.getCommandSenderName(); this.posX = sender.getPlayerCoordinates().posX; this.posY = sender.getPlayerCoordinates().posY; this.posZ = sender.getPlayerCoordinates().posZ; }
public static void intercept( ItemInWorldManager iiwm, int x, int y, int z ) { Iterator< IBlockDestroyedMonitor > it = monitors.iterator(); while ( it.hasNext() ) { IBlockDestroyedMonitor mod = it.next(); mod.blockDestroyed( iiwm, x, y, z ); } }
public CustomNPCEntityPlayerMPImpl(EntityNPCInterface sender) { super(MinecraftServer.getServer(), (WorldServer) sender.getEntityWorld(), new GameProfile(null, sender.getCommandSenderName()), new ItemInWorldManager(sender.getEntityWorld())); name = sender.getCommandSenderName(); this.posX = sender.getPlayerCoordinates().posX; this.posY = sender.getPlayerCoordinates().posY; this.posZ = sender.getPlayerCoordinates().posZ; }
public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { super(p_i45285_2_, p_i45285_3_); p_i45285_4_.thisPlayerMP = this; this.theItemInWorldManager = p_i45285_4_; this.renderDistance = p_i45285_1_.getConfigurationManager().getViewDistance(); ChunkCoordinates var5 = p_i45285_2_.getSpawnPoint(); int var6 = var5.posX; int var7 = var5.posZ; int var8 = var5.posY; if (!p_i45285_2_.provider.hasNoSky && p_i45285_2_.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) { int var9 = Math.max(5, p_i45285_1_.getSpawnProtectionSize() - 6); var6 += this.rand.nextInt(var9 * 2) - var9; var7 += this.rand.nextInt(var9 * 2) - var9; var8 = p_i45285_2_.getTopSolidOrLiquidBlock(var6, var7); } this.mcServer = p_i45285_1_; this.field_147103_bO = p_i45285_1_.getConfigurationManager().func_148538_i(this.getCommandSenderName()); this.stepHeight = 0.0F; this.yOffset = 0.0F; this.setLocationAndAngles((double)var6 + 0.5D, (double)var8, (double)var7 + 0.5D, 0.0F, 0.0F); while (!p_i45285_2_.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) { this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } }
public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { super(p_i45285_2_, p_i45285_3_); p_i45285_4_.thisPlayerMP = this; this.theItemInWorldManager = p_i45285_4_; ChunkCoordinates chunkcoordinates = p_i45285_2_.provider.getRandomizedSpawnPoint(); int i = chunkcoordinates.posX; int j = chunkcoordinates.posZ; int k = chunkcoordinates.posY; this.mcServer = p_i45285_1_; this.field_147103_bO = p_i45285_1_.getConfigurationManager().func_152602_a(this); this.stepHeight = 0.0F; this.yOffset = 0.0F; this.setLocationAndAngles((double)i + 0.5D, (double)k, (double)j + 0.5D, 0.0F, 0.0F); while (!p_i45285_2_.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) { this.setPosition(this.posX, this.posY + 1.0D, this.posZ); } // CraftBukkit start this.displayName = this.getCommandSenderName(); this.listName = this.getCommandSenderName(); // this.canPickUpLoot = true; TODO this.maxHealthCache = this.getMaxHealth(); // CraftBukkit end }
public boolean isDigging(){ if(isDigging == null) isDigging = ReflectionHelper.findField(ItemInWorldManager.class, "field_73088_d", "isDestroyingBlock"); try { return isDigging.getBoolean(this); } catch(Exception e) { Log.error("Drone FakePlayerItemInWorldManager failed with reflection (Digging)!"); e.printStackTrace(); return true; } }
public boolean isAcknowledged(){ if(acknowledged == null) acknowledged = ReflectionHelper.findField(ItemInWorldManager.class, "field_73097_j", "receivedFinishDiggingPacket"); try { return acknowledged.getBoolean(this); } catch(Exception e) { Log.error("Drone FakePlayerItemInWorldManager failed with reflection (Acknowledge get)!"); e.printStackTrace(); return true; } }
public FakePlayer(WorldServer world, GameProfile name) { super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world)); }
InteractionLiason getLiason(WorldServer shadowWorld, EntityPlayerMP real_player, IDimensionSlice idc) { // NORELEASE: Cache. Constructing fake players is muy expensivo InteractionLiason liason = new InteractionLiason(shadowWorld, new ItemInWorldManager(shadowWorld), real_player, idc); liason.initializeFor(idc); return liason; }
public void cancelLeftClick() { ItemInWorldManager manager = player.theItemInWorldManager; if(manager.isDestroyingBlock) player.theItemInWorldManager.cancelDestroyingBlock(manager.partiallyDestroyedBlockX, manager.partiallyDestroyedBlockY, manager.partiallyDestroyedBlockZ); }
@Inject(method = "<init>", at = @At("RETURN")) public void onConstruction(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager, CallbackInfo info) { this.initPlayerData(); }
public STPEntityPlayer(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { super(p_i45285_1_, p_i45285_2_, p_i45285_3_, p_i45285_4_); }
public static void onPlayerRespawn(EntityPlayerMP ent){ MinecraftServer server = MinecraftServer.getServer(); NailedPlayer player = ((NailedPlayer) NailedPlatform.instance().getPlayerFromEntity(ent)); NailedWorld destWorld = NailedDimensionManager.instance().getWorld(ent.dimension); NailedWorld currentWorld = NailedDimensionManager.instance().getWorld(ent.dimension); Map destMap = destWorld.getMap(); currentWorld.getWrapped().getEntityTracker().removePlayerFromTrackers(ent); //Remove from EntityTracker currentWorld.getWrapped().getEntityTracker().untrackEntity(ent); //Notify other players of entity death currentWorld.getWrapped().getPlayerManager().removePlayer(ent); //Remove player's ChunkLoader server.getConfigurationManager().playerEntityList.remove(ent); //Remove from the global player list currentWorld.getWrapped().removePlayerEntityDangerously(ent); //Force the entity to be removed from it's current world Mappack mappack = destMap != null ? destMap.mappack() : null; Location pos = mappack == null ? new Location(destWorld, 0, 64, 0) : Location.builder().copy(destWorld.getConfig().spawnPoint()).setWorld(destWorld).build(); if(destMap != null && destMap.getGameManager().isGameRunning()){ if(destMap.getPlayerTeam(player) == null){ //TODO: random spawnpoints /*if(mappack != null && mappack.getMetadata.isChoosingRandomSpawnpointAtRespawn()){ List<Location> spawnpoints = mappack.getMappackMetadata().getRandomSpawnpoints(); pos = spawnpoints.get(NailedAPI.getMapLoader().getRandomSpawnpointSelector().nextInt(spawnpoints.size())); }*/ }else{ Location p = destMap.getPlayerTeam(player).getSpawnPoint(); if(p != null) pos = p; } } ent.dimension = destWorld.getDimensionId(); ItemInWorldManager worldManager = new ItemInWorldManager(destWorld.getWrapped()); EntityPlayerMP newPlayer = new EntityPlayerMP(server, destWorld.getWrapped(), ent.getGameProfile(), worldManager); newPlayer.playerNetServerHandler = ent.playerNetServerHandler; newPlayer.clonePlayer(ent, false); newPlayer.dimension = destWorld.getDimensionId(); newPlayer.setEntityId(ent.getEntityId()); worldManager.setGameType(ent.theItemInWorldManager.getGameType()); newPlayer.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch()); destWorld.getWrapped().theChunkProviderServer.loadChunk((int)(newPlayer.posX) >> 4, (int)(newPlayer.posZ) >> 4); player.sendPacket(new S07PacketRespawn(destWorld.getConfig().dimension().getId(), destWorld.getWrapped().getDifficulty(), destWorld.getWrapped().getWorldInfo().getTerrainType(), worldManager.getGameType())); player.netHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch()); player.sendPacket(new S05PacketSpawnPosition(new BlockPos(pos.getX(), pos.getY(), pos.getZ()))); player.sendPacket(new S1FPacketSetExperience(newPlayer.experience, newPlayer.experienceTotal, newPlayer.experienceLevel)); server.getConfigurationManager().updateTimeAndWeatherForPlayer(newPlayer, destWorld.getWrapped()); destWorld.getWrapped().getPlayerManager().addPlayer(newPlayer); destWorld.getWrapped().spawnEntityInWorld(newPlayer); //noinspection unchecked ((List<EntityPlayer>) server.getConfigurationManager().playerEntityList).add(newPlayer); newPlayer.addSelfToInternalCraftingInventory(); newPlayer.setHealth(newPlayer.getHealth()); player.netHandler.playerEntity = newPlayer; player.entity = newPlayer; //TODO: respawn event }
public DroneFakePlayer(WorldServer world, GameProfile name, ItemInWorldManager itemManager, IDroneBase drone){ super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, itemManager); this.drone = drone; }
public void blockDestroyed( ItemInWorldManager manager, int x, int y, int z );