Search in sources :

Example 1 with EventHandlerPneumaticCraft

use of pneumaticCraft.common.EventHandlerPneumaticCraft in project PneumaticCraft by MineMaarten.

the class PneumaticCraft method PreInit.

@EventHandler
public void PreInit(FMLPreInitializationEvent event) {
    event.getModMetadata().version = Versions.fullVersionString();
    isNEIInstalled = Loader.isModLoaded(ModIds.NEI);
    PneumaticRegistry.init(PneumaticCraftAPIHandler.getInstance());
    UpgradeRenderHandlerList.init();
    SensorHandler.init();
    Config.init(event.getSuggestedConfigurationFile());
    ThirdPartyManager.instance().index();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    tabPneumaticCraft = new CreativeTabPneumaticCraft("tabPneumaticCraft");
    Fluids.initFluids();
    Blockss.init();
    Itemss.init();
    HackableHandler.addDefaultEntries();
    ModuleRegistrator.init();
    WidgetRegistrator.init();
    ThirdPartyManager.instance().preInit();
    TileEntityRegistrator.init();
    EntityRegistrator.init();
    SemiBlockInitializer.init();
    CraftingRegistrator.init();
    VillagerHandler.instance().init();
    GameRegistry.registerWorldGenerator(new WorldGeneratorPneumaticCraft(), 0);
    AchievementHandler.init();
    HeatBehaviourManager.getInstance().init();
    proxy.registerRenders();
    proxy.registerHandlers();
    tickHandler = new TickHandlerPneumaticCraft();
    FMLCommonHandler.instance().bus().register(tickHandler);
    MinecraftForge.EVENT_BUS.register(new EventHandlerPneumaticCraft());
    MinecraftForge.EVENT_BUS.register(new EventHandlerUniversalSensor());
    MinecraftForge.EVENT_BUS.register(new DroneSpecialVariableHandler());
    FMLCommonHandler.instance().bus().register(new CraftingHandler());
    FMLCommonHandler.instance().bus().register(new Config());
}
Also used : WorldGeneratorPneumaticCraft(pneumaticCraft.common.worldgen.WorldGeneratorPneumaticCraft) EventHandlerUniversalSensor(pneumaticCraft.common.EventHandlerUniversalSensor) Config(pneumaticCraft.common.config.Config) CreativeTabPneumaticCraft(pneumaticCraft.client.CreativeTabPneumaticCraft) CraftingHandler(pneumaticCraft.common.recipes.CraftingHandler) EventHandlerPneumaticCraft(pneumaticCraft.common.EventHandlerPneumaticCraft) DroneSpecialVariableHandler(pneumaticCraft.common.event.DroneSpecialVariableHandler) TickHandlerPneumaticCraft(pneumaticCraft.common.TickHandlerPneumaticCraft) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 2 with EventHandlerPneumaticCraft

use of pneumaticCraft.common.EventHandlerPneumaticCraft in project PneumaticCraft by MineMaarten.

the class DroneEntityAIPickupItems method continueExecuting.

/**
     * Returns whether an in-progress EntityAIBase should continue executing
     */
@Override
public boolean continueExecuting() {
    if (curPickingUpEntity.isDead)
        return false;
    if (Vec3.createVectorHelper(curPickingUpEntity.posX, curPickingUpEntity.posY, curPickingUpEntity.posZ).distanceTo(drone.getPosition()) < 1.5) {
        ItemStack stack = curPickingUpEntity.getEntityItem();
        if (itemPickupWidget.isItemValidForFilters(stack)) {
            //not posting the event globally, as I don't have a way of handling a canceled event.
            new EventHandlerPneumaticCraft().onPlayerPickup(new EntityItemPickupEvent(drone.getFakePlayer(), curPickingUpEntity));
            int stackSize = stack.stackSize;
            //side doesn't matter, drones aren't ISided.
            ItemStack remainder = PneumaticCraftUtils.exportStackToInventory(drone.getInventory(), stack, ForgeDirection.UP);
            if (remainder == null) {
                drone.onItemPickupEvent(curPickingUpEntity, stackSize);
                curPickingUpEntity.setDead();
            }
        }
        return false;
    }
    return !drone.getPathNavigator().hasNoPath();
}
Also used : ItemStack(net.minecraft.item.ItemStack) EventHandlerPneumaticCraft(pneumaticCraft.common.EventHandlerPneumaticCraft) EntityItemPickupEvent(net.minecraftforge.event.entity.player.EntityItemPickupEvent)

Aggregations

EventHandlerPneumaticCraft (pneumaticCraft.common.EventHandlerPneumaticCraft)2 EventHandler (cpw.mods.fml.common.Mod.EventHandler)1 ItemStack (net.minecraft.item.ItemStack)1 EntityItemPickupEvent (net.minecraftforge.event.entity.player.EntityItemPickupEvent)1 CreativeTabPneumaticCraft (pneumaticCraft.client.CreativeTabPneumaticCraft)1 EventHandlerUniversalSensor (pneumaticCraft.common.EventHandlerUniversalSensor)1 TickHandlerPneumaticCraft (pneumaticCraft.common.TickHandlerPneumaticCraft)1 Config (pneumaticCraft.common.config.Config)1 DroneSpecialVariableHandler (pneumaticCraft.common.event.DroneSpecialVariableHandler)1 CraftingHandler (pneumaticCraft.common.recipes.CraftingHandler)1 WorldGeneratorPneumaticCraft (pneumaticCraft.common.worldgen.WorldGeneratorPneumaticCraft)1