Search in sources :

Example 1 with FlowerPotBlock

use of net.minecraft.block.FlowerPotBlock in project carpet-extra by gnembon.

the class FlowerPotDispenserBehavior method dispenseSilently.

@Override
protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
    this.setSuccess(true);
    Item item = stack.getItem();
    ServerWorld world = pointer.getWorld();
    BlockPos frontBlockPos = pointer.getPos().offset(pointer.getBlockState().get(DispenserBlock.FACING));
    BlockState frontBlockState = world.getBlockState(frontBlockPos);
    FlowerPotBlock frontBlock = (FlowerPotBlock) frontBlockState.getBlock();
    // check if flower pot is empty
    if (frontBlock.getContent() == Blocks.AIR && FlowerPotHelper.isPottable(item)) {
        FlowerPotBlock pottedBlock = FlowerPotHelper.getPottedBlock(item);
        // place filled flower pot
        world.setBlockState(frontBlockPos, pottedBlock.getDefaultState());
        world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, frontBlockPos);
        // check if flower pot should load chunk
        FlowerPotHelper.updateLoadStatus(world, frontBlockPos, pottedBlock.getContent(), true);
        // remove flower and return
        stack.decrement(1);
        return stack;
    }
    // fail to dispense
    this.setSuccess(false);
    return stack;
}
Also used : ServerWorld(net.minecraft.server.world.ServerWorld) Item(net.minecraft.item.Item) BlockState(net.minecraft.block.BlockState) BlockPos(net.minecraft.util.math.BlockPos) FlowerPotBlock(net.minecraft.block.FlowerPotBlock)

Example 2 with FlowerPotBlock

use of net.minecraft.block.FlowerPotBlock in project carpet-extra by gnembon.

the class CarpetExtraDispenserBehaviors method getCustomDispenserBehavior.

