use of org.spongepowered.common.event.tracking.phase.generation.FeaturePhaseContext in project SpongeCommon by SpongePowered.
the class EndDragonFightMixin_Tracker method tracker$switchToFeatureState.
// @formatter:on
@Redirect(method = "spawnNewGateway(Lnet/minecraft/core/BlockPos;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/ConfiguredFeature;place(Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/core/BlockPos;)Z"))
private boolean tracker$switchToFeatureState(final ConfiguredFeature configuredFeature, final WorldGenLevel worldIn, final ChunkGenerator generator, final Random rand, final BlockPos pos) {
try (final FeaturePhaseContext context = GenerationPhase.State.FEATURE_PLACEMENT.createPhaseContext(PhaseTracker.SERVER)) {
context.world((ServerLevel) worldIn).generator(generator).feature(configuredFeature.feature).origin(pos);
context.buildAndSwitch();
return configuredFeature.place(worldIn, generator, rand, pos);
}
}
Aggregations