|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package de.jottyfan.minecraft.quickiefabric.init;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
|
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
@ -21,6 +20,9 @@ import de.jottyfan.minecraft.quickiefabric.event.BreakBlockCallback;
|
|
|
|
|
import de.jottyfan.minecraft.quickiefabric.event.EventBlockBreak;
|
|
|
|
|
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
|
|
|
|
|
import de.jottyfan.minecraft.quickiefabric.tools.QuickieTools;
|
|
|
|
|
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
|
|
|
|
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
|
|
|
|
|
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
|
|
|
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
|
|
|
|
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback;
|
|
|
|
|
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
|
|
|
@ -44,7 +46,10 @@ import net.minecraft.util.Identifier;
|
|
|
|
|
import net.minecraft.util.registry.BuiltinRegistries;
|
|
|
|
|
import net.minecraft.util.registry.Registry;
|
|
|
|
|
import net.minecraft.util.registry.RegistryKey;
|
|
|
|
|
import net.minecraft.world.gen.GenerationStep;
|
|
|
|
|
import net.minecraft.world.gen.YOffset;
|
|
|
|
|
import net.minecraft.world.gen.decorator.CountPlacementModifier;
|
|
|
|
|
import net.minecraft.world.gen.decorator.HeightRangePlacementModifier;
|
|
|
|
|
import net.minecraft.world.gen.decorator.SquarePlacementModifier;
|
|
|
|
|
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
|
|
|
|
import net.minecraft.world.gen.feature.Feature;
|
|
|
|
@ -65,46 +70,32 @@ public class RegistryManager {
|
|
|
|
|
public static final ScreenHandlerType<BackpackScreenHandler> BACKPACK_SCREEN_HANDLER = ScreenHandlerRegistry
|
|
|
|
|
.registerExtended(RegistryManager.BACKPACK_IDENTIFIER, BackpackScreenHandler::new);
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_ORENETHERSULPHOR = Feature.ORE
|
|
|
|
|
.configure(new OreFeatureConfig(new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD),
|
|
|
|
|
QuickieBlocks.ORE_NETHER_SULPHOR.getDefaultState(), 24))
|
|
|
|
|
.withPlacement(new SquarePlacementModifier());
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(0)))).spreadHorizontally().repeat(10));
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_ORESALPETER = Feature.ORE
|
|
|
|
|
.configure(new OreFeatureConfig(new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD),
|
|
|
|
|
QuickieBlocks.ORE_SALPETER.getDefaultState(), 12))
|
|
|
|
|
.withPlacement(CountPlacementModifier.of(10));
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(64))))).spreadHorizontally().repeat(10);
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_ORESULPHOR = Feature.ORE.configure(new OreFeatureConfig(
|
|
|
|
|
new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD), QuickieBlocks.ORE_SULPHOR.getDefaultState(), 20));
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_ORENETHERSULPHOR = Feature.ORE.configure(new OreFeatureConfig(
|
|
|
|
|
new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD), QuickieBlocks.ORE_NETHER_SULPHOR.getDefaultState(), 24));
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_ORESALPETER = Feature.ORE.configure(new OreFeatureConfig(
|
|
|
|
|
new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD), QuickieBlocks.ORE_SALPETER.getDefaultState(), 12));
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_DIRTSALPETER = Feature.ORE.configure(
|
|
|
|
|
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.DIRT), QuickieBlocks.DIRT_SALPETER.getDefaultState(), 3));
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_SANDSALPETER = Feature.ORE.configure(
|
|
|
|
|
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SAND), QuickieBlocks.SAND_SALPETER.getDefaultState(), 3));
|
|
|
|
|
public static final ConfiguredFeature<?, ?> CF_ORESANDSALPETER = Feature.ORE.configure(new OreFeatureConfig(
|
|
|
|
|
new BlockMatchRuleTest(Blocks.SANDSTONE), QuickieBlocks.ORE_SAND_SALPETER.getDefaultState(), 3));
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_ORESULPHOR = Feature.ORE
|
|
|
|
|
.configure(new OreFeatureConfig(new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD),
|
|
|
|
|
QuickieBlocks.ORE_SULPHOR.getDefaultState(), 16))
|
|
|
|
|
.withPlacement(CountPlacementModifier.of(7));
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(64))))).spreadHorizontally().repeat(7);
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_DIRTSALPETER = Feature.ORE
|
|
|
|
|
.configure(
|
|
|
|
|
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.DIRT), QuickieBlocks.DIRT_SALPETER.getDefaultState(), 3))
|
|
|
|
|
.withPlacement(CountPlacementModifier.of(4));
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(64))))).spreadHorizontally().repeatRandomly(4);
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_SANDSALPETER = Feature.ORE
|
|
|
|
|
.configure(
|
|
|
|
|
new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SAND), QuickieBlocks.SAND_SALPETER.getDefaultState(), 3))
|
|
|
|
|
.withPlacement(CountPlacementModifier.of(4));
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(64))))).spreadHorizontally().repeatRandomly(4);
|
|
|
|
|
|
|
|
|
|
public static final PlacedFeature FEATURE_ORESANDSALPETER = Feature.ORE
|
|
|
|
|
.configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.SANDSTONE),
|
|
|
|
|
QuickieBlocks.ORE_SAND_SALPETER.getDefaultState(), 3))
|
|
|
|
|
.withPlacement(CountPlacementModifier.of(4));
|
|
|
|
|
// .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(UniformHeightProvider.create(YOffset.aboveBottom(0), YOffset.belowTop(64))))).spreadHorizontally().repeatRandomly(4);
|
|
|
|
|
|
|
|
|
|
public static final List<PlacedFeature> FEATURE_QUICKIE_ORES = Arrays.asList(FEATURE_ORESALPETER,
|
|
|
|
|
FEATURE_ORESULPHOR, FEATURE_DIRTSALPETER, FEATURE_SANDSALPETER, FEATURE_ORESANDSALPETER);
|
|
|
|
|
public static final List<PlacedFeature> FEATURE_QUICKIE_NETHERORES = Arrays
|
|
|
|
|
.asList(FEATURE_ORENETHERSULPHOR);
|
|
|
|
|
public static final PlacedFeature PF_ORESULPHOR = CF_ORESULPHOR.withPlacement(CountPlacementModifier.of(7),
|
|
|
|
|
SquarePlacementModifier.of(), HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
public static final PlacedFeature PF_ORENETHERSULPHOR = CF_ORENETHERSULPHOR.withPlacement(
|
|
|
|
|
CountPlacementModifier.of(10), SquarePlacementModifier.of(),
|
|
|
|
|
HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
public static final PlacedFeature PF_ORESALPETER = CF_ORESALPETER.withPlacement(CountPlacementModifier.of(10),
|
|
|
|
|
SquarePlacementModifier.of(), HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
public static final PlacedFeature PF_DIRTSALPETER = CF_DIRTSALPETER.withPlacement(CountPlacementModifier.of(4),
|
|
|
|
|
SquarePlacementModifier.of(), HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
public static final PlacedFeature PF_SANDSALPETER = CF_SANDSALPETER.withPlacement(CountPlacementModifier.of(4),
|
|
|
|
|
SquarePlacementModifier.of(), HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
public static final PlacedFeature PF_ORESANDSALPETER = CF_ORESANDSALPETER.withPlacement(CountPlacementModifier.of(4),
|
|
|
|
|
SquarePlacementModifier.of(), HeightRangePlacementModifier.uniform(YOffset.aboveBottom(0), YOffset.belowTop(0)));
|
|
|
|
|
|
|
|
|
|
public static final ItemGroup QUICKIEFABRIC_GROUP = FabricItemGroupBuilder
|
|
|
|
|
.create(new Identifier(QUICKIEFABRIC, "all")).icon(() -> new ItemStack(QuickieItems.SPEEDPOWDER))
|
|
|
|
@ -281,21 +272,30 @@ public class RegistryManager {
|
|
|
|
|
* @param name the name for the identifier
|
|
|
|
|
* @param feature the feature
|
|
|
|
|
*/
|
|
|
|
|
private static final void registerFeature(String name, PlacedFeature feature) {
|
|
|
|
|
RegistryKey<ConfiguredFeature<?, ?>> identifier = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY, new Identifier(QUICKIEFABRIC, name));
|
|
|
|
|
private static final void registerFeature(String name, ConfiguredFeature<?, ?> conf, PlacedFeature feature,
|
|
|
|
|
Predicate<BiomeSelectionContext> predicate) {
|
|
|
|
|
RegistryKey<ConfiguredFeature<?, ?>> identifier = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY,
|
|
|
|
|
new Identifier(QUICKIEFABRIC, name));
|
|
|
|
|
RegistryKey<PlacedFeature> identifierP = RegistryKey.of(Registry.PLACED_FEATURE_KEY,
|
|
|
|
|
new Identifier(QUICKIEFABRIC, name));
|
|
|
|
|
Registry.register(BuiltinRegistries.PLACED_FEATURE, identifier.getValue(), feature);
|
|
|
|
|
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, identifier.getValue(), conf);
|
|
|
|
|
BiomeModifications.addFeature(predicate, GenerationStep.Feature.UNDERGROUND_ORES, identifierP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* register ore generation features
|
|
|
|
|
*/
|
|
|
|
|
public static final void registerFeatures() {
|
|
|
|
|
registerFeature("feature_orenethersulphor", FEATURE_ORENETHERSULPHOR);
|
|
|
|
|
registerFeature("feature_oresalpeter", FEATURE_ORESALPETER);
|
|
|
|
|
registerFeature("feature_oresulphor", FEATURE_ORESULPHOR);
|
|
|
|
|
registerFeature("feature_dirtsalpeter", FEATURE_DIRTSALPETER);
|
|
|
|
|
registerFeature("feature_sandsalpeter", FEATURE_SANDSALPETER);
|
|
|
|
|
registerFeature("feature_oresandsalpeter", FEATURE_ORESANDSALPETER);
|
|
|
|
|
Predicate<BiomeSelectionContext> nether = BiomeSelectors.foundInTheNether();
|
|
|
|
|
Predicate<BiomeSelectionContext> overworld = BiomeSelectors.foundInOverworld();
|
|
|
|
|
|
|
|
|
|
registerFeature("feature_orenethersulphor", CF_ORENETHERSULPHOR, PF_ORENETHERSULPHOR, nether);
|
|
|
|
|
registerFeature("feature_oresalpeter", CF_ORESALPETER, PF_ORESALPETER, overworld);
|
|
|
|
|
registerFeature("feature_oresulphor", CF_ORESULPHOR, PF_ORESULPHOR, overworld);
|
|
|
|
|
registerFeature("feature_dirtsalpeter", CF_DIRTSALPETER, PF_DIRTSALPETER, overworld);
|
|
|
|
|
registerFeature("feature_sandsalpeter", CF_SANDSALPETER, PF_SANDSALPETER, overworld);
|
|
|
|
|
registerFeature("feature_oresandsalpeter", CF_ORESANDSALPETER, PF_ORESANDSALPETER, overworld);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static final void registerLootings() {
|
|
|
|
|