// get custom dispenser behavior
// this checks conditions such as the item and certain block or entity being in front of the dispenser to decide which rule to return
// if the conditions for the rule match, it returns the instance of the dispenser behavior
// returns null to fallback to vanilla (or another mod's) behavior for the given item
public static DispenserBehavior getCustomDispenserBehavior(ServerWorld world, BlockPos pos, BlockPointer pointer, DispenserBlockEntity dispenserBlockEntity, ItemStack stack, Map<Item, DispenserBehavior> VANILLA_BEHAVIORS) {
    Item item = stack.getItem();
    Direction dispenserFacing = pointer.getBlockState().get(DispenserBlock.FACING);
    BlockPos frontBlockPos = pos.offset(dispenserFacing);
    BlockState frontBlockState = world.getBlockState(frontBlockPos);
    Block frontBlock = frontBlockState.getBlock();
    Box frontBlockBox = new Box(frontBlockPos);
    // blazeMeal
    if (CarpetExtraSettings.blazeMeal && item == Items.BLAZE_POWDER && frontBlock == Blocks.NETHER_WART) {
        return BLAZE_MEAL;
    }
    // chickenShearing
    if (CarpetExtraSettings.chickenShearing && item == Items.SHEARS) {
        boolean hasShearableChickens = !world.getEntitiesByType(EntityType.CHICKEN, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY.and((chickenEntity) -> {
            return !((AnimalEntity) chickenEntity).isBaby();
        })).isEmpty();
        if (hasShearableChickens) {
            return SHEAR_CHICKEN;
        }
    }
    // dispensersCarvePumpkins
    if (CarpetExtraSettings.dispensersCarvePumpkins && item instanceof ShearsItem && frontBlock == Blocks.PUMPKIN) {
        return CARVE_PUMPKIN;
    }
    // dispensersFeedAnimals
    if (CarpetExtraSettings.dispensersFeedAnimals) {
        // check for animals that can be bred with the current item being dispensed in front of dispenser
        boolean hasFeedableAnimals = !world.getEntitiesByClass(AnimalEntity.class, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY.and((animalEntity) -> {
            return ((AnimalEntity) animalEntity).isBreedingItem(stack);
        })).isEmpty();
        if (hasFeedableAnimals) {
            return FEED_ANIMAL;
        }
        // get brown mooshrooms in front of dispenser
        boolean hasFeedableMooshrooms = !world.getEntitiesByType(EntityType.MOOSHROOM, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY.and((mooshroomEntity) -> {
            return ((MooshroomEntity) mooshroomEntity).getMooshroomType() == MooshroomEntity.Type.BROWN;
        })).isEmpty();
        // check if item is a small flower
        if (hasFeedableMooshrooms && item.getRegistryEntry().isIn(ItemTags.SMALL_FLOWERS)) {
            return FEED_MOOSHROOM;
        }
    }
    // dispensersFillMinecarts
    if (CarpetExtraSettings.dispensersFillMinecarts) {
        // check for minecarts with no riders in front of dispenser
        boolean hasMinecarts = !world.getEntitiesByType(EntityType.MINECART, frontBlockBox, EntityPredicates.NOT_MOUNTED).isEmpty();
        // if a minecart exist, return dispenser behavior according to item type
        if (hasMinecarts) {
            if (item == Items.CHEST) {
                return FILL_MINECART_CHEST;
            } else if (item == Items.FURNACE) {
                return FILL_MINECART_FURNACE;
            } else if (item == Items.TNT) {
                return FILL_MINECART_TNT;
            } else if (item == Items.HOPPER) {
                return FILL_MINECART_HOPPER;
            }
        }
    }
    // dispensersMilkAnimals
    if (CarpetExtraSettings.dispensersMilkAnimals) {
        // bucket to milk
        if (item == Items.BUCKET) {
            // check for cows, mooshrooms, or goats in front of dispenser
            boolean hasMilkable = !world.getEntitiesByClass(AnimalEntity.class, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY.and((animalEntity) -> {
                return animalEntity instanceof CowEntity || animalEntity instanceof GoatEntity;
            })).isEmpty();
            if (hasMilkable) {
                return MILK_ANIMAL;
            }
        } else // bowl to stew
        if (item == Items.BOWL) {
            // check for mooshrooms in front of dispenser
            boolean hasMooshroom = !world.getEntitiesByType(EntityType.MOOSHROOM, frontBlockBox, EntityPredicates.VALID_LIVING_ENTITY).isEmpty();
            if (hasMooshroom) {
                return MILK_MOOSHROOM;
            }
        }
    }
    // dispensersPlayRecords
    if (CarpetExtraSettings.dispensersPlayRecords && item instanceof MusicDiscItem && frontBlock == Blocks.JUKEBOX) {
        return PLAY_DISC;
    }
    // dispensersPotPlants
    if (CarpetExtraSettings.dispensersPotPlants && frontBlock instanceof FlowerPotBlock && FlowerPotHelper.isPottable(item)) {
        return FILL_FLOWER_POT;
    }
    // dispensersStripBlocks
    if (CarpetExtraSettings.dispensersStripBlocks && item instanceof AxeItem && (StripBlocksDispenserBehavior.canStrip(frontBlock) || StripBlocksDispenserBehavior.isStripResult(frontBlock))) {
        return STRIP_BLOCK;
    }
    // dispensersTillSoil
    if (CarpetExtraSettings.dispensersTillSoil && item instanceof HoeItem) {
        // check block in front of dispenser and one block down
        for (int i = 0; i < 2; i++) {
            BlockPos hoeBlockPos = frontBlockPos.down(i);
            Block hoeBlock = world.getBlockState(hoeBlockPos).getBlock();
            // check if block is in tilled blocks, or is farmland (to prevent hoe being dispensed when you don't want it to)
            if (TillSoilDispenserBehavior.TILLED_BLOCKS.contains(hoeBlock) || hoeBlock == Blocks.FARMLAND) {
                return TILL_SOIL;
            }
        }
    }
    // dispensersToggleThings
    if (CarpetExtraSettings.dispensersToggleThings && item == Items.STICK && ToggleBlockDispenserBehavior.TOGGLEABLE_BLOCKS.contains(frontBlock)) {
        return TOGGLE_BLOCK;
    }
    // dispensersUseCauldrons
    if (CarpetExtraSettings.dispensersUseCauldrons && frontBlock instanceof AbstractCauldronBlock) {
        // empty cauldron
        if (item == Items.BUCKET) {
            return CAULDRON_EMPTYING_BUCKET;
        } else // fill cauldron
        if (item == Items.LAVA_BUCKET || item == Items.WATER_BUCKET || item == Items.POWDER_SNOW_BUCKET) {
            return CAULDRON_FILLING_BUCKET;
        } else // water cauldron behaviors (leather armor, shulker boxes, banners)
        if (CauldronWaterDispenserBehavior.isWaterCauldronItem(stack)) {
            return CAULDRON_WATER;
        }
    }
    // renewableEndstone
    if (CarpetExtraSettings.renewableEndstone && item == Items.DRAGON_BREATH && frontBlock == Blocks.COBBLESTONE) {
        return DRAGON_BREATH_ENDSTONE;
    }
    // renewableNetherrack
    if (CarpetExtraSettings.renewableNetherrack && item == Items.FIRE_CHARGE && frontBlock == Blocks.COBBLESTONE) {
        return FIRE_CHARGE_NETHERRACK;
    }
    // no custom behavior, return null
    return null;
}
Also used : EntityType(net.minecraft.entity.EntityType) ItemTags(net.minecraft.tag.ItemTags) TillSoilDispenserBehavior(carpetextra.dispenser.behaviors.TillSoilDispenserBehavior) CauldronFillingDispenserBehavior(carpetextra.dispenser.behaviors.CauldronFillingDispenserBehavior) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) Item(net.minecraft.item.Item) BlockPointer(net.minecraft.util.math.BlockPointer) CarvePumpkinDispenserBehavior(carpetextra.dispenser.behaviors.CarvePumpkinDispenserBehavior) GoatEntity(net.minecraft.entity.passive.GoatEntity) MooshroomEntity(net.minecraft.entity.passive.MooshroomEntity) FillMinecartDispenserBehavior(carpetextra.dispenser.behaviors.FillMinecartDispenserBehavior) Block(net.minecraft.block.Block) MusicDiscDispenserBehavior(carpetextra.dispenser.behaviors.MusicDiscDispenserBehavior) Map(java.util.Map) DragonBreathDispenserBehavior(carpetextra.dispenser.behaviors.DragonBreathDispenserBehavior) BlockState(net.minecraft.block.BlockState) CauldronEmptyingDispenserBehavior(carpetextra.dispenser.behaviors.CauldronEmptyingDispenserBehavior) DispenserBlockEntity(net.minecraft.block.entity.DispenserBlockEntity) AxeItem(net.minecraft.item.AxeItem) FireChargeDispenserBehavior(carpetextra.dispenser.behaviors.FireChargeDispenserBehavior) DispenserBehavior(net.minecraft.block.dispenser.DispenserBehavior) StripBlocksDispenserBehavior(carpetextra.dispenser.behaviors.StripBlocksDispenserBehavior) CauldronWaterDispenserBehavior(carpetextra.dispenser.behaviors.CauldronWaterDispenserBehavior) CarpetExtraSettings(carpetextra.CarpetExtraSettings) HoeItem(net.minecraft.item.HoeItem) ServerWorld(net.minecraft.server.world.ServerWorld) CowEntity(net.minecraft.entity.passive.CowEntity) Direction(net.minecraft.util.math.Direction) ItemStack(net.minecraft.item.ItemStack) AbstractMinecartEntity(net.minecraft.entity.vehicle.AbstractMinecartEntity) EntityPredicates(net.minecraft.predicate.entity.EntityPredicates) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) MilkMooshroomDispenserBehavior(carpetextra.dispenser.behaviors.MilkMooshroomDispenserBehavior) MusicDiscItem(net.minecraft.item.MusicDiscItem) ShearsItem(net.minecraft.item.ShearsItem) ToggleBlockDispenserBehavior(carpetextra.dispenser.behaviors.ToggleBlockDispenserBehavior) Box(net.minecraft.util.math.Box) MilkAnimalDispenserBehavior(carpetextra.dispenser.behaviors.MilkAnimalDispenserBehavior) BlockPos(net.minecraft.util.math.BlockPos) FlowerPotDispenserBehavior(carpetextra.dispenser.behaviors.FlowerPotDispenserBehavior) Items(net.minecraft.item.Items) AbstractCauldronBlock(net.minecraft.block.AbstractCauldronBlock) Blocks(net.minecraft.block.Blocks) FeedAnimalDispenserBehavior(carpetextra.dispenser.behaviors.FeedAnimalDispenserBehavior) FeedMooshroomDispenserBehavior(carpetextra.dispenser.behaviors.FeedMooshroomDispenserBehavior) ShearChickenDispenserBehavior(carpetextra.dispenser.behaviors.ShearChickenDispenserBehavior) FlowerPotHelper(carpetextra.helpers.FlowerPotHelper) DispenserBlock(net.minecraft.block.DispenserBlock) BlazePowderDispenserBehavior(carpetextra.dispenser.behaviors.BlazePowderDispenserBehavior) AbstractCauldronBlock(net.minecraft.block.AbstractCauldronBlock) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Box(net.minecraft.util.math.Box) ShearsItem(net.minecraft.item.ShearsItem) GoatEntity(net.minecraft.entity.passive.GoatEntity) Direction(net.minecraft.util.math.Direction) AxeItem(net.minecraft.item.AxeItem) HoeItem(net.minecraft.item.HoeItem) MusicDiscItem(net.minecraft.item.MusicDiscItem) Item(net.minecraft.item.Item) AxeItem(net.minecraft.item.AxeItem) HoeItem(net.minecraft.item.HoeItem) MusicDiscItem(net.minecraft.item.MusicDiscItem) ShearsItem(net.minecraft.item.ShearsItem) BlockState(net.minecraft.block.BlockState) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) Block(net.minecraft.block.Block) AbstractCauldronBlock(net.minecraft.block.AbstractCauldronBlock) DispenserBlock(net.minecraft.block.DispenserBlock) BlockPos(net.minecraft.util.math.BlockPos) MooshroomEntity(net.minecraft.entity.passive.MooshroomEntity) CowEntity(net.minecraft.entity.passive.CowEntity) FlowerPotBlock(net.minecraft.block.FlowerPotBlock)

