Search in sources :

Example 1 with IFillerPattern

use of buildcraft.api.filler.IFillerPattern in project BuildCraft by BuildCraft.

the class BuildCraftCore method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    BuildCraftAPI.fakePlayerProvider = CoreProxy.proxy;
    EntityRegistry.registerModEntity(EntityResizableCuboid.class, "bcResizCuboid", EntityIds.RESIZABLE_CUBOID, instance, 0, 100, false);
    ChannelHandler coreChannelHandler = new ChannelHandler();
    coreChannelHandler.registerPacketType(PacketTabletMessage.class);
    channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-CORE", coreChannelHandler, handler = new PacketHandler());
    achievementManager = new AchievementPageManager("BuildCraft");
    MinecraftForge.EVENT_BUS.register(achievementManager);
    woodenGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null));
    stoneGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.stoneGear", "stoneGearAchievement", 2, 0, stoneGearItem, woodenGearAchievement));
    ironGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.ironGear", "ironGearAchievement", 4, 0, ironGearItem, stoneGearAchievement));
    goldGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.goldGear", "goldGearAchievement", 6, 0, goldGearItem, ironGearAchievement));
    diamondGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.diamondGear", "diamondGearAchievement", 8, 0, diamondGearItem, goldGearAchievement));
    wrenchAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.wrench", "wrenchAchievement", 3, 2, wrenchItem, stoneGearAchievement));
    engineRedstoneAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.redstoneEngine", "engineAchievement1", 1, -2, new ItemStack(engineBlock, 1, 0), BuildCraftCore.woodenGearAchievement));
    StatementManager.registerParameterClass(StatementParameterItemStack.class);
    StatementManager.registerParameterClass(StatementParameterItemStackExact.class);
    StatementManager.registerParameterClass(StatementParameterDirection.class);
    StatementManager.registerParameterClass(StatementParamGateSideOnly.class);
    StatementManager.registerParameterClass(StatementParameterRedstoneLevel.class);
    StatementManager.registerTriggerProvider(new CoreTriggerProvider());
    StatementManager.registerActionProvider(new CoreActionProvider());
    if (BuildCraftCore.modifyWorld) {
        MinecraftForge.EVENT_BUS.register(new SpringPopulate());
    }
    if (mainConfiguration.hasChanged()) {
        mainConfiguration.save();
    }
    if (BuildCraftCore.loadDefaultRecipes) {
        loadRecipes();
    }
    BCCreativeTab.get("main").setIcon(new ItemStack(BuildCraftCore.wrenchItem, 1));
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
    EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");
    BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
    CoreProxy.proxy.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new CoreGuiHandler());
    MinecraftForge.EVENT_BUS.register(TabletManagerClient.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TabletManagerServer.INSTANCE);
    MinecraftForge.EVENT_BUS.register(TickHandlerCore.INSTANCE);
    TabletAPI.registerProgram(new TabletProgramMenuFactory());
    // Create filler registry
    try {
        FillerManager.registry = new FillerRegistry();
        // INIT FILLER PATTERNS
        IFillerPattern[] patterns = { PatternFill.INSTANCE, PatternNone.INSTANCE, new PatternFlatten(), new PatternHorizon(), new PatternClear(), new PatternBox(), new PatternPyramid(), new PatternStairs(), new PatternCylinder(), new PatternFrame() };
        for (IFillerPattern pattern : patterns) {
            FillerManager.registry.addPattern(pattern);
        }
        ActionFiller.resetMap();
    } catch (Error error) {
        BCLog.logErrorAPI(error, IFillerPattern.class);
        throw error;
    }
    StatementManager.registerParameterClass(PatternParameterYDir.class);
    StatementManager.registerParameterClass(PatternParameterXZDir.class);
    StatementManager.registerParameterClass(PatternParameterCenter.class);
    StatementManager.registerParameterClass(PatternParameterHollow.class);
    ListRegistry.registerHandler(new ListMatchHandlerClass());
    ListRegistry.registerHandler(new ListMatchHandlerFluid());
    ListRegistry.registerHandler(new ListMatchHandlerTools());
    ListRegistry.registerHandler(new ListMatchHandlerArmor());
    // ListRegistry.registerHandler(new ListMatchHandler());
    ListRegistry.itemClassAsType.add(ItemFood.class);
    DebuggingTools.fmlInit();
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) SpringPopulate(buildcraft.core.gen.SpringPopulate) Achievement(net.minecraft.stats.Achievement) TabletProgramMenuFactory(buildcraft.core.tablet.TabletProgramMenuFactory) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) ItemStack(net.minecraft.item.ItemStack)

Example 2 with IFillerPattern

use of buildcraft.api.filler.IFillerPattern in project BuildCraft by BuildCraft.

the class BuildersActionProvider method addExternalActions.

@Override
public void addExternalActions(Collection<IActionExternal> actions, EnumFacing side, TileEntity tile) {
    if (tile instanceof TileFiller) {
        for (IFillerPattern p : FillerManager.registry.getPatterns()) {
            if (p instanceof FillerPattern) {
                FillerPattern pattern = (FillerPattern) p;
                if (!actionMap.containsKey(p.getUniqueTag())) {
                    actionMap.put(p.getUniqueTag(), ActionFiller.getForPattern(pattern));
                }
                actions.add(actionMap.get(p.getUniqueTag()));
            }
        }
    }
}
Also used : TileFiller(buildcraft.builders.TileFiller) IFillerPattern(buildcraft.api.filler.IFillerPattern) IFillerPattern(buildcraft.api.filler.IFillerPattern) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Example 3 with IFillerPattern

use of buildcraft.api.filler.IFillerPattern in project BuildCraft by BuildCraft.

the class GuiFiller method updateScreen.

@Override
public void updateScreen() {
    super.updateScreen();
    IFillerPattern pattern = container.getPatternStatementClient().get();
    SPRITE_PATTERN.delegate = pattern == null ? null : pattern.getSprite();
    SPRITE_CONTROL_MODE.delegate = BCCoreSprites.ACTION_MACHINE_CONTROL.get(container.tile.getControlMode());
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern)

Example 4 with IFillerPattern

use of buildcraft.api.filler.IFillerPattern in project BuildCraft by BuildCraft.

the class FillerType method readFromBuffer.

@Override
public IFillerPattern readFromBuffer(PacketBufferBC buffer) {
    String kind = buffer.readString();
    IFillerPattern pattern = FillerManager.registry.getPattern(kind);
    if (pattern == null) {
        return defaultStatement;
    }
    return pattern;
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern)

Example 5 with IFillerPattern

use of buildcraft.api.filler.IFillerPattern in project BuildCraft by BuildCraft.

the class FillerType method readFromNbt.

@Override
public IFillerPattern readFromNbt(NBTTagCompound nbt) {
    String kind = nbt.getString("kind");
    IFillerPattern pattern = FillerManager.registry.getPattern(kind);
    if (pattern == null) {
        return defaultStatement;
    }
    return pattern;
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern)

Aggregations

IFillerPattern (buildcraft.api.filler.IFillerPattern)6 FillerPattern (buildcraft.core.builders.patterns.FillerPattern)2 TileFiller (buildcraft.builders.TileFiller)1 SpringPopulate (buildcraft.core.gen.SpringPopulate)1 ChannelHandler (buildcraft.core.lib.network.base.ChannelHandler)1 PacketHandler (buildcraft.core.lib.network.base.PacketHandler)1 TabletProgramMenuFactory (buildcraft.core.tablet.TabletProgramMenuFactory)1 ItemStack (net.minecraft.item.ItemStack)1 Achievement (net.minecraft.stats.Achievement)1