net.minecraft.world.level.LevelProperties Java Examples

The following examples show how to use net.minecraft.world.level.LevelProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerWorld_tickMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Redirect(method = "tick", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
))
private LevelGeneratorType tickPendingBlocks(LevelProperties levelProperties)
{
    if (TickSpeed.process_entities) return levelProperties.getGeneratorType();
    return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES;
}
 
Example #2
Source File: ServerChunkManager_tickMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Redirect(method = "tickChunks", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
))
private LevelGeneratorType skipChunkTicking(LevelProperties levelProperties)
{
    if (!TickSpeed.process_entities) return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES;
    return levelProperties.getGeneratorType();
}
 
Example #3
Source File: ServerWorldMixin.java    From the-hallow with MIT License 4 votes vote down vote up
@Redirect(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/LevelProperties;getClearWeatherTime()I", ordinal = 0))
private int ofcWeAllLoveThunderstorms(LevelProperties levelProperties) {
	return HallowedConfig.HallowedWeather.lessClearSkies ? levelProperties.getClearWeatherTime() > 1 ? levelProperties.getClearWeatherTime() - 50 : 0 : levelProperties.getClearWeatherTime();
}
 
Example #4
Source File: MixinServerWorld.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected MixinServerWorld(LevelProperties levelProperties, DimensionType dimensionType, BiFunction<World, Dimension, ChunkManager> chunkManagerProvider, Profiler profiler, boolean isClient) {
	super(levelProperties, dimensionType, chunkManagerProvider, profiler, isClient);
}
 
Example #5
Source File: MixinClientWorld.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected MixinClientWorld(LevelProperties levelProperties, DimensionType dimensionType, BiFunction<World, Dimension, ChunkManager> chunkManagerProvider, Profiler profiler, boolean isClient) {
	super(levelProperties, dimensionType, chunkManagerProvider, profiler, isClient);
}
 
Example #6
Source File: MixinMinecraftServer.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;scanPacks()V", shift = At.Shift.BEFORE))
public void loadDatapacks(File file_1, LevelProperties levelProperties_1, CallbackInfo info) {
    this.dataPackManager.registerProvider(new AddonResourceCreator());
}
 
Example #7
Source File: ServerChunkManagerMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(
        method = "tickChunks",
        locals = LocalCapture.CAPTURE_FAILHARD,
        at = @At(
                value = "INVOKE",
                target = "Lnet/minecraft/server/world/ThreadedAnvilChunkStorage;entryIterator()Ljava/lang/Iterable;",
                shift = At.Shift.AFTER,
                ordinal = 0

))
//this runs once per world spawning cycle. Allows to grab mob counts and count spawn ticks
private void grabMobcaps(CallbackInfo ci,
                         long long_1,
                         long long_2,
                         LevelProperties levelProperties_1,
                         boolean boolean_1,
                         boolean boolean_2,
                         int int_1,
                         BlockPos blockPos_1,
                         boolean boolean_3,
                         int int_2,
                         EntityCategory[] entityCategorys_1,
                         Object2IntMap object2IntMap_1)
{
    DimensionType dim = this.world.dimension.getType();
    //((WorldInterface)world).getPrecookedMobs().clear(); not needed because mobs are compared with predefined BBs
    SpawnReporter.mobCounts.put(dim, (Object2IntMap<EntityCategory>)object2IntMap_1);
    SpawnReporter.chunkCounts.put(dim, int_2);

    if (SpawnReporter.track_spawns > 0L)
    {
        //local spawns now need to be tracked globally cause each calll is just for chunk
        SpawnReporter.local_spawns = new HashMap<>();
        SpawnReporter.first_chunk_marker = new HashSet<>();
        for (EntityCategory cat : EntityCategory.values())
        {
            Pair key = Pair.of(dim, cat);
            SpawnReporter.overall_spawn_ticks.put(key,
                    SpawnReporter.overall_spawn_ticks.get(key)+
                    SpawnReporter.spawn_tries.get(cat));
        }
    }
}
 
Example #8
Source File: ServerChunkManagerMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@Inject(method = "tickChunks", at = @At("RETURN"))
private void onFinishSpawnWorldCycle(CallbackInfo ci)
{
    LevelProperties levelProperties_1 = this.world.getLevelProperties();
    boolean boolean_3 = levelProperties_1.getTime() % 400L == 0L;
    if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null)
    {
        for (EntityCategory cat: EntityCategory.values())
        {
            DimensionType dim = world.dimension.getType();
            Pair key = Pair.of(world.dimension.getType(), cat);
            int spawnTries = SpawnReporter.spawn_tries.get(cat);
            if (!SpawnReporter.local_spawns.containsKey(cat))
            {
                if (!cat.isAnimal() || boolean_3)
                {
                    // fill mobcaps for that category so spawn got cancelled
                    SpawnReporter.spawn_ticks_full.put(key,
                            SpawnReporter.spawn_ticks_full.get(key)+ spawnTries);
                }

            }
            else if (SpawnReporter.local_spawns.get(cat) > 0)
            {
                // tick spawned mobs for that type
                SpawnReporter.spawn_ticks_succ.put(key,
                    SpawnReporter.spawn_ticks_succ.get(key)+spawnTries);
                SpawnReporter.spawn_ticks_spawns.put(key,
                    SpawnReporter.spawn_ticks_spawns.get(key)+
                    SpawnReporter.local_spawns.get(cat));
                    // this will be off comparing to 1.13 as that would succeed if
                    // ANY tries in that round were successful.
                    // there will be much more difficult to mix in
                    // considering spawn tries to remove, as with warp
                    // there is little need for them anyways.
            }
            else // spawn no mobs despite trying
            {
                //tick didn's spawn mobs of that type
                SpawnReporter.spawn_ticks_fail.put(key,
                    SpawnReporter.spawn_ticks_fail.get(key)+spawnTries);
            }
        }
    }
    SpawnReporter.local_spawns = null;
}
 
Example #9
Source File: ServerWorld_tickMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
protected ServerWorld_tickMixin(LevelProperties levelProperties_1, DimensionType dimensionType_1, BiFunction<World, Dimension, ChunkManager> biFunction_1, Profiler profiler_1, boolean boolean_1)
{
    super(levelProperties_1, dimensionType_1, biFunction_1, profiler_1, boolean_1);
}