当前位置: 首页>>代码示例>>Java>>正文


Java TargetPoint类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint的典型用法代码示例。如果您正苦于以下问题:Java TargetPoint类的具体用法?Java TargetPoint怎么用?Java TargetPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TargetPoint类属于net.minecraftforge.fml.common.network.NetworkRegistry包,在下文中一共展示了TargetPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendBlockBreakProgress

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {
	EntityPlayerMP player = null;
	for (EntityPlayerMP entityplayermp : this.mcServer.getPlayerList().getPlayers()) {
		if (entityplayermp != null && entityplayermp.getEntityId() == breakerId) {
			player = entityplayermp;
		}
	}
	if (player == null) {
		return;
	}
	if (player.getHeldItemMainhand().getItem() == ModItems.hammer) {
		RayTraceResult rt = ModItems.hammer.rayTraceBlocks(world, player);
		List<BlockPos> positions = ModItems.hammer.getExtraBlocks(world, rt, player);

        PacketHandler.INSTANCE.sendToAllAround(new MessageExtraBlockBreak(player.getEntityId(), positions.toArray(new BlockPos[positions.size()]), progress - 1), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 32D));
	}
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:19,代码来源:WorldListener.java

示例2: selectNetworks

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
    TargetPoint tp = (TargetPoint)args;
    ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
    for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
    {
        if (player.dimension == tp.dimension)
        {
            double d4 = tp.x - player.posX;
            double d5 = tp.y - player.posY;
            double d6 = tp.z - player.posZ;

            if (d4 * d4 + d5 * d5 + d6 * d6 < tp.range * tp.range)
            {
                NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
                if (dispatcher != null) builder.add(dispatcher);
            }
        }
    }
    return builder.build();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:FMLOutboundHandler.java

示例3: updateTask

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void updateTask() {
    --eatCooldown;
    if(eatingFood != ItemStack.EMPTY) {
        if (foodEatTime > 0) {
            if (--foodEatTime % 4 == 0) {
                PacketHandler.getChannel().sendToAllAround(
                    new WolfEatMessage(entity.getEntityId(), eatingFood),
                    new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 60));
                this.entity.playSound(SoundEvents.ENTITY_GENERIC_EAT,
                        0.5F,
                        (this.entity.getRNG().nextFloat() - this.entity.getRNG().nextFloat()) * 0.2F + 1);
            }
        } else if (!hasHealedSinceLastReset) {
            hasHealedSinceLastReset = true;
            PacketHandler.getChannel().sendToAllAround(
                new WolfHealMessage(entity.getEntityId()),
                new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 60));
            this.entity.heal((float) ((ItemFood) eatingFood.getItem()).getHealAmount(eatingFood));
            this.eatingFood.shrink(1);
        }
    }
}
 
开发者ID:CenturionFox,项目名称:wolfarmor,代码行数:24,代码来源:EntityAIWolfAutoEat.java

示例4: grow

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void grow(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
	int age = getAge(state);
	if (age < getMaxAge()) {
		setAge(world, pos, getAge(state) + 1);
	}
	if (isMaxAge(state) && world.isAirBlock(pos.up())) {
		IBlockState place = BlockVitalized.getBulbFromState(world.getBlockState(pos.down()));
		if (place != null) {
			AttainedDrops2.NETWORK.sendToAllAround(new ParticleMessage(BlockBulb.getColorFromState(place), pos.up(), (byte) 1), new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 30));
			world.setBlockState(pos.up(), place);
			int charge = state.getValue(CHARGE);
			world.setBlockState(pos, state.withProperty(CHARGE, charge + 1 > 4 ? 0 : charge + 1));
			if (charge > 0 && rand.nextInt(5 - charge) == 0) {
				world.setBlockState(pos.down(), world.getBlockState(pos.down()).getBlock().getDefaultState());
				world.setBlockState(pos, state.withProperty(CHARGE, 0));
				if (Config.revertToDirt && rand.nextInt(8 - charge) == 0) {
					if (world.getBlockState(pos.up()).getBlock() == ModRegistry.BULB) world.destroyBlock(pos.up(), true);
					world.setBlockState(pos.down(), Blocks.DIRT.getDefaultState());
					AttainedDrops2.NETWORK.sendToAllAround(new ParticleMessage(EnumDyeColor.RED, pos.up(), (byte) 2), new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 30));
				}
			}
		}
	}
}
 
