mirror of
https://github.com/TeamMidnightDust/Decorative.git
synced 2025-12-15 12:35:10 +01:00
Update to 1.16.2
Refactor ore generation for 1.16.2
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_1.16-fabric:${project.patchouli_version}")
|
modCompile("vazkii.patchouli:Patchouli:${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,16 +3,16 @@ 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.1
|
minecraft_version=1.16.2
|
||||||
yarn_mappings=1.16.1+build.7
|
yarn_mappings=1.16.2+build.6
|
||||||
loader_version=0.8.8+build.202
|
loader_version=0.9.1+build.205
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.0
|
mod_version = 2.0.1
|
||||||
maven_group = eu.midnightdust.motschen
|
maven_group = eu.midnightdust.motschen
|
||||||
archives_base_name = decorative
|
archives_base_name = decorative
|
||||||
|
|
||||||
# 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.14.0+build.371-1.16
|
fabric_version=0.17.2+build.396-1.16
|
||||||
patchouli_version=1.16-37.21-FABRIC
|
patchouli_version=1.16-40-FABRIC
|
||||||
|
|||||||
@@ -90,30 +90,9 @@ public class DecorativeMain implements ModInitializer {
|
|||||||
Registry.register(Registry.ITEM, new Identifier("decorative","christmas_tree"), new BlockItem(ChristmasTree, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
Registry.register(Registry.ITEM, new Identifier("decorative","christmas_tree"), new BlockItem(ChristmasTree, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||||
Registry.register(Registry.BLOCK, new Identifier("decorative","christmas_lights"), ChristmasLights);
|
Registry.register(Registry.BLOCK, new Identifier("decorative","christmas_lights"), ChristmasLights);
|
||||||
Registry.register(Registry.ITEM, new Identifier("decorative","christmas_lights"), new BlockItem(ChristmasLights, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
Registry.register(Registry.ITEM, new Identifier("decorative","christmas_lights"), new BlockItem(ChristmasLights, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||||
|
|
||||||
Lamps.init();
|
Lamps.init();
|
||||||
DoubleLamps.init();
|
DoubleLamps.init();
|
||||||
eu.midnightdust.motschen.decorative.world.RockyAsphalt.initBiomeFeatures();
|
OreFeatures.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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package eu.midnightdust.motschen.decorative;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.stat.Stats;
|
import net.minecraft.stat.Stats;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
@@ -42,7 +43,7 @@ public class BathTireItem extends Item {
|
|||||||
return TypedActionResult.pass(itemStack);
|
return TypedActionResult.pass(itemStack);
|
||||||
} else if (world.canPlayerModifyAt(user, blockPos) && user.canPlaceOn(blockPos, blockHitResult.getSide(), itemStack)) {
|
} else if (world.canPlayerModifyAt(user, blockPos) && user.canPlaceOn(blockPos, blockHitResult.getSide(), itemStack)) {
|
||||||
EntityType<?> entityType = this.getEntityType(itemStack.getTag());
|
EntityType<?> entityType = this.getEntityType(itemStack.getTag());
|
||||||
if (entityType.spawnFromItemStack(world, itemStack, user, blockPos.up(1), SpawnReason.SPAWN_EGG, false, false) == null) {
|
if (entityType.spawnFromItemStack((ServerWorld) world, itemStack, user, blockPos.up(1), SpawnReason.SPAWN_EGG, false, false) == null) {
|
||||||
return TypedActionResult.pass(itemStack);
|
return TypedActionResult.pass(itemStack);
|
||||||
} else {
|
} else {
|
||||||
if (!user.abilities.creativeMode) {
|
if (!user.abilities.creativeMode) {
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package eu.midnightdust.motschen.decorative.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.motschen.decorative.OreFeatures;
|
||||||
|
import net.minecraft.world.biome.GenerationSettings.Builder;
|
||||||
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
|
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Mixin(DefaultBiomeFeatures.class)
|
||||||
|
public class DefaultBiomeFeaturesMixin {
|
||||||
|
@Inject(at = @At("RETURN"), method = "addDefaultOres")
|
||||||
|
private static void addDefaultOres(Builder builder, CallbackInfo info) {
|
||||||
|
builder.feature(GenerationStep.Feature.UNDERGROUND_ORES, OreFeatures.ROCKY_ASPHALT_FEATURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
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))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
src/main/resources/decorative.mixins.json
Normal file
11
src/main/resources/decorative.mixins.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "eu.midnightdust.motschen.decorative.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [
|
||||||
|
"DefaultBiomeFeaturesMixin"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "decorative",
|
"id": "decorative",
|
||||||
"version": "2.0.0 - Summer 2020 Update",
|
"version": "${version}",
|
||||||
|
|
||||||
"name": "Decorative",
|
"name": "Decorative",
|
||||||
"description": "Adds many cool new decorative items with 3d models!",
|
"description": "Adds many cool new decorative items with 3d models!",
|
||||||
@@ -27,6 +27,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"mixins": [
|
||||||
|
"decorative.mixins.json"
|
||||||
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.2",
|
"fabricloader": ">=0.7.2",
|
||||||
"fabric": "*"
|
"fabric": "*"
|
||||||
|
|||||||
Reference in New Issue
Block a user