This commit is contained in:
parent
401970963f
commit
72c85fa67b
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**Beta 0.0.7**
|
||||||
|
* Fix Structure Generation
|
||||||
|
|
||||||
**Beta 0.0.6**
|
**Beta 0.0.6**
|
||||||
* Remove ``DamageSourceAccessor``
|
* Remove ``DamageSourceAccessor``
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.9.0+build.204
|
fabric_loader_version = 0.9.0+build.204
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.0.6
|
mod_version = 0.0.7
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
@ -19,6 +19,6 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
modmenu_version = 1.14.6+build.31
|
modmenu_version = 1.14.6+build.31
|
||||||
cloth_config_version = 4.7.0-unstable
|
cloth_config_version = 4.7.0-unstable
|
||||||
autoconfig_version = 3.2.0-unstable
|
autoconfig_version = 3.2.0-unstable
|
||||||
libstructure_version = 1.4.1
|
libstructure_version = 1.5
|
||||||
roughlyenoughitems_version = 5.2.3
|
roughlyenoughitems_version = 5.2.3
|
||||||
jetbrains_annotations_version = 19.0.0
|
jetbrains_annotations_version = 19.0.0
|
||||||
|
@ -157,7 +157,7 @@ public final class EnergonRelics implements ModInitializer {
|
|||||||
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "defensive_laser_core"), DEFENSIVE_LASER_CORE_ITEM);
|
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "defensive_laser_core"), DEFENSIVE_LASER_CORE_ITEM);
|
||||||
DEFENSIVE_LASER_BLOCK.register("defensive_laser");
|
DEFENSIVE_LASER_BLOCK.register("defensive_laser");
|
||||||
|
|
||||||
StructureGeneratorBlock.register();
|
StructureGeneratorBlock.registerBlocks();
|
||||||
|
|
||||||
BLOCK_BREAKER_BLOCK.register("block_breaker");
|
BLOCK_BREAKER_BLOCK.register("block_breaker");
|
||||||
|
|
||||||
|
@ -24,9 +24,11 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.GenerationSettings;
|
import net.minecraft.world.biome.GenerationSettings;
|
||||||
import net.minecraft.world.gen.GenerationStep;
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
import net.minecraft.world.gen.chunk.StructureConfig;
|
import net.minecraft.world.gen.chunk.StructureConfig;
|
||||||
|
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
|
||||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||||
import net.minecraft.world.gen.feature.StructureFeature;
|
import net.minecraft.world.gen.feature.StructureFeature;
|
||||||
@ -119,19 +121,23 @@ public class StructureGeneratorBlock extends SimpleBlockWithEntity {
|
|||||||
LibStructure.registerStructure(new Identifier(EnergonRelics.NAMESPACE, name), block.feature, GenerationStep.Feature.UNDERGROUND_STRUCTURES, block.structureConfig, block.feature.configure(FeatureConfig.DEFAULT));
|
LibStructure.registerStructure(new Identifier(EnergonRelics.NAMESPACE, name), block.feature, GenerationStep.Feature.UNDERGROUND_STRUCTURES, block.structureConfig, block.feature.configure(FeatureConfig.DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void registerBlocks() {
|
||||||
for (Map.Entry<String, StructureGeneratorBlock> entry : blocks.entrySet()) {
|
for (Map.Entry<String, StructureGeneratorBlock> entry : blocks.entrySet()) {
|
||||||
entry.getValue().register(entry.getKey());
|
entry.getValue().register(entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addToBiome(GenerationSettings.Builder builder) {
|
public static void addToBiome(Biome biome) {
|
||||||
|
registerStructures();
|
||||||
for (Map.Entry<String, StructureGeneratorBlock> entry : blocks.entrySet()) {
|
for (Map.Entry<String, StructureGeneratorBlock> entry : blocks.entrySet()) {
|
||||||
builder.structureFeature(entry.getValue().feature.configure(DefaultFeatureConfig.INSTANCE));
|
ConfiguredStructureFeature<?, ?> feature = entry.getValue().feature.configure(DefaultFeatureConfig.INSTANCE);
|
||||||
|
biome.getGenerationSettings().getStructureFeatures().add(() -> feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
public static void registerStructures() {
|
||||||
create("research_complex", (world, random, transformations) -> new ResearchComplexStartPart(new ResearchComplexState(world, random), transformations), new StructureConfig(32, 8, 14357618));
|
if (blocks.size() == 0) {
|
||||||
|
create("research_complex", (world, random, transformations) -> new ResearchComplexStartPart(new ResearchComplexState(world, random), transformations), new StructureConfig(32, 8, 14357618));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.GenerationSettings;
|
||||||
|
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@Mixin(GenerationSettings.class)
|
||||||
|
public interface GenerationSettingsAccessor {
|
||||||
|
@Accessor
|
||||||
|
List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureFeatures();
|
||||||
|
|
||||||
|
@Mutable
|
||||||
|
@Accessor
|
||||||
|
void setStructureFeatures(List<Supplier<ConfiguredStructureFeature<?, ?>>> structureFeatures);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
||||||
|
import net.minecraft.Bootstrap;
|
||||||
|
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(Bootstrap.class)
|
||||||
|
public class MixinBootstrap {
|
||||||
|
@Inject(at = @At("TAIL"), method = "initialize")
|
||||||
|
private static void initialize(CallbackInfo info) {
|
||||||
|
StructureGeneratorBlock.registerStructures();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.mixin;
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
|
||||||
import net.minecraft.world.biome.GenerationSettings;
|
import net.minecraft.world.biome.GenerationSettings;
|
||||||
import net.minecraft.world.gen.GenerationStep;
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
||||||
@ -16,9 +15,4 @@ public class MixinDefaultBiomeFeatures {
|
|||||||
private static void addDefaultOres(GenerationSettings.Builder builder, CallbackInfo info) {
|
private static void addDefaultOres(GenerationSettings.Builder builder, CallbackInfo info) {
|
||||||
builder.feature(GenerationStep.Feature.UNDERGROUND_ORES, EnergonRelics.VERIDIUM_ORE_FEATURE);
|
builder.feature(GenerationStep.Feature.UNDERGROUND_ORES, EnergonRelics.VERIDIUM_ORE_FEATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"), method = "addDefaultUndergroundStructures")
|
|
||||||
private static void addDefaultUndergroundStructures(GenerationSettings.Builder builder, CallbackInfo info) {
|
|
||||||
StructureGeneratorBlock.addToBiome(builder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfileRepository;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
|
import com.mojang.datafixers.DataFixer;
|
||||||
|
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
||||||
|
import net.minecraft.resource.ResourcePackManager;
|
||||||
|
import net.minecraft.resource.ServerResourceManager;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.WorldGenerationProgressListenerFactory;
|
||||||
|
import net.minecraft.util.UserCache;
|
||||||
|
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.SaveProperties;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.gen.feature.StructureFeature;
|
||||||
|
import net.minecraft.world.level.storage.LevelStorage;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@Mixin(MinecraftServer.class)
|
||||||
|
public class MixinMinecraftServer {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
protected DynamicRegistryManager.Impl registryManager;
|
||||||
|
|
||||||
|
@Inject(at = @At("TAIL"), method = "<init>")
|
||||||
|
private void init(Thread thread, DynamicRegistryManager.Impl impl, LevelStorage.Session session, SaveProperties saveProperties, ResourcePackManager resourcePackManager, Proxy proxy, DataFixer dataFixer, ServerResourceManager serverResourceManager, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo info) {
|
||||||
|
if (registryManager.getOptional(Registry.BIOME_KEY).isPresent()) {
|
||||||
|
for (Biome biome : registryManager.getOptional(Registry.BIOME_KEY).get()) {
|
||||||
|
// Make Mutable
|
||||||
|
((GenerationSettingsAccessor) biome.getGenerationSettings()).setStructureFeatures(new ArrayList<>(((GenerationSettingsAccessor) biome.getGenerationSettings()).getStructureFeatures()));
|
||||||
|
|
||||||
|
if (biome.getGenerationSettings().hasStructureFeature(StructureFeature.MINESHAFT)) {
|
||||||
|
StructureGeneratorBlock.addToBiome(biome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,12 @@
|
|||||||
],
|
],
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"BrewingRecipeRegistryAccessor",
|
"BrewingRecipeRegistryAccessor",
|
||||||
|
"GenerationSettingsAccessor",
|
||||||
|
"MixinBootstrap",
|
||||||
"MixinDefaultBiomeFeatures",
|
"MixinDefaultBiomeFeatures",
|
||||||
"MixinEntity",
|
"MixinEntity",
|
||||||
"MixinLivingEntity",
|
"MixinLivingEntity",
|
||||||
|
"MixinMinecraftServer",
|
||||||
"MixinWorld"
|
"MixinWorld"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
Reference in New Issue
Block a user