Compiles, can get ingame, uses Mixins to work around missing Fork Hooks for structures and custom dimensions.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import appeng.worldgen.meteorite.MeteoriteStructure;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import net.minecraft.world.gen.settings.DimensionStructuresSettings;
|
||||
import net.minecraft.world.gen.settings.StructureSeparationSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* This Mixin will add the structure placement configuration for the meteorite structure
|
||||
* to the static final immutable map that contains them. There is currently no
|
||||
* Forge hook for this, and registering them during the registry event is already too late.
|
||||
* <p>
|
||||
* If this is not done, Meteorites spawn every chunk, since that is the default for missing entries.
|
||||
*/
|
||||
@Mixin(DimensionStructuresSettings.class)
|
||||
public class DimensionStructuresSettingsMixin {
|
||||
|
||||
@Shadow
|
||||
@Mutable
|
||||
private static ImmutableMap<Structure<?>, StructureSeparationSettings> field_236191_b_;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("TAIL"))
|
||||
private static void addMeteoriteSpreadConfig(CallbackInfo ci) {
|
||||
field_236191_b_ = ImmutableMap.<Structure<?>, StructureSeparationSettings>builder()
|
||||
.putAll(field_236191_b_)
|
||||
.put(MeteoriteStructure.INSTANCE, new StructureSeparationSettings(32, 8, 124895654)).build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user