Search in sources :

Example 1 with OreGen

use of ebf.tim.blocks.OreGen in project Trains-In-Motion-1.7.10 by EternalBlueFlame.

the class TrainsInMotion method init.

/**
     * <h2>Registries</h2>
     * register everything here.
     * blocks and items handle themselves in their own class, but entities we have to handle a bit different by doing it here.
     *
     * networking we have packets for each major channel type, its more overhead overall but it will help significantly to prevent delays.
     *
     * This could be done in pre-init but that would brake compatibility with Dragon API and a number of 3rd party mods.
     */
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    //loop for registering the entities. the values needed are the class, entity name, entity ID, mod instance, update range, update rate, and if it does velocity things,
    cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityBogie.class, "Bogie", 15, TrainsInMotion.instance, 60, 1, true);
    cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntitySeat.class, "Seat", 16, TrainsInMotion.instance, 60, 2, true);
    int index = 0;
    ///now we loop for every value in the train registry and registry it, when the index reaches a null value, then it will stop.
    while (TransportRegistry.listTrains(index) != null) {
        TransportRegistry registry = TransportRegistry.listTrains(index);
        cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(registry.trainClass, registry.item.getUnlocalizedName().replace("item", "entity"), index + 17, TrainsInMotion.instance, 60, 1, true);
        GameRegistry.registerItem(registry.item, registry.item.getUnlocalizedName().substring(5));
        index++;
    }
    //register the networking instances and channels
    TrainsInMotion.keyChannel = NetworkRegistry.INSTANCE.newSimpleChannel("TiM.key");
    TrainsInMotion.keyChannel.registerMessage(PacketKeyPress.Handler.class, PacketKeyPress.class, 1, Side.SERVER);
    TrainsInMotion.keyChannel.registerMessage(PacketMount.Handler.class, PacketMount.class, 2, Side.SERVER);
    TrainsInMotion.keyChannel.registerMessage(PacketRemove.Handler.class, PacketRemove.class, 3, Side.SERVER);
    //register the worldgen
    GameRegistry.registerWorldGenerator(new OreGen(), 0);
    //register the event handler
    MinecraftForge.EVENT_BUS.register(eventManager);
    FMLCommonHandler.instance().bus().register(eventManager);
    //register GUI, model renders, Keybinds, client only blocks, and HUD
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    proxy.register();
}
Also used : PacketKeyPress(ebf.tim.networking.PacketKeyPress) PacketMount(ebf.tim.networking.PacketMount) PacketRemove(ebf.tim.networking.PacketRemove) TransportRegistry(ebf.tim.registry.TransportRegistry) OreGen(ebf.tim.blocks.OreGen)

Aggregations

OreGen (ebf.tim.blocks.OreGen)1 PacketKeyPress (ebf.tim.networking.PacketKeyPress)1 PacketMount (ebf.tim.networking.PacketMount)1 PacketRemove (ebf.tim.networking.PacketRemove)1 TransportRegistry (ebf.tim.registry.TransportRegistry)1