本文整理汇总了Java中net.minecraft.server.management.PlayerInteractionManager类的典型用法代码示例。如果您正苦于以下问题:Java PlayerInteractionManager类的具体用法?Java PlayerInteractionManager怎么用?Java PlayerInteractionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerInteractionManager类属于net.minecraft.server.management包,在下文中一共展示了PlayerInteractionManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: breakBlockAsPlayer
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
/**
* 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);
}
}
}
示例2: doBlockInteraction
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
@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;
}
}
示例3: HookedEntityPlayerMP
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
@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);
}
示例4: EntityPlayerMP
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
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);
}
}
示例5: EntityPlayerMP
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
@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);
}
}
示例6: FakePlayer
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
public FakePlayer(WorldServer world, GameProfile name)
{
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new PlayerInteractionManager(world));
}
示例7: EntityPlayerMP
import net.minecraft.server.management.PlayerInteractionManager; //导入依赖的package包/类
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_);
}