Example 3 with FlowerPotBlock

use of net.minecraft.block.FlowerPotBlock in project ExtendedMushrooms by cech12.

the class ModBlocks method registerBlocks.

@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
    FAIRY_RING = registerBlock("fairy_ring", new FairyRingBlock());
    INFESTED_GRASS = registerBlock("infested_grass", ItemGroup.TAB_DECORATIONS, new InfestedGrassBlock(Block.Properties.of(Material.REPLACEABLE_PLANT).noCollission().strength(0.0F).sound(SoundType.GRASS)));
    INFESTED_FLOWER = registerBlock("infested_flower", ItemGroup.TAB_DECORATIONS, new InfestedFlowerBlock(Effects.MOVEMENT_SLOWDOWN, 9, Block.Properties.of(Material.PLANT).noCollission().strength(0.0F).sound(SoundType.GRASS)));
    INFESTED_FLOWER_POTTED = registerBlock("infested_flower_potted", new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> INFESTED_FLOWER, Block.Properties.of(Material.DECORATION).strength(0.0F).noOcclusion()));
    ((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(Objects.requireNonNull(INFESTED_FLOWER.getRegistryName()), () -> INFESTED_FLOWER_POTTED);
    MUSHROOM_BOOKSHELF = registerCompatBlock("mushroom_bookshelf", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVariantBookshelvesModLoaded(), new BookshelfBlock(Block.Properties.copy(Blocks.BOOKSHELF)));
    MUSHROOM_BUTTON = registerBlock("mushroom_button", ItemGroup.TAB_REDSTONE, new MushroomWoodButtonBlock());
    MUSHROOM_CHEST = registerCompatBlock("mushroom_chest", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantChestsModLoaded(), new VariantChestBlock(MushroomWoodType.MUSHROOM, Block.Properties.copy(Blocks.CHEST)));
    MUSHROOM_CHEST_TRAPPED = registerCompatBlock("mushroom_chest_trapped", ItemGroup.TAB_REDSTONE, ModCompat.isVariantTrappedChestsModLoaded(), new VariantTrappedChestBlock(MushroomWoodType.MUSHROOM, Block.Properties.copy(Blocks.TRAPPED_CHEST)));
    MUSHROOM_DOOR = registerBlock("mushroom_door", ItemGroup.TAB_REDSTONE, new DoorBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOL).strength(3.0F).sound(SoundType.WOOD)));
    MUSHROOM_FENCE = registerBlock("mushroom_fence", ItemGroup.TAB_DECORATIONS, new MushroomFenceBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOL).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    MUSHROOM_FENCE_GATE = registerBlock("mushroom_fence_gate", ItemGroup.TAB_REDSTONE, new MushroomFenceGateBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOL).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    MUSHROOM_LADDER = registerCompatBlock("mushroom_ladder", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantLaddersModLoaded(), new LadderBlock(Block.Properties.copy(Blocks.LADDER)));
    MUSHROOM_PLANKS = registerBlock("mushroom_planks", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomPlanksBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOL).strength(0.2F).sound(SoundType.WOOD)));
    MUSHROOM_PRESSURE_PLATE = registerBlock("mushroom_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomWoodPressurePlateBlock());
    MUSHROOM_SLAB = registerBlock("mushroom_slab", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomSlabBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    MUSHROOM_STAIRS = registerBlock("mushroom_stairs", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStairsBlock(() -> MUSHROOM_PLANKS.defaultBlockState(), Block.Properties.copy(MUSHROOM_PLANKS)));
    MUSHROOM_TRAPDOOR = registerBlock("mushroom_trapdoor", ItemGroup.TAB_REDSTONE, new MushroomTrapdoorBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOL).strength(3.0F).sound(SoundType.WOOD)));
    STRIPPED_MUSHROOM_STEM = registerBlock("stripped_mushroom_stem", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStemBlock(MushroomWoodType.MUSHROOM, Block.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    BLOCK_STRIPPING_MAP.put(Blocks.MUSHROOM_STEM, STRIPPED_MUSHROOM_STEM);
    MUSHROOM_VERTICAL_PLANKS = registerCompatBlock("mushroom_vertical_planks", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalPlanksModLoaded(), new VerticalPlanksBlock(Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    MUSHROOM_VERTICAL_SLAB = registerCompatBlock("mushroom_vertical_slab", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalSlabsModLoaded(), new VerticalSlabBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    BROWN_MUSHROOM_BUTTON = registerBlock("brown_mushroom_button", ItemGroup.TAB_REDSTONE, new MushroomCapButtonBlock());
    BROWN_MUSHROOM_CARPET = registerBlock("brown_mushroom_carpet", ItemGroup.TAB_DECORATIONS, new MushroomCarpetBlock(DyeColor.BROWN, Block.Properties.of(Material.CLOTH_DECORATION, MaterialColor.COLOR_BROWN).strength(0.1F).sound(SoundType.WOOL)));
    BROWN_MUSHROOM_PRESSURE_PLATE = registerBlock("brown_mushroom_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomCapPressurePlateBlock());
    RED_MUSHROOM_BUTTON = registerBlock("red_mushroom_button", ItemGroup.TAB_REDSTONE, new MushroomCapButtonBlock());
    RED_MUSHROOM_CARPET = registerBlock("red_mushroom_carpet", ItemGroup.TAB_DECORATIONS, new MushroomCarpetBlock(DyeColor.RED, Block.Properties.of(Material.CLOTH_DECORATION, MaterialColor.COLOR_RED).strength(0.1F).sound(SoundType.WOOL)));
    RED_MUSHROOM_PRESSURE_PLATE = registerBlock("red_mushroom_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomCapPressurePlateBlock());
    GLOWSHROOM = registerBlock("glowshroom", ItemGroup.TAB_DECORATIONS, new EMMushroomBlock(new Glowshroom(), Block.Properties.of(Material.PLANT).noCollission().randomTicks().strength(0.0F).sound(SoundType.GRASS).lightLevel((state) -> 8).hasPostProcess((a, b, c) -> true)));
    GLOWSHROOM_POTTED = registerBlock("glowshroom_potted", new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> GLOWSHROOM, Block.Properties.of(Material.DECORATION).strength(0.0F).noOcclusion().lightLevel((state) -> 8)));
    ((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(Objects.requireNonNull(GLOWSHROOM.getRegistryName()), () -> GLOWSHROOM_POTTED);
    GLOWSHROOM_CAP = registerBlock("glowshroom_cap", ItemGroup.TAB_DECORATIONS, new GlowshroomCap(MushroomType.GLOWSHROOM, Block.Properties.of(Material.WOOD, MaterialColor.COLOR_BLUE).strength(0.2F).sound(SoundType.WOOL).lightLevel((state) -> 8)));
    GLOWSHROOM_STEM = registerBlock("glowshroom_stem", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStemBlock(MushroomWoodType.GLOWSHROOM, Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_STEM_STRIPPED = registerBlock("glowshroom_stem_stripped", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStemBlock(MushroomWoodType.GLOWSHROOM, Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    BLOCK_STRIPPING_MAP.put(GLOWSHROOM_STEM, GLOWSHROOM_STEM_STRIPPED);
    GLOWSHROOM_BOOKSHELF = registerCompatBlock("glowshroom_bookshelf", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVariantBookshelvesModLoaded(), new BookshelfBlock(Block.Properties.copy(Blocks.BOOKSHELF).lightLevel((state) -> 8)));
    GLOWSHROOM_BUTTON = registerBlock("glowshroom_button", ItemGroup.TAB_REDSTONE, new MushroomWoodButtonBlock(8));
    GLOWSHROOM_CHEST = registerCompatBlock("glowshroom_chest", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantChestsModLoaded(), new VariantChestBlock(MushroomWoodType.GLOWSHROOM, Block.Properties.copy(Blocks.CHEST).lightLevel((state) -> 8)));
    GLOWSHROOM_CHEST_TRAPPED = registerCompatBlock("glowshroom_chest_trapped", ItemGroup.TAB_REDSTONE, ModCompat.isVariantTrappedChestsModLoaded(), new VariantTrappedChestBlock(MushroomWoodType.GLOWSHROOM, Block.Properties.copy(Blocks.TRAPPED_CHEST).lightLevel((state) -> 8)));
    GLOWSHROOM_DOOR = registerBlock("glowshroom_door", ItemGroup.TAB_REDSTONE, new DoorBlock(Block.Properties.of(Material.WOOD).strength(3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_FENCE = registerBlock("glowshroom_fence", ItemGroup.TAB_DECORATIONS, new MushroomFenceBlock(Block.Properties.of(Material.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_FENCE_GATE = registerBlock("glowshroom_fence_gate", ItemGroup.TAB_REDSTONE, new MushroomFenceGateBlock(Block.Properties.of(Material.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_LADDER = registerCompatBlock("glowshroom_ladder", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantLaddersModLoaded(), new LadderBlock(Block.Properties.copy(Blocks.LADDER).lightLevel((state) -> 8)));
    GLOWSHROOM_PLANKS = registerBlock("glowshroom_planks", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomPlanksBlock(Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_PRESSURE_PLATE = registerBlock("glowshroom_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomWoodPressurePlateBlock(8));
    GLOWSHROOM_SLAB = registerBlock("glowshroom_slab", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomSlabBlock(Block.Properties.of(Material.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_STAIRS = registerBlock("glowshroom_stairs", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStairsBlock(() -> GLOWSHROOM_PLANKS.defaultBlockState(), Block.Properties.copy(GLOWSHROOM_PLANKS)));
    GLOWSHROOM_TRAPDOOR = registerBlock("glowshroom_trapdoor", ItemGroup.TAB_REDSTONE, new MushroomTrapdoorBlock(Block.Properties.of(Material.WOOD).strength(3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_VERTICAL_PLANKS = registerCompatBlock("glowshroom_vertical_planks", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalPlanksModLoaded(), new VerticalPlanksBlock(Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_VERTICAL_SLAB = registerCompatBlock("glowshroom_vertical_slab", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalSlabsModLoaded(), new VerticalSlabBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD).lightLevel((state) -> 8)));
    GLOWSHROOM_CAP_BUTTON = registerBlock("glowshroom_cap_button", ItemGroup.TAB_REDSTONE, new MushroomCapButtonBlock(8));
    GLOWSHROOM_CAP_CARPET = registerBlock("glowshroom_cap_carpet", ItemGroup.TAB_DECORATIONS, new MushroomCarpetBlock(DyeColor.BLUE, Block.Properties.of(Material.CLOTH_DECORATION, MaterialColor.COLOR_BLUE).strength(0.1F).sound(SoundType.WOOL).lightLevel((state) -> 8)));
    GLOWSHROOM_CAP_PRESSURE_PLATE = registerBlock("glowshroom_cap_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomCapPressurePlateBlock(8));
    POISONOUS_MUSHROOM = registerBlock("poisonous_mushroom", ItemGroup.TAB_DECORATIONS, new PoisonousMushroomBlock(Block.Properties.of(Material.PLANT).noCollission().randomTicks().strength(0.0F).sound(SoundType.GRASS).hasPostProcess((a, b, c) -> true)));
    POISONOUS_MUSHROOM_POTTED = registerBlock("poisonous_mushroom_potted", new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> POISONOUS_MUSHROOM, Block.Properties.of(Material.DECORATION).strength(0.0F).noOcclusion()));
    ((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(Objects.requireNonNull(POISONOUS_MUSHROOM.getRegistryName()), () -> POISONOUS_MUSHROOM_POTTED);
    POISONOUS_MUSHROOM_CAP = registerBlock("poisonous_mushroom_cap", ItemGroup.TAB_DECORATIONS, new PoisonousMushroomCap(MushroomType.POISONOUS_MUSHROOM, Block.Properties.of(Material.WOOD, MaterialColor.COLOR_PURPLE).strength(0.2F).sound(SoundType.WOOL)));
    POISONOUS_MUSHROOM_STEM = registerBlock("poisonous_mushroom_stem", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStemBlock(MushroomWoodType.POISONOUS_MUSHROOM, Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_STEM_STRIPPED = registerBlock("poisonous_mushroom_stem_stripped", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStemBlock(MushroomWoodType.POISONOUS_MUSHROOM, Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    BLOCK_STRIPPING_MAP.put(POISONOUS_MUSHROOM_STEM, POISONOUS_MUSHROOM_STEM_STRIPPED);
    POISONOUS_MUSHROOM_BOOKSHELF = registerCompatBlock("poisonous_mushroom_bookshelf", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVariantBookshelvesModLoaded(), new BookshelfBlock(Block.Properties.copy(Blocks.BOOKSHELF)));
    POISONOUS_MUSHROOM_BUTTON = registerBlock("poisonous_mushroom_button", ItemGroup.TAB_REDSTONE, new MushroomWoodButtonBlock());
    POISONOUS_MUSHROOM_CHEST = registerCompatBlock("poisonous_mushroom_chest", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantChestsModLoaded(), new VariantChestBlock(MushroomWoodType.POISONOUS_MUSHROOM, Block.Properties.copy(Blocks.CHEST)));
    POISONOUS_MUSHROOM_CHEST_TRAPPED = registerCompatBlock("poisonous_mushroom_chest_trapped", ItemGroup.TAB_REDSTONE, ModCompat.isVariantTrappedChestsModLoaded(), new VariantTrappedChestBlock(MushroomWoodType.POISONOUS_MUSHROOM, Block.Properties.copy(Blocks.TRAPPED_CHEST)));
    POISONOUS_MUSHROOM_DOOR = registerBlock("poisonous_mushroom_door", ItemGroup.TAB_REDSTONE, new DoorBlock(Block.Properties.of(Material.WOOD).strength(3.0F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_FENCE = registerBlock("poisonous_mushroom_fence", ItemGroup.TAB_DECORATIONS, new MushroomFenceBlock(Block.Properties.of(Material.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_FENCE_GATE = registerBlock("poisonous_mushroom_fence_gate", ItemGroup.TAB_REDSTONE, new MushroomFenceGateBlock(Block.Properties.of(Material.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_LADDER = registerCompatBlock("poisonous_mushroom_ladder", ItemGroup.TAB_DECORATIONS, ModCompat.isVariantLaddersModLoaded(), new LadderBlock(Block.Properties.copy(Blocks.LADDER)));
    POISONOUS_MUSHROOM_PLANKS = registerBlock("poisonous_mushroom_planks", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomPlanksBlock(Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_PRESSURE_PLATE = registerBlock("poisonous_mushroom_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomWoodPressurePlateBlock());
    POISONOUS_MUSHROOM_SLAB = registerBlock("poisonous_mushroom_slab", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomSlabBlock(Block.Properties.copy(POISONOUS_MUSHROOM_PLANKS)));
    POISONOUS_MUSHROOM_STAIRS = registerBlock("poisonous_mushroom_stairs", ItemGroup.TAB_BUILDING_BLOCKS, new MushroomStairsBlock(() -> POISONOUS_MUSHROOM_PLANKS.defaultBlockState(), Block.Properties.copy(POISONOUS_MUSHROOM_PLANKS)));
    POISONOUS_MUSHROOM_TRAPDOOR = registerBlock("poisonous_mushroom_trapdoor", ItemGroup.TAB_REDSTONE, new MushroomTrapdoorBlock(Block.Properties.of(Material.WOOD).strength(3.0F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_VERTICAL_PLANKS = registerCompatBlock("poisonous_mushroom_vertical_planks", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalPlanksModLoaded(), new VerticalPlanksBlock(Block.Properties.of(Material.WOOD).strength(0.2F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_VERTICAL_SLAB = registerCompatBlock("poisonous_mushroom_vertical_slab", ItemGroup.TAB_BUILDING_BLOCKS, ModCompat.isVerticalSlabsModLoaded(), new VerticalSlabBlock(Block.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD)));
    POISONOUS_MUSHROOM_CAP_BUTTON = registerBlock("poisonous_mushroom_cap_button", ItemGroup.TAB_REDSTONE, new MushroomCapButtonBlock());
    POISONOUS_MUSHROOM_CAP_CARPET = registerBlock("poisonous_mushroom_cap_carpet", ItemGroup.TAB_DECORATIONS, new MushroomCarpetBlock(DyeColor.PURPLE, Block.Properties.of(Material.CLOTH_DECORATION, MaterialColor.COLOR_PURPLE).strength(0.1F).sound(SoundType.WOOL)));
    POISONOUS_MUSHROOM_CAP_PRESSURE_PLATE = registerBlock("poisonous_mushroom_cap_pressure_plate", ItemGroup.TAB_REDSTONE, new MushroomCapPressurePlateBlock());
}
Also used : PoisonousMushroomCap(cech12.extendedmushrooms.block.mushroomblocks.PoisonousMushroomCap) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) RegistryObject(net.minecraftforge.fml.RegistryObject) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) Item(net.minecraft.item.Item) MaterialColor(net.minecraft.block.material.MaterialColor) HashMap(java.util.HashMap) IEventBus(net.minecraftforge.eventbus.api.IEventBus) Dist(net.minecraftforge.api.distmarker.Dist) MushroomType(cech12.extendedmushrooms.item.MushroomType) DyeColor(net.minecraft.item.DyeColor) cech12.extendedmushrooms.block(cech12.extendedmushrooms.block) MushroomStemBlock(cech12.extendedmushrooms.block.mushroomblocks.MushroomStemBlock) Glowshroom(cech12.extendedmushrooms.block.mushrooms.Glowshroom) RenderTypeLookup(net.minecraft.client.renderer.RenderTypeLookup) Block(net.minecraft.block.Block) Map(java.util.Map) RegistryEvent(net.minecraftforge.event.RegistryEvent) Mod(net.minecraftforge.fml.common.Mod) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) ModCompat(cech12.extendedmushrooms.compat.ModCompat) SoundType(net.minecraft.block.SoundType) DoorBlock(net.minecraft.block.DoorBlock) Effects(net.minecraft.potion.Effects) GlowshroomCap(cech12.extendedmushrooms.block.mushroomblocks.GlowshroomCap) MushroomWoodType(cech12.extendedmushrooms.item.MushroomWoodType) RenderType(net.minecraft.client.renderer.RenderType) DeferredRegister(net.minecraftforge.registries.DeferredRegister) ExtendedMushroomsBlocks(cech12.extendedmushrooms.api.block.ExtendedMushroomsBlocks) Blocks(net.minecraft.block.Blocks) ExtendedMushrooms(cech12.extendedmushrooms.ExtendedMushrooms) PoisonousMushroomBlock(cech12.extendedmushrooms.block.mushroomblocks.PoisonousMushroomBlock) Objects(java.util.Objects) LadderBlock(net.minecraft.block.LadderBlock) Material(net.minecraft.block.material.Material) BlockItem(net.minecraft.item.BlockItem) ItemGroup(net.minecraft.item.ItemGroup) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) Glowshroom(cech12.extendedmushrooms.block.mushrooms.Glowshroom) DoorBlock(net.minecraft.block.DoorBlock) PoisonousMushroomBlock(cech12.extendedmushrooms.block.mushroomblocks.PoisonousMushroomBlock) MushroomStemBlock(cech12.extendedmushrooms.block.mushroomblocks.MushroomStemBlock) LadderBlock(net.minecraft.block.LadderBlock) GlowshroomCap(cech12.extendedmushrooms.block.mushroomblocks.GlowshroomCap) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) PoisonousMushroomCap(cech12.extendedmushrooms.block.mushroomblocks.PoisonousMushroomCap) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 4 with FlowerPotBlock

use of net.minecraft.block.FlowerPotBlock in project ExtendedMushrooms by cech12.

the class BlockLootProvider method run.

@Override
public void run(@Nonnull final DirectoryCache cache) throws IOException {
    Map<ResourceLocation, LootTable.Builder> tables = new HashMap<>();
    for (Block block : ForgeRegistries.BLOCKS) {
        if (!ExtendedMushrooms.MOD_ID.equals(block.getRegistryName().getNamespace())) {
            continue;
        }
        if (block instanceof FlowerPotBlock) {
            // ignore potted flowers
            continue;
        }
        Function<Block, LootTable.Builder> func = functionTable.getOrDefault(block, BlockLootProvider::dropItself);
        tables.put(block.getRegistryName(), func.apply(block));
    }
    for (Map.Entry<ResourceLocation, LootTable.Builder> e : tables.entrySet()) {
        Path path = getPath(generator.getOutputFolder(), e.getKey());
        IDataProvider.save(GSON, cache, LootTableManager.serialize(e.getValue().setParamSet(LootParameterSets.BLOCK).build()), path);
    }
}
Also used : Path(java.nio.file.Path) HashMap(java.util.HashMap) ResourceLocation(net.minecraft.util.ResourceLocation) GsonBuilder(com.google.gson.GsonBuilder) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) BookshelfBlock(cech12.extendedmushrooms.block.BookshelfBlock) FairyRingBlock(cech12.extendedmushrooms.block.FairyRingBlock) MushroomStemBlock(cech12.extendedmushrooms.block.mushroomblocks.MushroomStemBlock) Block(net.minecraft.block.Block) DoorBlock(net.minecraft.block.DoorBlock) SlabBlock(net.minecraft.block.SlabBlock) Map(java.util.Map) HashMap(java.util.HashMap) FlowerPotBlock(net.minecraft.block.FlowerPotBlock)

Example 5 with FlowerPotBlock

use of net.minecraft.block.FlowerPotBlock in project ExtendedMushrooms by cech12.

the class BlockModelProvider method registerModels.

@Override
protected void registerModels() {
    // parent models
    ResourceLocation verticalPlanks = getBlockResourceLocation("vertical_planks");
    getBuilder(verticalPlanks.getPath()).parent(getExistingFile(new ResourceLocation("block/block"))).texture("particle", "#all").element().from(0, 0, 0).to(16, 16, 16).allFaces((direction, faceBuilder) -> faceBuilder.uvs(0, 0, 16, 16).texture("#all").cullface(direction).rotation(ModelBuilder.FaceRotation.CLOCKWISE_90));
    ResourceLocation verticalSlab = getBlockResourceLocation("vertical_slab");
    getBuilder(verticalSlab.getPath()).parent(getExistingFile(new ResourceLocation("block/block"))).texture("particle", "#side").element().from(0, 0, 8).to(16, 16, 16).allFaces((direction, faceBuilder) -> {
        String texture = "#side";
        if (direction == Direction.DOWN) {
            texture = "#bottom";
        } else if (direction == Direction.UP) {
            texture = "#top";
        }
        int u1 = (direction == Direction.EAST || direction == Direction.WEST) ? 8 : 0;
        int v1 = (direction == Direction.DOWN || direction == Direction.UP) ? 8 : 0;
        faceBuilder.uvs(u1, v1, 16, 16).texture(texture);
    });
    // block models
    for (Block block : ForgeRegistries.BLOCKS) {
        if (!ExtendedMushrooms.MOD_ID.equals(block.getRegistryName().getNamespace())) {
            continue;
        }
        String name = block.getRegistryName().getPath();
        if (block instanceof EMMushroomBlock) {
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/cross"))).texture("cross", getBlockResourceLocation(name));
        } else if (block instanceof BookshelfBlock) {
            ResourceLocation side = getBlockResourceLocation(name);
            ResourceLocation end = getBlockResourceLocation(name, "_bookshelf", "_planks");
            cubeColumn(name, side, end);
        } else if (block instanceof MushroomWoodButtonBlock) {
            buttonBlock(name, getBlockResourceLocation(name, "_button", "_planks"));
        } else if (block instanceof MushroomCapBlock) {
            hugeMushroomBlock(name, getBlockResourceLocation(name));
            // & inside variant
            ResourceLocation texture = getBlockResourceLocation(name, "_cap", "_inside");
            getBuilder(texture.getPath()).ao(false).texture("texture", texture).texture("particle", texture).element().from(0, 0, 0).to(16, 16, 0).face(Direction.NORTH).texture("#texture").cullface(Direction.NORTH);
        } else if (block instanceof MushroomCapButtonBlock) {
            buttonBlock(name, getCapResourceLocation(name, "_button"));
        } else if (block instanceof CarpetBlock) {
            ResourceLocation texture = getCapResourceLocation(name, "_carpet");
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/carpet"))).texture("particle", texture).texture("wool", texture);
        } else if (block instanceof MushroomCapPressurePlateBlock) {
            pressurePlateBlock(name, getCapResourceLocation(name, "_pressure_plate"));
        } else if (block instanceof VariantChestBlock) {
            getBuilder(name).texture("particle", getBlockResourceLocation(name, "_chest", "_planks"));
        } else if (block instanceof DoorBlock) {
            ResourceLocation bottom = getBlockResourceLocation(name + "_bottom");
            ResourceLocation top = getBlockResourceLocation(name + "_top");
            getBuilder(name + "_bottom").parent(getExistingFile(new ResourceLocation("block/door_bottom"))).texture("bottom", bottom).texture("top", top);
            getBuilder(name + "_bottom_hinge").parent(getExistingFile(new ResourceLocation("block/door_bottom_rh"))).texture("bottom", bottom).texture("top", top);
            getBuilder(name + "_top").parent(getExistingFile(new ResourceLocation("block/door_top"))).texture("bottom", bottom).texture("top", top);
            getBuilder(name + "_top_hinge").parent(getExistingFile(new ResourceLocation("block/door_top_rh"))).texture("bottom", bottom).texture("top", top);
        } else if (block instanceof FenceGateBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_fence_gate", "_planks");
            simpleTexturedBlock(name, "template_fence_gate", texture);
            simpleTexturedBlock(name + "_open", "template_fence_gate_open", texture);
            simpleTexturedBlock(name + "_wall", "template_fence_gate_wall", texture);
            simpleTexturedBlock(name + "_wall_open", "template_fence_gate_wall_open", texture);
        } else if (block instanceof FenceBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_fence", "_planks");
            simpleTexturedBlock(name + "_inventory", "fence_inventory", texture);
            simpleTexturedBlock(name + "_post", "fence_post", texture);
            simpleTexturedBlock(name + "_side", "fence_side", texture);
        } else if (block instanceof FlowerPotBlock) {
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/flower_pot_cross"))).texture("plant", getBlockResourceLocation(name, "_potted", ""));
        } else if (block instanceof LadderBlock) {
            ResourceLocation texture = getBlockResourceLocation(name);
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/ladder"))).ao(false).texture("particle", texture).texture("texture", texture);
        } else if (block instanceof PressurePlateBlock) {
            pressurePlateBlock(name, getBlockResourceLocation(name, "_pressure_plate", "_planks"));
        } else if (block instanceof SlabBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_slab", "_planks");
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/slab"))).texture("bottom", texture).texture("top", texture).texture("side", texture);
            getBuilder(name + "_top").parent(getExistingFile(new ResourceLocation("block/slab_top"))).texture("bottom", texture).texture("top", texture).texture("side", texture);
        } else if (block instanceof StairsBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_stairs", "_planks");
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/stairs"))).texture("bottom", texture).texture("top", texture).texture("side", texture);
            getBuilder(name + "_inner").parent(getExistingFile(new ResourceLocation("block/inner_stairs"))).texture("bottom", texture).texture("top", texture).texture("side", texture);
            getBuilder(name + "_outer").parent(getExistingFile(new ResourceLocation("block/outer_stairs"))).texture("bottom", texture).texture("top", texture).texture("side", texture);
        } else if (block instanceof StandingSignBlock || block instanceof WallSignBlock) {
            // only one model for both signs
            if (block instanceof StandingSignBlock) {
                getBuilder(name).texture("particle", getBlockResourceLocation(name, "_sign", "_planks"));
            }
        } else if (block instanceof HugeMushroomBlock) {
            // Stems & Stripped Stems. MushroomCapBlock is checked before
            hugeMushroomBlock(name, getBlockResourceLocation(name));
        } else if (block instanceof TrapDoorBlock) {
            ResourceLocation texture = getBlockResourceLocation(name);
            simpleTexturedBlock(name + "_bottom", "template_orientable_trapdoor_bottom", texture);
            simpleTexturedBlock(name + "_open", "template_orientable_trapdoor_open", texture);
            simpleTexturedBlock(name + "_top", "template_orientable_trapdoor_top", texture);
        } else if (block instanceof VerticalPlanksBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_vertical_planks", "_planks");
            getBuilder(name).parent(getExistingFile(verticalPlanks)).texture("all", texture);
        } else if (block instanceof VerticalSlabBlock) {
            ResourceLocation texture = getBlockResourceLocation(name, "_vertical_slab", "_planks");
            getBuilder(name).parent(getExistingFile(verticalSlab)).texture("bottom", texture).texture("top", texture).texture("side", texture);
        } else if (block instanceof BushBlock) {
            // flower & grass
            getBuilder(name).parent(getExistingFile(new ResourceLocation("block/tinted_cross"))).texture("cross", getBlockResourceLocation(name));
        } else if (block instanceof MushroomPlanksBlock) {
            // planks
            cubeBlock(name, getBlockResourceLocation(name));
        }
    // ignored: FairyRingBlock, VariantTrappedChestBlock
    }
    // special models
    // triggered poisonous mushroom & its cap
    ResourceLocation triggeredPoisonousMushroom = getBlockResourceLocation("poisonous_mushroom_triggered");
    getBuilder(triggeredPoisonousMushroom.getPath()).parent(getExistingFile(new ResourceLocation("block/cross"))).texture("cross", triggeredPoisonousMushroom);
    ResourceLocation triggeredPoisonousMushroomCap = getBlockResourceLocation("poisonous_mushroom_cap_triggered");
    getBuilder(triggeredPoisonousMushroomCap.getPath()).texture("texture", triggeredPoisonousMushroomCap).texture("particle", triggeredPoisonousMushroomCap).element().from(0, 0, 0).to(16, 16, 0).face(Direction.NORTH).texture("#texture").cullface(Direction.NORTH);
}
Also used : WallSignBlock(net.minecraft.block.WallSignBlock) EMMushroomBlock(cech12.extendedmushrooms.block.EMMushroomBlock) PressurePlateBlock(net.minecraft.block.PressurePlateBlock) MushroomCapPressurePlateBlock(cech12.extendedmushrooms.block.MushroomCapPressurePlateBlock) BookshelfBlock(cech12.extendedmushrooms.block.BookshelfBlock) StairsBlock(net.minecraft.block.StairsBlock) MushroomCapButtonBlock(cech12.extendedmushrooms.block.MushroomCapButtonBlock) MushroomCapBlock(cech12.extendedmushrooms.block.mushroomblocks.MushroomCapBlock) TrapDoorBlock(net.minecraft.block.TrapDoorBlock) FenceGateBlock(net.minecraft.block.FenceGateBlock) VerticalPlanksBlock(cech12.extendedmushrooms.block.VerticalPlanksBlock) ResourceLocation(net.minecraft.util.ResourceLocation) MushroomPlanksBlock(cech12.extendedmushrooms.block.MushroomPlanksBlock) VerticalSlabBlock(cech12.extendedmushrooms.block.VerticalSlabBlock) TrapDoorBlock(net.minecraft.block.TrapDoorBlock) DoorBlock(net.minecraft.block.DoorBlock) BushBlock(net.minecraft.block.BushBlock) HugeMushroomBlock(net.minecraft.block.HugeMushroomBlock) VerticalSlabBlock(cech12.extendedmushrooms.block.VerticalSlabBlock) SlabBlock(net.minecraft.block.SlabBlock) CarpetBlock(net.minecraft.block.CarpetBlock) StandingSignBlock(net.minecraft.block.StandingSignBlock) FenceBlock(net.minecraft.block.FenceBlock) MushroomCapPressurePlateBlock(cech12.extendedmushrooms.block.MushroomCapPressurePlateBlock) MushroomWoodButtonBlock(cech12.extendedmushrooms.block.MushroomWoodButtonBlock) LadderBlock(net.minecraft.block.LadderBlock) WallSignBlock(net.minecraft.block.WallSignBlock) VerticalSlabBlock(cech12.extendedmushrooms.block.VerticalSlabBlock) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) VariantChestBlock(cech12.extendedmushrooms.block.VariantChestBlock) HugeMushroomBlock(net.minecraft.block.HugeMushroomBlock) PressurePlateBlock(net.minecraft.block.PressurePlateBlock) BookshelfBlock(cech12.extendedmushrooms.block.BookshelfBlock) TrapDoorBlock(net.minecraft.block.TrapDoorBlock) FenceGateBlock(net.minecraft.block.FenceGateBlock) Block(net.minecraft.block.Block) CarpetBlock(net.minecraft.block.CarpetBlock) MushroomCapPressurePlateBlock(cech12.extendedmushrooms.block.MushroomCapPressurePlateBlock) MushroomCapButtonBlock(cech12.extendedmushrooms.block.MushroomCapButtonBlock) DoorBlock(net.minecraft.block.DoorBlock) MushroomPlanksBlock(cech12.extendedmushrooms.block.MushroomPlanksBlock) BushBlock(net.minecraft.block.BushBlock) SlabBlock(net.minecraft.block.SlabBlock) StairsBlock(net.minecraft.block.StairsBlock) FenceBlock(net.minecraft.block.FenceBlock) LadderBlock(net.minecraft.block.LadderBlock) StandingSignBlock(net.minecraft.block.StandingSignBlock) VerticalPlanksBlock(cech12.extendedmushrooms.block.VerticalPlanksBlock) EMMushroomBlock(cech12.extendedmushrooms.block.EMMushroomBlock) MushroomCapBlock(cech12.extendedmushrooms.block.mushroomblocks.MushroomCapBlock) MushroomWoodButtonBlock(cech12.extendedmushrooms.block.MushroomWoodButtonBlock) FlowerPotBlock(net.minecraft.block.FlowerPotBlock) VariantChestBlock(cech12.extendedmushrooms.block.VariantChestBlock)

Aggregations

FlowerPotBlock (net.minecraft.block.FlowerPotBlock)5 Block (net.minecraft.block.Block)4 Map (java.util.Map)3 DoorBlock (net.minecraft.block.DoorBlock)3 Item (net.minecraft.item.Item)3 BookshelfBlock (cech12.extendedmushrooms.block.BookshelfBlock)2 MushroomStemBlock (cech12.extendedmushrooms.block.mushroomblocks.MushroomStemBlock)2 HashMap (java.util.HashMap)2 Blocks (net.minecraft.block.Blocks)2 LadderBlock (net.minecraft.block.LadderBlock)2 SlabBlock (net.minecraft.block.SlabBlock)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 CarpetExtraSettings (carpetextra.CarpetExtraSettings)1 BlazePowderDispenserBehavior (carpetextra.dispenser.behaviors.BlazePowderDispenserBehavior)1 CarvePumpkinDispenserBehavior (carpetextra.dispenser.behaviors.CarvePumpkinDispenserBehavior)1 CauldronEmptyingDispenserBehavior (carpetextra.dispenser.behaviors.CauldronEmptyingDispenserBehavior)1 CauldronFillingDispenserBehavior (carpetextra.dispenser.behaviors.CauldronFillingDispenserBehavior)1 CauldronWaterDispenserBehavior (carpetextra.dispenser.behaviors.CauldronWaterDispenserBehavior)1 DragonBreathDispenserBehavior (carpetextra.dispenser.behaviors.DragonBreathDispenserBehavior)1 FeedAnimalDispenserBehavior (carpetextra.dispenser.behaviors.FeedAnimalDispenserBehavior)1