java类net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint的实例源码

PacketHelper.java 文件源码 项目:Solar 阅读 25 收藏 0 点赞 0 评论 0
public static TargetPoint fromWorldPos(World world, BlockPos pos, int range) {
    return new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), range);
}
PacketHelper.java 文件源码 项目:Solar 阅读 29 收藏 0 点赞 0 评论 0
public static TargetPoint fromTileEntity(TileEntity te, int range) {
    return new TargetPoint(te.getWorld().provider.getDimension(), te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), range);
}
PacketHelper.java 文件源码 项目:Solar 阅读 26 收藏 0 点赞 0 评论 0
public static TargetPoint fromEntity(Entity entity, int range) {
    return new TargetPoint(entity.world.provider.getDimension(), entity.posX, entity.posY, entity.posZ, range);
}
TileEntityChessControl.java 文件源码 项目:ToroChess 阅读 18 收藏 0 点赞 0 评论 0
private void sendTurnChangeMessage() {
  TargetPoint p = new TargetPoint(world.provider.getDimension(), a8.getX() + 4, a8.getY(), a8.getZ() + 4, 40);
  ToroChess.NETWORK.sendToAllAround(new MessageTurnChangeEvent(turn, gameId), p);
}
TileEntityChessControl.java 文件源码 项目:ToroChess 阅读 19 收藏 0 点赞 0 评论 0
private void sendControlBlockUpdatePacket() {
  TargetPoint p = new TargetPoint(world.provider.getDimension(), a8.getX() + 4, a8.getY(), a8.getZ() + 4, 100);
  ToroChess.NETWORK.sendToAllAround(new MessageUpdateControlBlock(pos, writeToNBT(new NBTTagCompound())), p);
}
NetworkHandler.java 文件源码 项目:Toms-Mod 阅读 17 收藏 0 点赞 0 评论 0
public static void sendToAllAround(IMessage message, TargetPoint point) {
    INSTANCE.sendToAllAround(message, point);
}
PacketHandler.java 文件源码 项目:ExNihiloAdscensio 阅读 25 收藏 0 点赞 0 评论 0
public static void sendToAllAround(IMessage message, TileEntity te, int range) 
{
    BlockPos pos = te.getPos();
       INSTANCE.sendToAllAround(message, new TargetPoint(te.getWorld().provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), range));
   }
PacketDispatcher.java 文件源码 项目:How-Bout-That-Furniture 阅读 25 收藏 0 点赞 0 评论 0
public static final void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point)
{
  dispatcher.sendToAllAround(message, point);
}
PacketDispatcher.java 文件源码 项目:How-Bout-That-Furniture 阅读 26 收藏 0 点赞 0 评论 0
public static final void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range)
{
  sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range));
}
ItemMaterial.java 文件源码 项目:LightningCraft 阅读 29 收藏 0 点赞 0 评论 0
/** Right-click the item on a block */
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
        EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    switch(stack.getItemDamage()) {

    // Cell Upgrade usage
    case Material.UPGRADE:
        // upgrade an upgradable tile entity
        TileEntity tile = world.getTileEntity(pos);
        if(LCConfig.upgradeEnabled && tile != null && tile.hasCapability(LCCapabilities.LIGHTNING_UPGRADABLE, null) && 
                !tile.getCapability(LCCapabilities.LIGHTNING_UPGRADABLE, null).isUpgraded()) {
            EnumActionResult r = tile.getCapability(LCCapabilities.LIGHTNING_UPGRADABLE, null)
                    .onLightningUpgrade(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
            if(r == EnumActionResult.SUCCESS && !world.isRemote) {
                --stack.stackSize; // transfer the upgrade to the tile entity on success
                tile.markDirty();

                player.addStat(LCAchievements.upgradeMachine, 1); // give out the achievement

                // send a message to nearby clients to update the upgraded status
                LCNetwork.net.sendToAllAround(new MessageLightningUpgrade(pos), 
                        new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 1024));
            }
            return r;
        } else {
            return EnumActionResult.FAIL;
        }

    // Underworld Charge usage
    case Material.UNDER_CHARGE:

        if(!world.isRemote) {
            if(PortalUnderworld.ignitePortal(world, pos.up())) {
                if(player.capabilities.isCreativeMode == false) stack.stackSize--;
                Effect.lightning(world, pos.getX(), pos.getY() + 1, pos.getZ());
                if(stack.stackSize <= 0) stack = null;
            }
        }
        return EnumActionResult.SUCCESS;

    // Default usage
    default:
        return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号