Surface slime tag
This commit is contained in:
parent
62c55a6288
commit
0df5f73a09
|
@ -11,4 +11,5 @@ public class WBBiomeTags {
|
|||
|
||||
public static final TagKey<Biome> SPAWNS_WARM_VARIANT_FROGS = TAGS.create("spawns_warm_variant_frogs");
|
||||
public static final TagKey<Biome> SPAWNS_COLD_VARIANT_FROGS = TAGS.create("spawns_cold_variant_frogs");
|
||||
public static final TagKey<Biome> ALLOWS_SURFACE_SLIME_SPAWNS = TAGS.create("allows_surface_slime_spawns");
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.cursedcauldron.wildbackport.core.mixin.common;
|
||||
|
||||
import com.cursedcauldron.wildbackport.common.tag.WBBiomeTags;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
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 java.util.Random;
|
||||
|
||||
@Mixin(Slime.class)
|
||||
public class SlimeMixin {
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/LevelAccessor;getDifficulty()Lnet/minecraft/world/Difficulty;", shift = At.Shift.AFTER), method = "checkSlimeSpawnRules", cancellable = true)
|
||||
private static void WB$checkSlimeSpawnRules(EntityType<Slime> entityType, LevelAccessor levelAccessor, MobSpawnType mobSpawnType, BlockPos blockPos, Random randomSource, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (levelAccessor.getBiome(blockPos).is(WBBiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && blockPos.getY() > 50 && blockPos.getY() < 70 && randomSource.nextFloat() < 0.5F && randomSource.nextFloat() < levelAccessor.getMoonBrightness() && levelAccessor.getMaxLocalRawBrightness(blockPos) <= randomSource.nextInt(8)) {
|
||||
cir.setReturnValue(Mob.checkMobSpawnRules(entityType, levelAccessor, mobSpawnType, blockPos, randomSource));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"values": [
|
||||
"minecraft:swamp",
|
||||
"wildbackport:mangrove_swamp"
|
||||
]
|
||||
}
|
|
@ -41,6 +41,7 @@
|
|||
"common.PointedDripstoneBlockMixin",
|
||||
"common.SculkSensorBlockEntityMixin",
|
||||
"common.SculkSensorBlockMixin",
|
||||
"common.SlimeMixin",
|
||||
"common.VibrationListenerMixin",
|
||||
"extension.BoatTypeMixin",
|
||||
"extension.PoseMixin",
|
||||
|
|
Loading…
Reference in a new issue