本文整理汇总了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;
}
示例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;
}
示例3: FakeNetHandlerPlayServer
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), p_i1530_3_);
}
示例4: NetworkManagerFake
public NetworkManagerFake() {
super(EnumPacketDirection.CLIENTBOUND);
}
示例5: FakeNetHandlerPlayServer
public FakeNetHandlerPlayServer(EntityPlayerMP player) {
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), player);
}