Java 类net.minecraft.network.EnumPacketDirection 实例源码

项目:Cyclic    文件:UtilFakePlayer.java   
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;
}
项目:pnc-repressurized    文件:EntityDrone.java   
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);
}
项目:pnc-repressurized    文件:TileEntityProgrammableController.java   
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;
            }
        }
    };
}
项目:EMC    文件:OAuthNetworkManager.java   
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;
}
项目:DecompiledMinecraft    文件:MessageSerializer.java   
public MessageSerializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:DecompiledMinecraft    文件:MessageDeserializer.java   
public MessageDeserializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:DecompiledMinecraft    文件:MessageSerializer.java   
public MessageSerializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:DecompiledMinecraft    文件:MessageDeserializer.java   
public MessageDeserializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:BaseClient    文件:MessageSerializer.java   
public MessageSerializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:BaseClient    文件:MessageDeserializer.java   
public MessageDeserializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:BaseClient    文件:MessageSerializer.java   
public MessageSerializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:BaseClient    文件:MessageDeserializer.java   
public MessageDeserializer(EnumPacketDirection direction)
{
    this.direction = direction;
}
项目:EMC    文件:OAuthNetworkManager.java   
public OAuthNetworkManager(EnumPacketDirection packetDirection, OAuthCallback callback) {
    super(packetDirection);
    this.callback = callback;
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
  super(FMLCommonHandler.instance().getMinecraftServerInstance(), new net.minecraft.network.NetworkManager(EnumPacketDirection.SERVERBOUND), p_i1530_3_);
}
项目:Factorization    文件:CustomChannelNetworkManager.java   
public CustomChannelNetworkManager(Channel myChannel, EnumPacketDirection direction) {
    super(direction);
    this.channel = myChannel;
}
项目:Keygrip    文件:Action.java   
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;
}
项目:EnderIO    文件:FakeNetHandlerPlayServer.java   
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_) {
  super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), p_i1530_3_);
}
项目:DankNull    文件:NetServerHandlerFake.java   
public NetworkManagerFake() {

            super(EnumPacketDirection.CLIENTBOUND);
        }
项目:uniquecrops    文件:FakeNetHandlerPlayServer.java   
public FakeNetHandlerPlayServer(EntityPlayerMP player) {

    super(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.CLIENTBOUND), player);
}