Java 类net.minecraft.util.com.google.common.collect.BiMap 实例源码

项目:AnnihilationPro    文件:Bar.java   
private void overrideI()
{
    try
    {
        Field field = EnumProtocol.class.getDeclaredField("i");
        field.setAccessible(true);
        this.map = (BiMap) field.get(EnumProtocol.PLAY);
        special = new ProxyHashBiMap<Integer, Class>(map);
        set(field, EnumProtocol.PLAY, special);
    }
    catch(Exception ex)
    {
        ex.printStackTrace();
        throw new ExceptionInInitializerError("Nope, not allowed.");
    }
}
项目:Tweakkit-Server    文件:PacketEncoder.java   
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet, ByteBuf bytebuf) throws IOException {
    Integer integer = (Integer) ((BiMap) channelhandlercontext.channel().attr(NetworkManager.f).get()).inverse().get(packet.getClass());

    if (a.isDebugEnabled()) {
        a.debug(b, "OUT: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), integer, packet.getClass().getName(), packet.b()});
    }

    if (integer == null) {
        throw new IOException("Can\'t serialize unregistered packet");
    } else {
        PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext.channel())); // Spigot

        packetdataserializer.b(integer.intValue());
        packet.b(packetdataserializer);
        this.c.b(integer.intValue(), (long) packetdataserializer.readableBytes());
    }
}
项目:CraftBukkit    文件:Packet.java   
public static Packet a(BiMap bimap, int i) {
    try {
        Class oclass = (Class) bimap.get(Integer.valueOf(i));

        return oclass == null ? null : (Packet) oclass.newInstance();
    } catch (Exception exception) {
        a.error("Couldn\'t create packet " + i, exception);
        return null;
    }
}
项目:MineOffHeap    文件:Packet.java   
public static Packet a(BiMap bimap, int i) {
    try {
        Class oclass = (Class) bimap.get(Integer.valueOf(i));

        return oclass == null ? null : (Packet) oclass.newInstance();
    } catch (Exception exception) {
        a.error("Couldn\'t create packet " + i, exception);
        return null;
    }
}
项目:Tweakkit-Server    文件:Packet.java   
public static Packet a(BiMap bimap, int i) {
    try {
        Class oclass = (Class) bimap.get(Integer.valueOf(i));

        return oclass == null ? null : (Packet) oclass.newInstance();
    } catch (Exception exception) {
        a.error("Couldn\'t create packet " + i, exception);
        return null;
    }
}
项目:AnnihilationPro    文件:ProxyHashBiMap.java   
public ProxyHashBiMap(BiMap<K, V> map)
{
    this.delegate = map;
    this.inverse = new Inverse(this, map.inverse(), map);
}
项目:AnnihilationPro    文件:ProxyHashBiMap.java   
private ProxyHashBiMap(BiMap<K, V> map, BiMap<V, K> inversed)
{
    this.delegate = map;
    this.inverse = null;
}
项目:AnnihilationPro    文件:ProxyHashBiMap.java   
private Inverse(ProxyHashBiMap original, BiMap<V, K> forward, BiMap<K, V> backward)
{
    super(forward, backward);
    this.original = original;
}