本文整理匯總了Java中cpw.mods.fml.common.network.NetworkRegistry.TargetPoint方法的典型用法代碼示例。如果您正苦於以下問題:Java NetworkRegistry.TargetPoint方法的具體用法?Java NetworkRegistry.TargetPoint怎麽用?Java NetworkRegistry.TargetPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cpw.mods.fml.common.network.NetworkRegistry
的用法示例。
在下文中一共展示了NetworkRegistry.TargetPoint方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
/**
* Send this message to everyone within a certain range of a point.
* <p/>
* Adapted from CPW's code in
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
*
* @param message The message to send
* @param point The
* {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
* around which to send
*/
public void sendToAllAround(IPacket message, NetworkRegistry.TargetPoint point)
{
try {
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
this.channels.get(Side.SERVER).writeOutbound(message);
} catch (Exception e)
{
GCLog.severe("Forge error when sending network packet to nearby players - this is not a Galacticraft bug, does another mod make fake players?");
e.printStackTrace();
}
}
示例2: onBlockActivated
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int these, float are, float some, float variables) { //LUL side, hitx, hity, hitz
if(world.isRemote) return false;
TileEntity te = world.getTileEntity(x, y, z);
if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
if(!((TileEssentiaCompressor) te).isMasterTile()) {
int yOffset = ((TileEssentiaCompressor) te).getMultiblockYIndex();
return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated(world, x, y - yOffset, z, player, these, are, some, variables);
}
} else {
ItemStack heldItem = player.getHeldItem();
if(heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) {
ChunkCoordinates lowest = findLowestCompressorBlock(world, x, y, z);
boolean canForm = lowest != null && isMuliblockPossible(world, lowest);
if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) {
int multiblockID = TileEssentiaCompressor.getAndIncrementNewMultiblockId();
TileEssentiaCompressor compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ);
compressor.setInMultiblock(true, 0, multiblockID);
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ);
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ);
compressor.setInMultiblock(false, 1, multiblockID);
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ);
point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ);
compressor.setInMultiblock(false, 2, multiblockID);
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ);
point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
}
}
}
return false;
}
示例3: onBlockActivated
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
if(world.getBlockMetadata(x, y, z) != 1) {
Block up = world.getBlock(x, y + 1, z);
return up != null && up instanceof BlockAuraPylon && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9);
}
ItemStack heldItem = player.getHeldItem();
if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) {
TileAuraPylon tileAuraPylon = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) &&
!tileAuraPylon.isPartOfMultiblock() &&
ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) {
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z);
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
ta.setTileInformation(true, false);
ta = (TileAuraPylon) world.getTileEntity(x, y - 3, z);
ta.setTileInformation(false, true);
int count = 1;
TileEntity iter = world.getTileEntity(x, y - count, z);
while(iter != null && iter instanceof TileAuraPylon) {
((TileAuraPylon) iter).setPartOfMultiblock(true);
world.markBlockForUpdate(x, y - count, z);
iter.markDirty();
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y - count, z);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
count++;
iter = world.getTileEntity(x, y - count, z);
}
}
}
return false;
}
示例4: playAspectDrainFromWand
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
private void playAspectDrainFromWand(Aspect drained) {
if(drained == null) return;
NetworkRegistry.TargetPoint point = getTargetPoint(32);
PacketTCWispyLine line = new PacketTCWispyLine(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 0.8, zCoord + 0.5,
xCoord + 0.5, yCoord + 1.4 + (((double) worldObj.rand.nextInt(4)) / 10D), zCoord + 0.5, 40, drained.getColor());
PacketHandler.INSTANCE.sendToAllAround(line, point);
}
示例5: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public static void sendToAllAround(final XUPacketBase packet, final NetworkRegistry.TargetPoint point) {
checkPacket(packet, Side.SERVER);
NetworkHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
NetworkHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
NetworkHandler.channels.get(Side.SERVER).writeAndFlush(packet).addListener((GenericFutureListener)ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}
示例6: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public static final void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point) {
AgeOfKingdom.channel.sendToAllAround(message, point);
}
示例7: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void sendToAllAround(IPacket message, NetworkRegistry.TargetPoint point) {
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
this.channels.get(Side.SERVER).writeOutbound(message);
}
示例8: sendAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void sendAllAround(final ImaginePacket packet, final NetworkRegistry.TargetPoint point) {
this.mServerChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set((Object)FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
this.mServerChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set((Object)point);
this.mServerChannel.writeOutbound(new Object[] { packet });
}
示例9: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void sendToAllAround(PacketAbstract message, NetworkRegistry.TargetPoint point) {
this.channelEnumMap.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
this.channelEnumMap.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
this.channelEnumMap.get(Side.SERVER).writeAndFlush(message);
}
示例10: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void sendToAllAround(IBarrelMessage message, NetworkRegistry.TargetPoint point)
{
((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}
示例11: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void sendToAllAround(MMMessage message, NetworkRegistry.TargetPoint point) {
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
channels.get(Side.SERVER).writeAndFlush(message);
}
示例12: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public static void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point)
{
Technotronics.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
Technotronics.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
Technotronics.channels.get(Side.SERVER).writeOutbound(message);
}
示例13: updateEntity
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
@Override
public void updateEntity()
{
boolean flag = canSmelt();
boolean flag1 = false;
if (!worldObj.isRemote)
{
if (canSmelt())
{
++ovenCookTime;
if (ovenCookTime == COOKTIME)
{
ovenCookTime = 0;
smeltItem();
flag1 = true;
}
}
else
{
ovenCookTime = 0;
}
if (ovenStacks[FUELINPUT] != null)
{
if (fuelTank.fillFromContainer(ovenStacks[FUELINPUT]))
{
ovenStacks[FUELINPUT] = ovenStacks[FUELINPUT].getItem().getContainerItem(ovenStacks[FUELINPUT]);
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId,
xCoord, yCoord, zCoord, 16.0d);
ModMain.network.sendToAllAround(
new PacketNetherBrickOvenFuelLevel(xCoord, yCoord, zCoord, fuelTank.getFluid()), point);
}
}
}
if (flag != canSmelt())
{
flag1 = true;
BlockNetherBrickOven.updateBlockState(canSmelt(), worldObj, xCoord, yCoord, zCoord);
}
if (flag1)
{
markDirty();
}
}
示例14: smeltItem
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
public void smeltItem()
{
if (canSmelt())
{
ItemStack itemStack = NetherBrickOvenRecipeHandler.instance().findMatchingRecipe(this);
if (ovenStacks[OUTPUT] == null)
{
ovenStacks[OUTPUT] = itemStack.copy();
}
else if (ovenStacks[OUTPUT].getItem() == itemStack.getItem())
{
ovenStacks[OUTPUT].stackSize += itemStack.stackSize;
}
for (int i = INPUTSTART; i < ovenStacks.length; ++i)
{
ItemStack stack = ovenStacks[i];
if (stack != null)
{
ItemStack containerItem = null;
if (ovenStacks[i].getItem().hasContainerItem(ovenStacks[i]))
{
containerItem = ovenStacks[i].getItem().getContainerItem(ovenStacks[i]);
}
--ovenStacks[i].stackSize;
if (ovenStacks[i].stackSize <= 0)
{
ovenStacks[i] = null;
}
if (containerItem != null)
{
ovenStacks[i] = containerItem;
}
}
}
fuelTank.getFluid().amount -= getFuelNeededForSmelt();
}
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord,
yCoord, zCoord, 16.0d);
ModMain.network.sendToAllAround(new PacketNetherBrickOvenFuelLevel(xCoord, yCoord, zCoord, fuelTank.getFluid()),
point);
}
示例15: sendToAllAround
import cpw.mods.fml.common.network.NetworkRegistry; //導入方法依賴的package包/類
/**
* Send this message to everyone within a certain range of a point.
* See {@link SimpleNetworkWrapper#sendToDimension(IMessage, NetworkRegistry.TargetPoint)}
*/
public final void sendToAllAround( IMessage pMessage, NetworkRegistry.TargetPoint pPoint )
{
dispatcher.sendToAllAround( pMessage, pPoint );
}