net.minecraft.util.profiler.Profiler Java Examples

The following examples show how to use net.minecraft.util.profiler.Profiler. 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: NinePatch.java    From LibGui with MIT License 6 votes vote down vote up
@Override
protected Map<Identifier, Properties> prepare(ResourceManager manager, Profiler profiler) {
	Collection<Identifier> ids = manager.findResources("textures", s -> s.endsWith(SUFFIX));
	Map<Identifier, Properties> result = new HashMap<>();

	for (Identifier input : ids) {
		try (Resource resource = manager.getResource(input);
			 InputStream stream = resource.getInputStream()) {
			Properties props = new Properties();
			props.load(stream);
			Identifier textureId = new Identifier(input.getNamespace(), input.getPath().substring(0, input.getPath().length() - SUFFIX.length()));
			result.put(textureId, props);
		} catch (Exception e) {
			LibGuiClient.logger.error("Error while loading metadata file {}, skipping...", input, e);
		}
	}

	return result;
}
 
Example #2
Source File: NinePatch.java    From LibGui with MIT License 5 votes vote down vote up
@Override
		protected void apply(Map<Identifier, Properties> meta, ResourceManager manager, Profiler profiler) {
			properties = new HashMap<>();
			for (Map.Entry<Identifier, Properties> entry : meta.entrySet()) {
				Identifier id = entry.getKey();
				Properties props = entry.getValue();

				Mode mode = TextureProperties.DEFAULT.getMode();
//				float cornerUv = TextureProperties.DEFAULT.getCornerUv();

				if (props.containsKey("mode")) {
					String modeStr = props.getProperty("mode");
					mode = Mode.fromString(modeStr);
					if (mode == null) {
						LibGuiClient.logger.error("Invalid mode '{}' in nine-patch metadata file for texture {}", modeStr, id);
						continue;
					}
				}

//				if (props.containsKey("cornerUv")) {
//					cornerUv = Float.parseFloat(props.getProperty("cornerUv"));
//				}

				TextureProperties texProperties = new TextureProperties(mode);
				properties.put(id, texProperties);
			}
		}
 
Example #3
Source File: ServerWorld_scarpetEventMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/world/ServerWorld;addLightning(Lnet/minecraft/entity/LightningEntity;)V"
))
private void onNaturalLightinig(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci,
                                ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, boolean bl2)
{
    if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerWorld) (Object)this, blockPos, bl2?1:0);
}
 
Example #4
Source File: World_tickMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Inject(method = "tickBlockEntities", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/block/entity/BlockEntity;isRemoved()Z",
        shift = At.Shift.BEFORE,
        ordinal = 0
))
private void startTileEntitySection(CallbackInfo ci, Profiler profiler_1, Iterator i, BlockEntity blockEntity_2)
{
    entitySection = CarpetProfiler.start_entity_section((World)(Object)this, blockEntity_2, CarpetProfiler.TYPE.TILEENTITY);
}
 
Example #5
Source File: PonyManager.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public CompletableFuture<Void> reload(Synchronizer sync, ResourceManager sender,
        Profiler serverProfiler, Profiler clientProfiler,
        Executor serverExecutor, Executor clientExecutor) {

    sync.getClass();
    return sync.whenPrepared(null).thenRunAsync(() -> {
        clientProfiler.startTick();
        clientProfiler.push("Reloading all background ponies");
        poniesCache.invalidateAll();
        backgroundPonyList.reloadAll(sender);
        clientProfiler.pop();
        clientProfiler.endTick();
    }, clientExecutor);
}
 
Example #6
Source File: MixinSpriteAtlasTexture.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Inject(method = "stitch", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/SpriteAtlasTexture;loadSprites(Lnet/minecraft/resource/ResourceManager;Ljava/util/Set;)Ljava/util/Collection;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
private void onStitch(ResourceManager resourceManager, Iterable<Identifier> iterable, Profiler profiler, CallbackInfoReturnable<SpriteAtlasTexture.Data> cir, Set<Identifier> set) {
	RenderEvents.onTextureStitchPre((SpriteAtlasTexture) (Object) this, set);
}
 
Example #7
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 #8
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 #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);
}
 
Example #10
Source File: WorldMixin_RealTime.java    From Galaxy with GNU Affero General Public License v3.0 4 votes vote down vote up
protected WorldMixin_RealTime(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
    super(mutableWorldProperties, registryKey, registryKey2, dimensionType, profiler, bl, bl2, l);
}