ore generation repaired
This commit is contained in:
parent
03dd32819b
commit
4d66c701d8
@ -9,9 +9,9 @@
|
||||
loader_version=0.12.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.18.0
|
||||
mod_version = 1.18.1
|
||||
maven_group = de.jottyfan.minecraft
|
||||
archives_base_name = quickiefabric
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.43.1+1.18
|
||||
fabric_version=0.44.0+1.18
|
||||
|
@ -0,0 +1,26 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.init;
|
||||
|
||||
import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.loot.condition.RandomChanceLootCondition;
|
||||
import net.minecraft.loot.entry.ItemEntry;
|
||||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class LootHelper {
|
||||
|
||||
/**
|
||||
* create a loot pool builder of the given object
|
||||
*
|
||||
* @return the loot pool builder
|
||||
*/
|
||||
public static final FabricLootPoolBuilder build(Integer number, Item item, float chance) {
|
||||
return FabricLootPoolBuilder.builder().rolls(ConstantLootNumberProvider.create(number))
|
||||
.withCondition(RandomChanceLootCondition.builder(chance).build())
|
||||
.withEntry(ItemEntry.builder(item).build());
|
||||
}
|
||||
}
|
@ -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 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_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 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() {
|
||||
|
@ -1,35 +0,0 @@
|
||||
package de.jottyfan.minecraft.quickiefabric.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Mixin(DefaultBiomeFeatures.class)
|
||||
public class FeatureConfigMixin {
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "addMineables(Lnet/minecraft/world/biome/GenerationSettings$Builder;)V")
|
||||
private static void addMineables(GenerationSettings.Builder builder, CallbackInfo ci) {
|
||||
for (PlacedFeature configuredFeature : RegistryManager.FEATURE_QUICKIE_ORES) {
|
||||
builder.feature(GenerationStep.Feature.UNDERGROUND_ORES, configuredFeature);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "addNetherMineables(Lnet/minecraft/world/biome/GenerationSettings$Builder;)V")
|
||||
private static void addNetherMineables(GenerationSettings.Builder builder, CallbackInfo ci) {
|
||||
for (PlacedFeature configuredFeature : RegistryManager.FEATURE_QUICKIE_NETHERORES) {
|
||||
builder.feature(GenerationStep.Feature.UNDERGROUND_ORES, configuredFeature);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
"package": "de.jottyfan.minecraft.quickiefabric.mixin",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"mixins": [
|
||||
"FeatureConfigMixin",
|
||||
"BlockBreakMixin"
|
||||
],
|
||||
"client": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user