Fix crash in 1.14.

This commit is contained in:
IzzelAliz 2020-07-20 14:35:38 +08:00
parent e2784ffb0f
commit df1cd0bd88
6 changed files with 48 additions and 2 deletions

View File

@ -1,5 +1,9 @@
package io.izzel.arclight.common.bridge.world.server; package io.izzel.arclight.common.bridge.world.server;
import net.minecraft.entity.EntityClassification;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerWorldLightManager; import net.minecraft.world.server.ServerWorldLightManager;
import java.io.IOException; import java.io.IOException;
@ -15,4 +19,6 @@ public interface ServerChunkProviderBridge {
boolean bridge$isChunkLoaded(int x, int z); boolean bridge$isChunkLoaded(int x, int z);
ServerWorldLightManager bridge$getLightManager(); ServerWorldLightManager bridge$getLightManager();
void bridge$worldNaturalSpawn(EntityClassification classification, World worldIn, Chunk chunk, BlockPos pos);
} }

View File

@ -24,7 +24,6 @@ import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.server.ServerWorldLightManager; import net.minecraft.world.server.ServerWorldLightManager;
import net.minecraft.world.server.TicketManager; import net.minecraft.world.server.TicketManager;
import net.minecraft.world.server.TicketType; import net.minecraft.world.server.TicketType;
import net.minecraft.world.spawner.WorldEntitySpawner;
import net.minecraft.world.storage.WorldInfo; import net.minecraft.world.storage.WorldInfo;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -175,7 +174,7 @@ public abstract class ServerChunkProviderMixin implements ServerChunkProviderBri
if (entityclassification != EntityClassification.MISC && (!entityclassification.getPeacefulCreature() || this.spawnPassives) && (entityclassification.getPeacefulCreature() || this.spawnHostiles) && (!entityclassification.getAnimal() || flag2)) { if (entityclassification != EntityClassification.MISC && (!entityclassification.getPeacefulCreature() || this.spawnPassives) && (entityclassification.getPeacefulCreature() || this.spawnHostiles) && (!entityclassification.getAnimal() || flag2)) {
int i1 = limit * l / field_217238_b; int i1 = limit * l / field_217238_b;
if (object2intmap.getInt(entityclassification) <= i1) { if (object2intmap.getInt(entityclassification) <= i1) {
WorldEntitySpawner.spawnEntitiesInChunk(entityclassification, this.world, chunk, blockpos); this.bridge$worldNaturalSpawn(entityclassification, this.world, chunk, blockpos);
} }
} }
} }

View File

@ -0,0 +1,20 @@
package io.izzel.arclight.common.mixin.v1_15.world.server;
import io.izzel.arclight.common.bridge.world.server.ServerChunkProviderBridge;
import net.minecraft.entity.EntityClassification;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerChunkProvider;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.spawner.WorldEntitySpawner;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(ServerChunkProvider.class)
public abstract class ServerChunkProviderMixin_1_15 implements ServerChunkProviderBridge {
@Override
public void bridge$worldNaturalSpawn(EntityClassification classification, World worldIn, Chunk chunk, BlockPos pos) {
WorldEntitySpawner.spawnEntitiesInChunk(classification, (ServerWorld) worldIn, chunk, pos);
}
}

View File

@ -82,6 +82,7 @@
"world.chunk.ChunkMixin_1_15", "world.chunk.ChunkMixin_1_15",
"world.dimension.DimensionTypeMixin_1_15", "world.dimension.DimensionTypeMixin_1_15",
"world.gen.feature.structure.SwampHutPieceMixin_1_15", "world.gen.feature.structure.SwampHutPieceMixin_1_15",
"world.server.ServerChunkProviderMixin_1_15",
"world.server.ServerMultiWorldMixin_1_15", "world.server.ServerMultiWorldMixin_1_15",
"world.server.ServerWorldMixin_1_15", "world.server.ServerWorldMixin_1_15",
"world.server.TicketManagerMixin_1_15", "world.server.TicketManagerMixin_1_15",

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.impl.mixin.v1_14.core.world.server;
import io.izzel.arclight.common.bridge.world.server.ServerChunkProviderBridge;
import net.minecraft.entity.EntityClassification;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerChunkProvider;
import net.minecraft.world.spawner.WorldEntitySpawner;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(ServerChunkProvider.class)
public abstract class ServerChunkProviderMixin_1_14 implements ServerChunkProviderBridge {
@Override
public void bridge$worldNaturalSpawn(EntityClassification classification, World worldIn, Chunk chunk, BlockPos pos) {
WorldEntitySpawner.performNaturalSpawning(classification, worldIn, chunk, pos);
}
}

View File

@ -80,6 +80,7 @@
"world.chunk.ChunkMixin_1_14", "world.chunk.ChunkMixin_1_14",
"world.dimension.DimensionTypeMixin_1_14", "world.dimension.DimensionTypeMixin_1_14",
"world.gen.feature.structure.SwampHutPieceMixin_1_14", "world.gen.feature.structure.SwampHutPieceMixin_1_14",
"world.server.ServerChunkProviderMixin_1_14",
"world.server.TicketManagerMixin_1_14", "world.server.TicketManagerMixin_1_14",
"world.spawner.WorldEntitySpawnerMixin_1_14", "world.spawner.WorldEntitySpawnerMixin_1_14",
"world.storage.MapDataMixin_1_14" "world.storage.MapDataMixin_1_14"