Unicopia/src/main/java/com/minelittlepony/unicopia/block/UBlocks.java

57 lines
2.6 KiB
Java
Raw Normal View History

2021-09-02 19:11:51 +02:00
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.Unicopia;
2021-09-02 19:11:51 +02:00
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder;
2022-09-23 23:25:00 +02:00
import net.minecraft.block.*;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.entity.EntityType;
2021-09-02 19:11:51 +02:00
import net.minecraft.sound.BlockSoundGroup;
2022-09-23 23:25:00 +02:00
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
2021-09-02 19:11:51 +02:00
import net.minecraft.util.registry.Registry;
2022-09-23 23:25:00 +02:00
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.BlockView;
import net.minecraft.world.gen.feature.ConfiguredFeature;
2021-09-02 19:11:51 +02:00
public interface UBlocks {
Block ROCKS = register("rocks", new RockCropBlock(FabricBlockSettings.of(
new FabricMaterialBuilder(MapColor.STONE_GRAY).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build()
)
2021-09-03 00:47:48 +02:00
.requiresTool()
2021-09-02 19:11:51 +02:00
.ticksRandomly()
.strength(2)
.sounds(BlockSoundGroup.STONE)));
2021-12-31 13:54:51 +01:00
Block FROSTED_OBSIDIAN = register("frosted_obsidian", new FrostedObsidianBlock(FabricBlockSettings.copy(Blocks.OBSIDIAN).ticksRandomly()));
2022-09-23 23:25:00 +02:00
Block ZAPLING = register("zapling", new SaplingBlock(new SaplingGenerator() {
@Override
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random rng, boolean flowersNearby) {
return UTreeGen.ZAP_APPLE_TREE;
}
}, FabricBlockSettings.copy(Blocks.OAK_SAPLING)));
Block ZAP_LOG = register("zap_log", new ZapAppleLogBlock(MapColor.GRAY, MapColor.DEEPSLATE_GRAY));
Block ZAP_LEAVES = register("zap_leaves", new ZapAppleLeavesBlock());
Block ZAP_BULB = register("zap_bulb", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GRAY).strength(500, 1200).sounds(BlockSoundGroup.AZALEA_LEAVES), Direction.DOWN, ZAP_LEAVES, FruitBlock.DEFAULT_SHAPE));
Block ZAP_APPLE = register("zap_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GRAY).sounds(BlockSoundGroup.AZALEA_LEAVES), Direction.DOWN, ZAP_LEAVES, FruitBlock.DEFAULT_SHAPE));
2021-09-02 19:11:51 +02:00
private static <T extends Block> T register(String name, T item) {
return Registry.register(Registry.BLOCK, Unicopia.id(name), item);
2021-09-02 19:11:51 +02:00
}
static void bootstrap() {}
2022-09-23 23:25:00 +02:00
static boolean never(BlockState state, BlockView world, BlockPos pos) {
return false;
}
static Boolean canSpawnOnLeaves(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
return type == EntityType.OCELOT || type == EntityType.PARROT;
}
2021-09-02 19:11:51 +02:00
}