Search in sources :

Example 1 with FurnaceRecipeData

use of top.theillusivec4.polymorph.common.capability.FurnaceRecipeData in project Polymorph by TheIllusiveC4.

the class PolymorphMod method onInitialize.

@Override
public void onInitialize() {
    PolymorphNetwork.setup();
    PolymorphCommands.setup();
    CommonEventsListener.setup();
    PolymorphIntegrations.init();
    PolymorphIntegrations.setup();
    PolymorphCommon commonApi = PolymorphApi.common();
    commonApi.registerBlockEntity2RecipeData(AbstractFurnaceBlockEntity.class, blockEntity -> new FurnaceRecipeData((AbstractFurnaceBlockEntity) blockEntity));
    commonApi.registerScreenHandler2BlockEntity(container -> {
        for (Slot inventorySlot : container.slots) {
            Inventory inventory = inventorySlot.inventory;
            if (inventory instanceof BlockEntity) {
                return (BlockEntity) inventory;
            }
        }
        return null;
    });
}
Also used : AbstractFurnaceBlockEntity(net.minecraft.block.entity.AbstractFurnaceBlockEntity) FurnaceRecipeData(top.theillusivec4.polymorph.common.component.FurnaceRecipeData) Slot(net.minecraft.screen.slot.Slot) PolymorphCommon(top.theillusivec4.polymorph.api.common.base.PolymorphCommon) Inventory(net.minecraft.inventory.Inventory) BlockEntity(net.minecraft.block.entity.BlockEntity) AbstractFurnaceBlockEntity(net.minecraft.block.entity.AbstractFurnaceBlockEntity)

Example 2 with FurnaceRecipeData

use of top.theillusivec4.polymorph.common.capability.FurnaceRecipeData in project Polymorph by TheIllusiveC4.

the class PolymorphMod method setup.

private void setup(final FMLCommonSetupEvent pEvent) {
    PolymorphNetwork.setup();
    MinecraftForge.EVENT_BUS.register(new CommonEventsListener());
    IPolymorphCommon commonApi = PolymorphApi.common();
    commonApi.registerTileEntity2RecipeData(tileEntity -> {
        if (tileEntity instanceof AbstractFurnaceBlockEntity) {
            return new FurnaceRecipeData((AbstractFurnaceBlockEntity) tileEntity);
        }
        return null;
    });
    commonApi.registerContainer2TileEntity(container -> {
        for (Slot inventorySlot : container.slots) {
            Container inventory = inventorySlot.container;
            if (inventory instanceof BlockEntity) {
                return (BlockEntity) inventory;
            }
        }
        return null;
    });
    PolymorphIntegrations.setup();
}
Also used : Container(net.minecraft.world.Container) AbstractFurnaceBlockEntity(net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity) FurnaceRecipeData(top.theillusivec4.polymorph.common.capability.FurnaceRecipeData) Slot(net.minecraft.world.inventory.Slot) IPolymorphCommon(top.theillusivec4.polymorph.api.common.base.IPolymorphCommon) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) AbstractFurnaceBlockEntity(net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity)

Aggregations

AbstractFurnaceBlockEntity (net.minecraft.block.entity.AbstractFurnaceBlockEntity)1 BlockEntity (net.minecraft.block.entity.BlockEntity)1 Inventory (net.minecraft.inventory.Inventory)1 Slot (net.minecraft.screen.slot.Slot)1 Container (net.minecraft.world.Container)1 Slot (net.minecraft.world.inventory.Slot)1 AbstractFurnaceBlockEntity (net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 IPolymorphCommon (top.theillusivec4.polymorph.api.common.base.IPolymorphCommon)1 PolymorphCommon (top.theillusivec4.polymorph.api.common.base.PolymorphCommon)1 FurnaceRecipeData (top.theillusivec4.polymorph.common.capability.FurnaceRecipeData)1 FurnaceRecipeData (top.theillusivec4.polymorph.common.component.FurnaceRecipeData)1