Search in sources :

Example 36 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class PacketCheckDimletConfig method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    int size = buf.readInt();
    dimlets = new HashMap<Integer, DimletKey>();
    for (int i = 0; i < size; i++) {
        int id = buf.readInt();
        String name = NetworkTools.readString(buf);
        int typeOrdinal = buf.readInt();
        try {
            dimlets.put(id, new DimletKey(DimletType.values()[typeOrdinal], name));
        } catch (Exception e) {
            Logging.logError("INTERNAL ERROR: name=" + name + ", i=" + i + ", size=" + size + "!");
            throw new RuntimeException(e);
        }
    }
}
Also used : DimletKey(mcjty.rftools.items.dimlets.DimletKey)

Example 37 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class PacketCheckDimletConfig method toBytes.

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(dimlets.size());
    for (Map.Entry<Integer, DimletKey> me : dimlets.entrySet()) {
        DimletKey key = me.getValue();
        buf.writeInt(me.getKey());
        NetworkTools.writeString(buf, key.getName());
        buf.writeInt(key.getType().ordinal());
    }
}
Also used : DimletKey(mcjty.rftools.items.dimlets.DimletKey) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

DimletKey (mcjty.rftools.items.dimlets.DimletKey)37 ItemStack (net.minecraft.item.ItemStack)9 List (java.util.List)7 ArrayList (java.util.ArrayList)6 DimletEntry (mcjty.rftools.items.dimlets.DimletEntry)5 Block (net.minecraft.block.Block)4 BlockMeta (mcjty.lib.varia.BlockMeta)3 TerrainType (mcjty.rftools.dimension.world.types.TerrainType)3 Slot (net.minecraft.inventory.Slot)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 Map (java.util.Map)2 MobDescriptor (mcjty.rftools.dimension.description.MobDescriptor)2 ControllerType (mcjty.rftools.dimension.world.types.ControllerType)2 FeatureType (mcjty.rftools.dimension.world.types.FeatureType)2 DimletType (mcjty.rftools.items.dimlets.DimletType)2 MerchantRecipe (net.minecraft.village.MerchantRecipe)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Counter (mcjty.lib.varia.Counter)1