Rule source prototype

This commit is contained in:
paulevsGitch 2021-12-03 15:39:08 +03:00
parent 04a4f77e87
commit 8e3147f176
2 changed files with 94 additions and 3 deletions

View file

@ -0,0 +1,27 @@
package ru.bclib.mixin.common;
import net.minecraft.data.worldgen.SurfaceRuleData;
import net.minecraft.world.level.levelgen.SurfaceRules;
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
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.CallbackInfoReturnable;
import ru.bclib.api.biomes.BiomeAPI;
@Mixin(SurfaceRuleData.class)
public class SurfaceRuleDataMixin {
@Inject(method = "nether", at = @At("RETURN"), cancellable = true)
private static void bclib_addNetherRuleSource(CallbackInfoReturnable<SurfaceRules.RuleSource> info) {
RuleSource source = info.getReturnValue();
source = SurfaceRules.sequence(source, BiomeAPI.getNetherRuleSource());
info.setReturnValue(source);
}
@Inject(method = "end", at = @At("RETURN"), cancellable = true)
private static void bclib_addEndRuleSource(CallbackInfoReturnable<SurfaceRules.RuleSource> info) {
RuleSource source = info.getReturnValue();
source = SurfaceRules.sequence(source, BiomeAPI.getEndRuleSource());
info.setReturnValue(source);
}
}