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


Java EnumPacketDirection.CLIENTBOUND属性代码示例

本文整理汇总了Java中net.minecraft.network.EnumPacketDirection.CLIENTBOUND属性的典型用法代码示例。如果您正苦于以下问题:Java EnumPacketDirection.CLIENTBOUND属性的具体用法?Java EnumPacketDirection.CLIENTBOUND怎么用?Java EnumPacketDirection.CLIENTBOUND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.network.EnumPacketDirection的用法示例。


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

示例1: createNetworkManagerAndConnect

public static OAuthNetworkManager createNetworkManagerAndConnect(InetAddress address, int serverPort,
		boolean useNativeTransport, OAuthCallback callback) {
	final OAuthNetworkManager networkmanager = new OAuthNetworkManager(EnumPacketDirection.CLIENTBOUND, callback);
	Class<? extends SocketChannel> oclass;
	LazyLoadBase<? extends EventLoopGroup> lazyloadbase;

	if (Epoll.isAvailable() && useNativeTransport) {
		oclass = EpollSocketChannel.class;
		lazyloadbase = CLIENT_EPOLL_EVENTLOOP;
	} else {
		oclass = NioSocketChannel.class;
		lazyloadbase = CLIENT_NIO_EVENTLOOP;
	}

	(new Bootstrap()).group(lazyloadbase.getValue()).handler(new ChannelInitializer<Channel>() {
		@Override
		protected void initChannel(Channel p_initChannel_1_) throws Exception {
			try {
				p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
			} catch (ChannelException var3) {
				;
			}

			p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30))
					.addLast("splitter", new NettyVarint21FrameDecoder())
					.addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.CLIENTBOUND))
					.addLast("prepender", new NettyVarint21FrameEncoder())
					.addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.SERVERBOUND))
					.addLast("packet_handler", networkmanager);
		}
	}).channel(oclass).connect(address, serverPort).syncUninterruptibly();
	return networkmanager;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:33,代码来源:OAuthNetworkManager.java

示例2: createState

public boolean createState(WorldServer world, double x, double y, double z)
{
    if(state == null || state.ent == null)
    {
        try
        {
            EntityPlayerMP playerDummy = new FakePlayer(world, EntityHelper.getDummyGameProfile());
            NBTTagCompound tag = CompressedStreamTools.readCompressed(new ByteArrayInputStream(this.nbtToRead));
            playerDummy.readFromNBT(tag);
            playerDummy.setLocationAndAngles(x, y, z, playerDummy.rotationYaw, playerDummy.rotationPitch);
            playerDummy.writeToNBT(tag);
            this.state = new EntityState(playerDummy);

            if(this.entityType.startsWith("player::"))
            {
                this.state.ent = new FakePlayer(world, EntityHelper.getGameProfile(this.entityType.substring("player::".length())));
                this.state.ent.readFromNBT(tag);
                new FakeNetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), (FakePlayer)this.state.ent);
                FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendPacketToAllPlayers(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, (FakePlayer)this.state.ent));
                state.ent.getDataWatcher().updateObject(10, (byte)127);
            }
            else
            {
                this.state.ent = (EntityLivingBase)Class.forName(this.entityType).getConstructor(World.class).newInstance(world);
                this.state.ent.setSprinting(playerDummy.isSprinting());
                this.state.ent.setSneaking(playerDummy.isSneaking());
                for(int i = 0; i < state.ent.getInventory().length; i++)
                {
                    this.state.ent.setCurrentItemOrArmor(i, playerDummy.getEquipmentInSlot(i));
                }
            }

            if(state.ent instanceof EntityLiving)
            {
                ((EntityLiving)state.ent).setNoAI(true);
                ((EntityLiving)state.ent).tasks.taskEntries.clear();
                ((EntityLiving)state.ent).targetTasks.taskEntries.clear();
            }
            return true;
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    return false;
}
 
开发者ID:iChun,项目名称:Keygrip,代码行数:47,代码来源:Action.java

示例3: FakeNetHandlerPlayServer

public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
  super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), p_i1530_3_);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:3,代码来源:FakeNetHandlerPlayServer.java

示例4: NetworkManagerFake

public NetworkManagerFake() {

			super(EnumPacketDirection.CLIENTBOUND);
		}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:4,代码来源:NetServerHandlerFake.java

示例5: FakeNetHandlerPlayServer

public FakeNetHandlerPlayServer(EntityPlayerMP player) {
	
	super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), player);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:4,代码来源:FakeNetHandlerPlayServer.java


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