Search in sources :

Example 1 with ChunkGeneratorEnd

use of net.minecraft.world.gen.ChunkGeneratorEnd in project SpongeCommon by SpongePowered.

the class MixinWorldServer method onCreateSpawnPosition.

@Inject(method = "createSpawnPosition(Lnet/minecraft/world/WorldSettings;)V", at = @At("HEAD"), cancellable = true)
private void onCreateSpawnPosition(WorldSettings settings, CallbackInfo ci) {
    GeneratorType generatorType = (GeneratorType) settings.getTerrainType();
    // Allow bonus chest generation for non-Overworld worlds
    if (!this.provider.canRespawnHere() && this.getProperties().doesGenerateBonusChest()) {
        this.createBonusChest();
    }
    if ((generatorType != null && generatorType.equals(GeneratorTypes.THE_END)) || ((((WorldServer) (Object) this)).getChunkProvider().chunkGenerator instanceof ChunkGeneratorEnd)) {
        this.worldInfo.setSpawn(new BlockPos(100, 50, 0));
        ci.cancel();
    }
}
Also used : ChunkGeneratorEnd(net.minecraft.world.gen.ChunkGeneratorEnd) BlockPos(net.minecraft.util.math.BlockPos) IMixinBlockPos(org.spongepowered.common.interfaces.util.math.IMixinBlockPos) GeneratorType(org.spongepowered.api.world.GeneratorType) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 ChunkGeneratorEnd (net.minecraft.world.gen.ChunkGeneratorEnd)1 GeneratorType (org.spongepowered.api.world.GeneratorType)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 IMixinBlockPos (org.spongepowered.common.interfaces.util.math.IMixinBlockPos)1