Merge pull request #36 from DeadlyMC/husk
Completed huskSpawningInTemples port
This commit is contained in:
4 files changed
+87
-1
No files matched your search
@@ -0,0 +1,42 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.settings.CarpetSettings;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.mojang.datafixers.Dynamic;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.gen.feature.AbstractTempleFeature;
|
||||||
|
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||||
|
import net.minecraft.world.gen.feature.DesertPyramidFeature;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Mixin(DesertPyramidFeature.class)
|
||||||
|
public abstract class DesertPyramidFeatureMixin extends AbstractTempleFeature<DefaultFeatureConfig>
|
||||||
|
{
|
||||||
|
private static final List<Biome.SpawnEntry> MONSTER_SPAWNS;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
MONSTER_SPAWNS = Lists.newArrayList(new Biome.SpawnEntry[]{new Biome.SpawnEntry(EntityType.HUSK, 1, 1, 1)});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesertPyramidFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1)
|
||||||
|
{
|
||||||
|
super(function_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Biome.SpawnEntry> getMonsterSpawns()
|
||||||
|
{
|
||||||
|
if (CarpetSettings.huskSpawningInTemples)
|
||||||
|
{
|
||||||
|
return MONSTER_SPAWNS;
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.settings.CarpetSettings;
|
||||||
|
import net.minecraft.entity.EntityCategory;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.source.BiomeSource;
|
||||||
|
import net.minecraft.world.gen.chunk.OverworldChunkGenerator;
|
||||||
|
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
|
||||||
|
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
|
||||||
|
import net.minecraft.world.gen.feature.Feature;
|
||||||
|
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.List;
|
||||||
|
|
||||||
|
@Mixin(OverworldChunkGenerator.class)
|
||||||
|
public abstract class OverworldChunkGeneratorMixin extends SurfaceChunkGenerator<OverworldChunkGeneratorConfig>
|
||||||
|
{
|
||||||
|
public OverworldChunkGeneratorMixin(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, OverworldChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1)
|
||||||
|
{
|
||||||
|
super(iWorld_1, biomeSource_1, int_1, int_2, int_3, chunkGeneratorConfig_1, boolean_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
|
||||||
|
target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;)Z"),
|
||||||
|
cancellable = true)
|
||||||
|
private void onGetEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1,
|
||||||
|
CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.huskSpawningInTemples)
|
||||||
|
{
|
||||||
|
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, blockPos_1))
|
||||||
|
{
|
||||||
|
cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -103,7 +103,7 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static boolean fastRedstoneDust = false;
|
public static boolean fastRedstoneDust = false;
|
||||||
|
|
||||||
@Rule(desc = "Only husks spawn in desert temples", category = FEATURE, validate = Validator.WIP.class)
|
@Rule(desc = "Only husks spawn in desert temples", category = FEATURE)
|
||||||
public static boolean huskSpawningInTemples = false;
|
public static boolean huskSpawningInTemples = false;
|
||||||
|
|
||||||
@Rule( desc = "Shulkers will respawn in end cities", category = FEATURE )
|
@Rule( desc = "Shulkers will respawn in end cities", category = FEATURE )
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
"SaplingBlockMixin",
|
"SaplingBlockMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"GuardianEntityMixin",
|
"GuardianEntityMixin",
|
||||||
|
"DesertPyramidFeatureMixin",
|
||||||
|
"OverworldChunkGeneratorMixin",
|
||||||
|
|
||||||
"ServerChunkManagerMixin",
|
"ServerChunkManagerMixin",
|
||||||
"SpawnHelperMixin",
|
"SpawnHelperMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user