mapping updates
This commit is contained in:
1 parent
cdb79f9768
commit
b16991d84b
8 files changed
+64
-59
No files matched your search
@@ -42,14 +42,11 @@ import java.util.Map;
|
||||
@Mixin(SpawnHelper.class)
|
||||
public class SpawnHelperMixin
|
||||
{
|
||||
|
||||
// in World: private static Map<EntityType, Entity> precookedMobs= new HashMap<>();
|
||||
@Shadow @Final private static int CHUNK_AREA;
|
||||
|
||||
@Shadow @Final private static int field_24392;
|
||||
@Shadow @Final private static EntityCategory[] SPAWNABLE_CATEGORIES;
|
||||
|
||||
@Shadow @Final private static EntityCategory[] field_24393;
|
||||
|
||||
@Redirect(method = "method_24934", at = @At(
|
||||
@Redirect(method = "canSpawn(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/world/biome/Biome$SpawnEntry;Lnet/minecraft/util/math/BlockPos$Mutable;D)Z", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/world/ServerWorld;doesNotCollide(Lnet/minecraft/util/math/Box;)Z"
|
||||
))
|
||||
@@ -133,7 +130,7 @@ public class SpawnHelperMixin
|
||||
return true;
|
||||
}
|
||||
|
||||
@Redirect(method = "method_24931", at = @At(
|
||||
@Redirect(method = "createMob", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/EntityType;create(Lnet/minecraft/world/World;)Lnet/minecraft/entity/Entity;"
|
||||
))
|
||||
@@ -152,7 +149,7 @@ public class SpawnHelperMixin
|
||||
return entityType.create(world_1);
|
||||
}
|
||||
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$class_5261;Lnet/minecraft/world/SpawnHelper$class_5259;)V", at = @At(
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
|
||||
))
|
||||
@@ -175,7 +172,7 @@ public class SpawnHelperMixin
|
||||
return false;
|
||||
}
|
||||
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$class_5261;Lnet/minecraft/world/SpawnHelper$class_5259;)V", at = @At(
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnType;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
|
||||
))
|
||||
@@ -186,7 +183,7 @@ public class SpawnHelperMixin
|
||||
return null;
|
||||
}
|
||||
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$class_5261;Lnet/minecraft/world/SpawnHelper$class_5259;)V", at = @At(
|
||||
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/player/PlayerEntity;squaredDistanceTo(DDD)D"
|
||||
))
|
||||
@@ -203,37 +200,38 @@ public class SpawnHelperMixin
|
||||
|
||||
////
|
||||
|
||||
@Redirect(method = "method_27821", at = @At(
|
||||
@Redirect(method = "spawn", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/world/SpawnHelper$class_5261;Lnet/minecraft/world/SpawnHelper$class_5259;)V"
|
||||
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V"
|
||||
))
|
||||
// inject our repeat of spawns if more spawn ticks per tick are chosen.
|
||||
private static void spawnMultipleTimes(EntityCategory category, ServerWorld world, WorldChunk chunk, SpawnHelper.class_5261 arg, SpawnHelper.class_5259 arg2)
|
||||
private static void spawnMultipleTimes(EntityCategory category, ServerWorld world, WorldChunk chunk, SpawnHelper.Checker checker, SpawnHelper.Runner runner)
|
||||
{
|
||||
for (int i = 0; i < SpawnReporter.spawn_tries.get(category); i++)
|
||||
{
|
||||
SpawnHelper.spawnEntitiesInChunk(category, world, chunk, arg, arg2);
|
||||
SpawnHelper.spawnEntitiesInChunk(category, world, chunk, checker, runner);
|
||||
}
|
||||
}
|
||||
|
||||
/* shrug - why no inject, no idea. need to inject twice more. Will check with the names next week
|
||||
|
||||
@Redirect(method = "method_27821", at = @At(
|
||||
// shrug - why no inject, no idea. need to inject twice more. Will check with the names next week
|
||||
/*
|
||||
@Redirect(method = "spawn", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/SpawnHelper$class_5262;method_27826(Lnet/minecraft/entity/EntityCategory;)Z"
|
||||
target = "Lnet/minecraft/world/SpawnHelper$Info;isBelowCap(Lnet/minecraft/entity/EntityCategory;)Z"
|
||||
))
|
||||
// allows to change mobcaps and captures each category try per dimension before it fails due to full mobcaps.
|
||||
private static boolean changeMobcaps(
|
||||
SpawnHelper.class_5262 class_526, EntityCategory entityCategory,
|
||||
ServerWorld serverWorld, WorldChunk worldChunk, SpawnHelper.class_5262 arg, boolean bl, boolean bl2, boolean bl3)
|
||||
SpawnHelper.Info info, EntityCategory entityCategory,
|
||||
ServerWorld serverWorld, WorldChunk chunk, SpawnHelper.Info info_outer, boolean spawnAnimals, boolean spawnMonsters, boolean shouldSpawnAnimals
|
||||
)
|
||||
{
|
||||
DimensionType dim = serverWorld.dimension.getType();
|
||||
int newCap = (int) ((double)entityCategory.getSpawnCap()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
|
||||
if (SpawnReporter.track_spawns > 0L)
|
||||
{
|
||||
int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning
|
||||
int int_3 = newCap * int_2 / field_24392; //current spawning limits
|
||||
int mobCount = class_526.method_27830().getInt(entityCategory);
|
||||
int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits
|
||||
int mobCount = info.getCategoryToCount().getInt(entityCategory);
|
||||
|
||||
if (SpawnReporter.track_spawns > 0L && !SpawnReporter.first_chunk_marker.contains(entityCategory))
|
||||
{
|
||||
@@ -262,30 +260,31 @@ public class SpawnHelperMixin
|
||||
//full mobcaps - and key in local_spawns will be missing
|
||||
}
|
||||
}
|
||||
return SpawnReporter.mock_spawns || class_526.method_27830().getInt(entityCategory) < newCap;
|
||||
return SpawnReporter.mock_spawns || info.getCategoryToCount().getInt(entityCategory) < newCap;
|
||||
}
|
||||
*/
|
||||
|
||||
*/
|
||||
//temporary mixin until naming gets fixed
|
||||
|
||||
@Inject(method = "method_27821", at = @At("HEAD"))
|
||||
@Inject(method = "spawn", at = @At("HEAD"))
|
||||
// allows to change mobcaps and captures each category try per dimension before it fails due to full mobcaps.
|
||||
private static void checkSpawns(ServerWorld serverWorld, WorldChunk worldChunk, SpawnHelper.class_5262 arg, boolean bl, boolean bl2, boolean bl3, CallbackInfo ci)
|
||||
private static void checkSpawns(ServerWorld world, WorldChunk chunk, SpawnHelper.Info info,
|
||||
boolean spawnAnimals, boolean spawnMonsters, boolean shouldSpawnAnimals, CallbackInfo ci)
|
||||
{
|
||||
if (SpawnReporter.track_spawns > 0L)
|
||||
{
|
||||
EntityCategory[] var6 = field_24393;
|
||||
EntityCategory[] var6 = SPAWNABLE_CATEGORIES;
|
||||
int var7 = var6.length;
|
||||
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
EntityCategory entityCategory = var6[var8];
|
||||
if ((bl || !entityCategory.isPeaceful()) && (bl2 || entityCategory.isPeaceful()) && (bl3 || !entityCategory.isAnimal()) )
|
||||
if ((spawnAnimals || !entityCategory.isPeaceful()) && (spawnMonsters || entityCategory.isPeaceful()) && (shouldSpawnAnimals || !entityCategory.isAnimal()) )
|
||||
{
|
||||
DimensionType dim = serverWorld.dimension.getType();
|
||||
DimensionType dim = world.dimension.getType();
|
||||
int newCap = (int) ((double)entityCategory.getSpawnCap()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
|
||||
int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning
|
||||
int int_3 = newCap * int_2 / field_24392; //current spawning limits
|
||||
int mobCount = arg.method_27830().getInt(entityCategory);
|
||||
int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits
|
||||
int mobCount = info.getCategoryToCount().getInt(entityCategory);
|
||||
|
||||
if (SpawnReporter.track_spawns > 0L && !SpawnReporter.first_chunk_marker.contains(entityCategory))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user