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

项目:enderutilities    文件:BlockUtils.java   
/**
 * Breaks the block as a player, and thus drops the item(s) from it
 */
public static void breakBlockAsPlayer(World world, BlockPos pos, EntityPlayerMP playerMP, ItemStack toolStack)
{
    PlayerInteractionManager manager = playerMP.interactionManager;
    int exp = ForgeHooks.onBlockBreakEvent(world, manager.getGameType(), playerMP, pos);

    if (exp != -1)
    {
        IBlockState stateExisting = world.getBlockState(pos);
        Block blockExisting = stateExisting.getBlock();

        blockExisting.onBlockHarvested(world, pos, stateExisting, playerMP);
        boolean harvest = blockExisting.removedByPlayer(stateExisting, world, pos, playerMP, true);

        if (harvest)
        {
            blockExisting.onBlockDestroyedByPlayer(world, pos, stateExisting);
            blockExisting.harvestBlock(world, playerMP, pos, stateExisting, world.getTileEntity(pos), toolStack);
        }
    }
}
项目:pnc-repressurized    文件:DroneAIDig.java   
@Override
protected boolean doBlockInteraction(BlockPos pos, double distToBlock) {
    PlayerInteractionManager manager = drone.getFakePlayer().interactionManager;
    if (!manager.isDestroyingBlock || !manager.receivedFinishDiggingPacket) { //is not destroying and is not acknowledged.
        IBlockState blockState = worldCache.getBlockState(pos);
        Block block = blockState.getBlock();
        if (!ignoreBlock(block) && isBlockValidForFilter(worldCache, drone, pos, widget)) {
            if (blockState.getBlockHardness(drone.world(), pos) < 0) {
                addToBlacklist(pos);
                drone.addDebugEntry("gui.progWidget.dig.debug.cantDigBlock", pos);
                drone.setDugBlock(null);
                return false;
            }
            manager.onBlockClicked(pos, EnumFacing.DOWN);
            manager.blockRemoving(pos);
            if (!manager.isDestroyingBlock) {
                addToBlacklist(pos);
                drone.addDebugEntry("gui.progWidget.dig.debug.cantDigBlock", pos);
                drone.setDugBlock(null);
                return false;
            }
            drone.setDugBlock(pos);
            return true;
        }
        drone.setDugBlock(null);
        return false;
    } else {
        return true;
    }
}
项目:UniversalRemote    文件:HookedEntityPlayerMP.java   
@SuppressWarnings("unchecked")
    public HookedEntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile,
            PlayerInteractionManager interactionManagerIn) throws IllegalAccessException {
        super(server, worldIn, profile, interactionManagerIn);

//      entityRemoveQueue = InjectionHandler.readFieldOfType(EntityPlayerMP.class, this, List.class);
//      advancements= InjectionHandler.readFieldOfType(EntityPlayerMP.class, this, PlayerAdvancements.class);
    }
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManagerIn)
{
    super(worldIn, profile);
    interactionManagerIn.thisPlayerMP = this;
    this.interactionManager = interactionManagerIn;
    BlockPos blockpos = worldIn.getSpawnPoint();

    if (worldIn.provider.func_191066_m() && worldIn.getWorldInfo().getGameType() != GameType.ADVENTURE)
    {
        int i = Math.max(0, server.getSpawnRadius(worldIn));
        int j = MathHelper.floor(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 + 1) - i, 0, this.rand.nextInt(i * 2 + 1) - i));
    }

    this.mcServer = server;
    this.statsFile = server.getPlayerList().getPlayerStatsFile(this);
    this.stepHeight = 0.0F;
    this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);

    while (!worldIn.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
    {
        this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
}
项目:Backmemed    文件:EntityPlayerMP.java   
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManagerIn)
{
    super(worldIn, profile);
    interactionManagerIn.thisPlayerMP = this;
    this.interactionManager = interactionManagerIn;
    BlockPos blockpos = worldIn.getSpawnPoint();

    if (worldIn.provider.func_191066_m() && worldIn.getWorldInfo().getGameType() != GameType.ADVENTURE)
    {
        int i = Math.max(0, server.getSpawnRadius(worldIn));
        int j = MathHelper.floor(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 + 1) - i, 0, this.rand.nextInt(i * 2 + 1) - i));
    }

    this.mcServer = server;
    this.statsFile = server.getPlayerList().getPlayerStatsFile(this);
    this.stepHeight = 0.0F;
    this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);

    while (!worldIn.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
    {
        this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
@SuppressWarnings("unused")
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManagerIn)
{
    super(worldIn, profile);
    interactionManagerIn.thisPlayerMP = this;
    this.interactionManager = interactionManagerIn;
    BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint();

    if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != GameType.ADVENTURE)
    {
        int i = Math.max(0, server.getSpawnRadius(worldIn));
        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 + 1) - i, 0, this.rand.nextInt(i * 2 + 1) - i));
    }

    this.mcServer = server;
    this.statsFile = server.getPlayerList().getPlayerStatsFile(this);
    this.stepHeight = 0.0F;
    this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);

    while (!worldIn.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
    {
        this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
@SuppressWarnings("unused")
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, PlayerInteractionManager interactionManagerIn)
{
    super(worldIn, profile);
    interactionManagerIn.thisPlayerMP = this;
    this.interactionManager = interactionManagerIn;
    BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint();

    if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != GameType.ADVENTURE)
    {
        int i = Math.max(0, server.getSpawnRadius(worldIn));
        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 + 1) - i, 0, this.rand.nextInt(i * 2 + 1) - i));
    }

    this.mcServer = server;
    this.statsFile = server.getPlayerList().getPlayerStatsFile(this);
    this.stepHeight = 0.0F;
    this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);

    while (!worldIn.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
    {
        this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
    }
}
项目:CustomWorldGen    文件:FakePlayer.java   
public FakePlayer(WorldServer world, GameProfile name)
{
    super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new PlayerInteractionManager(world));
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
protected EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, PlayerInteractionManager p_i45285_4_) {
    super(p_i45285_1_, p_i45285_2_, p_i45285_3_, p_i45285_4_);
}