mirror of
https://github.com/TeamMidnightDust/Decorative.git
synced 2025-12-15 12:35:10 +01:00
Backport 3.0.0 to MC 1.16.1
This commit is contained in:
@@ -27,7 +27,7 @@ dependencies {
|
|||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
modCompile("vazkii.patchouli:Patchouli:${project.patchouli_version}")
|
modCompile("vazkii.patchouli:Patchouli_1.16-fabric:${project.patchouli_version}")
|
||||||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
||||||
// You may need to force-disable transitiveness on them.
|
// You may need to force-disable transitiveness on them.
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.16.2
|
minecraft_version=1.16.1
|
||||||
yarn_mappings=1.16.2+build.6
|
yarn_mappings=1.16.1+build.7
|
||||||
loader_version=0.9.1+build.205
|
loader_version=0.8.8+build.202
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 3.0.0
|
mod_version = 3.0.0
|
||||||
@@ -14,6 +14,6 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.17.2+build.396-1.16
|
fabric_version=0.14.0+build.371-1.16
|
||||||
patchouli_version=1.16-40-FABRIC
|
patchouli_version=1.16-37.21-FABRIC
|
||||||
midnighthats_version=1.0.2
|
midnighthats_version=1.0.2
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import eu.midnightdust.motschen.decorative.blockstates.Part;
|
|||||||
import eu.midnightdust.motschen.decorative.blockstates.PoolShape;
|
import eu.midnightdust.motschen.decorative.blockstates.PoolShape;
|
||||||
import eu.midnightdust.motschen.decorative.blockstates.Program;
|
import eu.midnightdust.motschen.decorative.blockstates.Program;
|
||||||
import eu.midnightdust.motschen.decorative.init.*;
|
import eu.midnightdust.motschen.decorative.init.*;
|
||||||
import eu.midnightdust.motschen.decorative.world.OreFeatureInjector;
|
|
||||||
import eu.midnightdust.motschen.decorative.world.OreFeatures;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
@@ -18,6 +16,8 @@ import net.minecraft.state.property.EnumProperty;
|
|||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class DecorativeMain implements ModInitializer {
|
public class DecorativeMain implements ModInitializer {
|
||||||
public static final String MOD_ID = "decorative";
|
public static final String MOD_ID = "decorative";
|
||||||
|
|
||||||
@@ -98,7 +98,28 @@ public class DecorativeMain implements ModInitializer {
|
|||||||
|
|
||||||
Lamps.init();
|
Lamps.init();
|
||||||
DoubleLamps.init();
|
DoubleLamps.init();
|
||||||
OreFeatures.init();
|
eu.midnightdust.motschen.decorative.world.RockyAsphalt.initBiomeFeatures();
|
||||||
OreFeatureInjector.init();
|
}
|
||||||
|
public enum Ores implements ItemConvertible {
|
||||||
|
RockyAsphalt(7, 20, 14, 200);
|
||||||
|
|
||||||
|
public final String name;
|
||||||
|
public final int veinSize;
|
||||||
|
public final int veinsPerChunk;
|
||||||
|
public final int minY;
|
||||||
|
public final int maxY;
|
||||||
|
|
||||||
|
Ores(int veinSize, int veinsPerChunk, int minY, int maxY) {
|
||||||
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
this.veinSize = veinSize;
|
||||||
|
this.veinsPerChunk = veinsPerChunk;
|
||||||
|
this.minY = minY;
|
||||||
|
this.maxY = maxY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item asItem() {
|
||||||
|
return RockyAsphalt.asItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package eu.midnightdust.motschen.decorative.mixin;
|
|
||||||
|
|
||||||
import net.minecraft.world.biome.GenerationSettings;
|
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
@Mixin(GenerationSettings.class)
|
|
||||||
public interface GenerationSettingsAccessorMixin {
|
|
||||||
|
|
||||||
@Accessor
|
|
||||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
|
|
||||||
|
|
||||||
@Accessor
|
|
||||||
void setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package eu.midnightdust.motschen.decorative.world;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import eu.midnightdust.motschen.decorative.mixin.GenerationSettingsAccessorMixin;
|
|
||||||
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
|
||||||
import net.minecraft.util.registry.BuiltinRegistries;
|
|
||||||
import net.minecraft.world.biome.Biome;
|
|
||||||
import net.minecraft.world.gen.GenerationStep;
|
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class OreFeatureInjector {
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
BuiltinRegistries.BIOME.forEach(OreFeatureInjector::addToBiome);
|
|
||||||
RegistryEntryAddedCallback.event(BuiltinRegistries.BIOME).register((i, identifier, biome) -> addToBiome(biome));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addToBiome(Biome biome) {
|
|
||||||
addSaltOre(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addSaltOre(Biome biome) {
|
|
||||||
if (biome.getCategory() != Biome.Category.NETHER && biome.getCategory() != Biome.Category.THEEND) {
|
|
||||||
addFeature(biome, GenerationStep.Feature.UNDERGROUND_DECORATION, OreFeatures.ROCKY_ASPHALT_FEATURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addFeature(Biome biome, GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) {
|
|
||||||
GenerationSettingsAccessorMixin generationSettingsAccessor = (GenerationSettingsAccessorMixin) biome.getGenerationSettings();
|
|
||||||
int stepIndex = step.ordinal();
|
|
||||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures());
|
|
||||||
while (featuresByStep.size() <= stepIndex) {
|
|
||||||
featuresByStep.add(Lists.newArrayList());
|
|
||||||
}
|
|
||||||
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(featuresByStep.get(stepIndex));
|
|
||||||
features.add(() -> feature);
|
|
||||||
featuresByStep.set(stepIndex, features);
|
|
||||||
generationSettingsAccessor.setFeatures(featuresByStep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package eu.midnightdust.motschen.decorative.world;
|
|
||||||
|
|
||||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.registry.BuiltinRegistries;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
|
||||||
import net.minecraft.world.gen.feature.Feature;
|
|
||||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
|
||||||
|
|
||||||
public class OreFeatures {
|
|
||||||
public static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = Feature.ORE.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, DecorativeMain.RockyAsphalt.getDefaultState(), 7)).method_30377(200).spreadHorizontally().repeat(20);
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "rocky_asphalt"), ROCKY_ASPHALT_FEATURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package eu.midnightdust.motschen.decorative.world;
|
||||||
|
|
||||||
|
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||||
|
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
|
import net.minecraft.world.gen.decorator.Decorator;
|
||||||
|
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||||
|
import net.minecraft.world.gen.feature.Feature;
|
||||||
|
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RockyAsphalt {
|
||||||
|
private static List<Biome> checkedBiomes = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void initBiomeFeatures() {
|
||||||
|
for (Biome biome : Registry.BIOME) {
|
||||||
|
addToBiome(biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Handles modded biomes
|
||||||
|
RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> addToBiome(biome));
|
||||||
|
}
|
||||||
|
private static void addToBiome(Biome biome){
|
||||||
|
if(checkedBiomes.contains(biome)){
|
||||||
|
//Just to be sure we dont add the stuff twice to the same biome
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkedBiomes.add(biome);
|
||||||
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, DecorativeMain.Ores.RockyAsphalt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addOre(Biome biome, OreFeatureConfig.Target canReplaceIn, DecorativeMain.Ores ore) {
|
||||||
|
biome.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, Feature.ORE.configure(
|
||||||
|
new OreFeatureConfig(canReplaceIn, DecorativeMain.RockyAsphalt.getDefaultState(), ore.veinSize)).createDecoratedFeature(Decorator.COUNT_RANGE.configure(
|
||||||
|
new RangeDecoratorConfig(ore.veinsPerChunk, ore.minY, ore.minY, ore.maxY))));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"package": "eu.midnightdust.motschen.decorative.mixin",
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixins": [
|
|
||||||
"GenerationSettingsAccessorMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,10 +27,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"mixins": [
|
|
||||||
"decorative.mixins.json"
|
|
||||||
],
|
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.2",
|
"fabricloader": ">=0.7.2",
|
||||||
"fabric": "*"
|
"fabric": "*"
|
||||||
|
|||||||
Reference in New Issue
Block a user