本文整理汇总了Java中net.minecraft.network.EnumPacketDirection类的典型用法代码示例。如果您正苦于以下问题:Java EnumPacketDirection类的具体用法?Java EnumPacketDirection怎么用?Java EnumPacketDirection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnumPacketDirection类属于net.minecraft.network包,在下文中一共展示了EnumPacketDirection类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFakePlayer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public static WeakReference<FakePlayer> initFakePlayer(WorldServer ws, UUID uname, String blockName) {
GameProfile breakerProfile = new GameProfile(uname, Const.MODID + ".fake_player." + blockName);
WeakReference<FakePlayer> fakePlayer;
try {
fakePlayer = new WeakReference<FakePlayer>(FakePlayerFactory.get(ws, breakerProfile));
}
catch (Exception e) {
ModCyclic.logger.error("Exception thrown trying to create fake player : " + e.getMessage());
fakePlayer = null;
}
if (fakePlayer == null || fakePlayer.get() == null) {
fakePlayer = null;
return null; // trying to get around https://github.com/PrinceOfAmber/Cyclic/issues/113
}
fakePlayer.get().onGround = true;
fakePlayer.get().connection = new NetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.SERVERBOUND), fakePlayer.get()) {
@SuppressWarnings("rawtypes")
@Override
public void sendPacket(Packet packetIn) {}
};
fakePlayer.get().setSilent(true);
return fakePlayer;
}
示例2: initializeFakePlayer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
private void initializeFakePlayer() {
fakePlayer = new DroneFakePlayer(
(WorldServer) world,
new GameProfile(UUID.fromString(getOwnerUUID()), playerName),
this);
fakePlayer.connection = new NetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.SERVERBOUND), fakePlayer);
fakePlayer.inventory = new InventoryFakePlayer(fakePlayer);
}
示例3: initializeFakePlayer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
private void initializeFakePlayer() {
String playerName = "Drone";
fakePlayer = new DroneFakePlayer((WorldServer) getWorld(), new GameProfile(null, playerName), this);
fakePlayer.connection = new NetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.SERVERBOUND), fakePlayer);
fakePlayer.inventory = new InventoryPlayer(fakePlayer) {
private ItemStack oldStack;
@Override
public int getSizeInventory() {
return getDroneSlots();
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
super.setInventorySlotContents(slot, stack);
if (slot == 0) {
for (EntityEquipmentSlot ee : EntityEquipmentSlot.values()) {
if (!oldStack.isEmpty()) {
getFakePlayer().getAttributeMap().removeAttributeModifiers(oldStack.getAttributeModifiers(ee));
}
if (!stack.isEmpty()) {
getFakePlayer().getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers(ee));
}
}
oldStack = stack;
}
}
};
}
示例4: createNetworkManagerAndConnect
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
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;
}
示例5: MessageSerializer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public MessageSerializer(EnumPacketDirection direction)
{
this.direction = direction;
}
示例6: MessageDeserializer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public MessageDeserializer(EnumPacketDirection direction)
{
this.direction = direction;
}
示例7: OAuthNetworkManager
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public OAuthNetworkManager(EnumPacketDirection packetDirection, OAuthCallback callback) {
super(packetDirection);
this.callback = callback;
}
示例8: FakeNetHandlerPlayServer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new net.minecraft.network.NetworkManager(EnumPacketDirection.SERVERBOUND), p_i1530_3_);
}
示例9: CustomChannelNetworkManager
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public CustomChannelNetworkManager(Channel myChannel, EnumPacketDirection direction) {
super(direction);
this.channel = myChannel;
}
示例10: createState
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
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;
}
示例11: FakeNetHandlerPlayServer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), p_i1530_3_);
}
示例12: NetworkManagerFake
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public NetworkManagerFake() {
super(EnumPacketDirection.CLIENTBOUND);
}
示例13: FakeNetHandlerPlayServer
import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public FakeNetHandlerPlayServer(EntityPlayerMP player) {
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), player);
}