开发者ID:Shadows-of-Fire,项目名称:Attained-Drops-2,代码行数:26,代码来源:BlockPlant.java

示例5: ender

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
/** summon enderman particles and play teleport sound (start / end configurable)*/
  public static void ender(World world, double x, double y, double z, double tx, double ty, double tz, boolean sound2x) {
  	short nParticles = 64;
  	float width = 1;
  	float height = 2;
  	int dim = world.provider.getDimension();

      for (int l = 0; l < nParticles; ++l)
      {
          double d6 = l / (nParticles - 1.0D);
          float f = (random.nextFloat() - 0.5F) * 0.2F;
          float f1 = (random.nextFloat() - 0.5F) * 0.2F;
          float f2 = (random.nextFloat() - 0.5F) * 0.2F;
          double d7 = tx + (x - tx) * d6 + (random.nextDouble() - 0.5D) * width * 2.0D;
          double d8 = ty + (y - ty) * d6 + random.nextDouble() * height;
          double d9 = tz + (z - tz) * d6 + (random.nextDouble() - 0.5D) * width * 2.0D;
          LCNetwork.net.sendToAllAround(new MessageSpawnParticle("portal", d7, d8, d9, f, f1, f2), new TargetPoint(dim, d7, d8, d9, 1024));
      }
      
float pitch = 0.9F + random.nextFloat() * 0.2F;
world.playSound(null, x , y, z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, pitch);
if(sound2x) world.playSound(null, tx , ty, tz, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, pitch);
      
  }
 
开发者ID:sblectric,项目名称:LightningCraft,代码行数:25,代码来源:Effect.java

