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


Java EnumPacketDirection类代码示例

本文整理汇总了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;
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:24,代码来源:UtilFakePlayer.java

示例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);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:EntityDrone.java

示例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;
            }
        }
    };
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:30,代码来源:TileEntityProgrammableController.java

示例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;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:34,代码来源:OAuthNetworkManager.java

示例5: MessageSerializer

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public MessageSerializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:MessageSerializer.java

示例6: MessageDeserializer

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public MessageDeserializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:MessageDeserializer.java

示例7: OAuthNetworkManager

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public OAuthNetworkManager(EnumPacketDirection packetDirection, OAuthCallback callback) {
	super(packetDirection);
	this.callback = callback;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:5,代码来源:OAuthNetworkManager.java

示例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_);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:FakeNetHandlerPlayServer.java

示例9: CustomChannelNetworkManager

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public CustomChannelNetworkManager(Channel myChannel, EnumPacketDirection direction) {
    super(direction);
    this.channel = myChannel;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:5,代码来源:CustomChannelNetworkManager.java

示例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;
}
 
开发者ID:iChun,项目名称:Keygrip,代码行数:48,代码来源:Action.java

示例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_);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:4,代码来源:FakeNetHandlerPlayServer.java

示例12: NetworkManagerFake

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public NetworkManagerFake() {

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

示例13: FakeNetHandlerPlayServer

import net.minecraft.network.EnumPacketDirection; //导入依赖的package包/类
public FakeNetHandlerPlayServer(EntityPlayerMP player) {
	
	super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), player);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:5,代码来源:FakeNetHandlerPlayServer.java


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