Java 类net.minecraft.server.management.ItemInWorldManager 实例源码

项目:Thermos    文件:CustomProjectileEntity.java   
@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;
}
项目:Cauldron    文件:EntityPlayerMP.java   
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);
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
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);
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
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);
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
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);
    }
}
项目:BaseClient    文件:EntityPlayerMP.java   
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);
    }
}
项目:4Space-5    文件:GCEntityPlayerMP.java   
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));
    }
}
项目:Factorization    文件:InteractionLiason.java   
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());
}
项目:Factorization    文件:PacketProxyingPlayer.java   
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();
}
项目:CollectiveFramework    文件:GhostEntityPlayerMP.java   
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;
}
项目:SpaceCore    文件:BlockDestroyedNotifier.java   
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 );
    }
}
项目:CustomNPC-Tweaks    文件:CustomNPCEntityPlayerMPImpl.java   
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;
}
项目:Resilience-Client-Source    文件:EntityPlayerMP.java   
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);
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
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
}
项目:PneumaticCraft    文件:FakePlayerItemInWorldManager.java   
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;
    }
}
项目:PneumaticCraft    文件:FakePlayerItemInWorldManager.java   
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;
    }
}
项目:TRHS_Club_Mod_2016    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
项目:Factorization    文件:HammerNet.java   
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;
}
项目:CauldronGit    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
项目:Gadomancy    文件:AIBreakBlock.java   
public void cancelLeftClick() {
    ItemInWorldManager manager = player.theItemInWorldManager;
    if(manager.isDestroyingBlock)
        player.theItemInWorldManager.cancelDestroyingBlock(manager.partiallyDestroyedBlockX, manager.partiallyDestroyedBlockY, manager.partiallyDestroyedBlockZ);
}
项目:NeptuneMod    文件:MixinEntityPlayerMP.java   
@Inject(method = "<init>", at = @At("RETURN"))
public void onConstruction(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager,
        CallbackInfo info) {
    this.initPlayerData();
}
项目:ServerTools-PERMISSION    文件:STPEntityPlayer.java   
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_);
}
项目:Cauldron    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
项目:Cauldron    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
项目:Cauldron    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
项目:nailed    文件:NailedEventFactory.java   
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
}
项目:PneumaticCraft    文件:EntityDrone.java   
public DroneFakePlayer(WorldServer world, GameProfile name, ItemInWorldManager itemManager, IDroneBase drone){
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, itemManager);
    this.drone = drone;
}
项目:SpaceCore    文件:IBlockDestroyedMonitor.java   
public void blockDestroyed( ItemInWorldManager manager, int x, int y, int z );