示例6: update

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void update() {
	super.update();
	
	if (!worldObj.isRemote && worldObj.getTotalWorldTime() % 20L == 0) {
		byte current = (byte) this.getBlockMetadata();
		if (this.meta != current) setMetaOnUpdate(current);

		PacketHandler.INSTANCE.sendToAllAround(new MessageTileEntityNuclearIOPort(this),
				new TargetPoint(worldObj.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0x10));
	}

	else if (worldObj.isRemote && burnTime > 0) {
		burnTime--; // On client side, we can predict that burn time will be decreased each tick, and will be corrected via messages 1/sec.
	}
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:17,代码来源:TileEntityNuclearIOPort.java

示例7: updateEntity

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void updateEntity(@Nonnull World world) {
  super.updateEntity(world);
  if (world.isRemote) {
    return;
  }
  // filledFromThisTick.clear();
  updateStartPushDir();
  doExtract();

  if (stateDirty) {
    getBundle().dirty();
    stateDirty = false;
    lastSyncRatio = tank.getFilledRatio();

  } else if ((lastSyncRatio != tank.getFilledRatio() && world.getTotalWorldTime() % 2 == 0)) {

    // need to send a custom packet as we don't want want to trigger a full chunk update, just
    // need to get the required values to the entity renderer
    BlockPos pos = getBundle().getLocation();
    PacketHandler.INSTANCE.sendToAllAround(new PacketConduitFluidLevel(this),
        new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64));
    lastSyncRatio = tank.getFilledRatio();
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:26,代码来源:LiquidConduit.java

示例8: sendEnchantedGolemInfoMessage

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
/**
 * Send info about the golems (iron and snow) to all players around a certain radius of them.
 * 
 * Server -> Client
 * 
 */
public static void sendEnchantedGolemInfoMessage(EntityLiving golem, ExtendedGolem properties) {
    if (golem != null && properties != null) {
        int[] ids = GolemEnchantment.convert(properties.getEnchantments());
        
        if (ids.length > 0) {
            MessageGolemEnchantments message = new MessageGolemEnchantments(golem.getEntityId(), ids);
            TargetPoint target = new TargetPoint(golem.dimension, golem.posX, golem.posY, golem.posZ, 64.0D);
            
            // Debug
            LogHelper.info("~~Sending Message - Enchanted Iron Golem info~~");
            LogHelper.info("    target: " + target);
            LogHelper.info("    " + message.toString());

            // Sends a message to the player, with the golem extra info
            ModVillagerTweaks.NetworkWrapper.sendToAllAround(message, target);
        }
    }
}
 
开发者ID:sidben,项目名称:VillagerTweaks,代码行数:25,代码来源:NetworkHelper.java

示例9: sendDataToAllAround

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public static void sendDataToAllAround(PacketType type, NBTTagCompound toSend, TargetPoint pt)
{
	if (MC.getSide() == Side.CLIENT)
	{
		VCLoggers.loggerErrors.log(LogLevel.Error, "A mod attempted to send a packet to a client while being on a client side already! [packet - %s:%d]", type.registryName, type.internalID);
		return;
	}
	
	sendData(type, toSend, null, pt);
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:11,代码来源:VoidNetwork.java

示例10: send

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public static void send(Packet packet, EntityPlayerMP to, TargetPoint point)
{
	Side s = MC.getSide();
	if (s == Side.CLIENT)
	{
		if (packet.id == PacketType.Request.internalID)
		{
			packet.data.setString("requester", VoidApi.proxy.getClientPlayerName());
		}
		
		networkManager.sendToServer(packet);
	}
	else
	{
		if (to != null)
		{
			networkManager.sendTo(packet, to);
		}
		else
		{
			if (point != null)
			{
				networkManager.sendToAllAround(packet, point);
			}
			else
			{
				networkManager.sendToAll(packet);
			}
		}
	}
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:32,代码来源:VoidNetwork.java

示例11: sendPhenomenaPacket

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public static void sendPhenomenaPacket(TilePhenomena phenomena) {
	NBTTagCompound tag = new NBTTagCompound();
	BlockPos pos = phenomena.getPos();
	tag.setInteger("x", pos.getX());
	tag.setInteger("y", pos.getY());
	tag.setInteger("z", pos.getZ());
	TargetPoint point = fromTileEntity(phenomena, 25);
	PacketHandler.NETWORK.sendToAllAround(new ServerToClientPacket(PacketHandler.PHENOMENA, tag), point);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:10,代码来源:PacketHelper.java

示例12: sendQuartzEffectPacket

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public static void sendQuartzEffectPacket(EntityCrystalQuartzItem item, Vector3 from, Vector3 to) {
	TargetPoint point = fromEntity(item, 25);
	NBTTagCompound tag = new NBTTagCompound();
	tag.setTag("from", from.writeToNBT(new NBTTagCompound()));
	tag.setTag("to", to.writeToNBT(new NBTTagCompound()));
	PacketHandler.NETWORK.sendToAllAround(new ServerToClientPacket(PacketHandler.QUARTZ_EFFECT, tag), point);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:8,代码来源:PacketHelper.java

示例13: validateArgs

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:FMLOutboundHandler.java

示例14: setDirty

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void setDirty()
{
	NBTTagCompound sent = new NBTTagCompound();
	sent.setTag("tileData", this.getContainer().serializeNBT());
	sent.setTag("blockPosData", new DimBlockPos(this.getContainer().getPos(), this.getContainer().getWorld().provider.getDimension()).serializeNBT());
	VoidNetwork.sendDataToAllAround(PacketType.TileData, sent, new TargetPoint(this.getContainer().getWorld().provider.getDimension(), this.getContainer().getPos().getX(), this.getContainer().getPos().getY(), this.getContainer().getPos().getZ(), 96));
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:9,代码来源:ExPFarmland.java

示例15: sendUpdatePacket

import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public void sendUpdatePacket()
{
	NBTTagCompound sent = new NBTTagCompound();
	sent.setTag("tileData", this.getContainer().serializeNBT());
	sent.setTag("blockPosData", new DimBlockPos(this.getContainer().getPos(), this.getContainer().getWorld().provider.getDimension()).serializeNBT());
	VoidNetwork.sendDataToAllAround(PacketType.TileData, sent, new TargetPoint(this.getContainer().getWorld().provider.getDimension(), this.getContainer().getPos().getX(), this.getContainer().getPos().getY(), this.getContainer().getPos().getZ(), 96));
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:8,代码来源:ExPCrop.java


注:本文中的net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。