net.minecraft.profiler.Profiler Java Examples

The following examples show how to use net.minecraft.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: WorldEventHandler.java    From TickDynamic with MIT License 5 votes vote down vote up
@SubscribeEvent
  public void worldTickEvent(WorldTickEvent event) {
Profiler profiler = event.world.theProfiler;
if(!(profiler instanceof CustomProfiler))
	return;
CustomProfiler customProfiler = (CustomProfiler)profiler;
  	
  	if(event.phase == Phase.START) {
  		customProfiler.setStage(CustomProfiler.Stage.BeforeLoop);
  	}
  	else {
  		customProfiler.setStage(CustomProfiler.Stage.None);
  	}
  }
 
Example #2
Source File: DummyWorld.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DummyWorld() {
    super(new DummySaveHandler(), new WorldInfo(DEFAULT_SETTINGS, "DummyServer"), new WorldProviderSurface(), new Profiler(), false);
    // Guarantee the dimension ID was not reset by the provider
    this.provider.setDimension(Integer.MAX_VALUE);
    int providerDim = this.provider.getDimension();
    this.provider.setWorld(this);
    this.provider.setDimension(providerDim);
    this.chunkProvider = this.createChunkProvider();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(30000000);
}
 
Example #3
Source File: MixinMinecraft.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @reason Profiler isn't safe to use async, so get the results from server's last tick if server
 * profilder is being displayed.
 * <p>
 * Note: profilerName is always "root" client-side
 */
@SuppressWarnings("InvalidMemberReference") // https://github.com/minecraft-dev/MinecraftDev/issues/387
@Redirect(method = {"displayDebugInfo", "updateDebugProfilerName"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;getProfilingData(Ljava/lang/String;)Ljava/util/List;"))
private List<Profiler.Result> getProfilerData(Profiler profiler, String profilerName) {
    if (useIntegratedServerProfiler && integratedServer != null) {
        return new ArrayList<>(((IPatchedMinecraftServer) integratedServer).getLastProfilerData());
    } else {
        return profiler.getProfilingData(profilerName);
    }
}
 
Example #4
Source File: MixinMinecraft.java    From VanillaFix with MIT License 4 votes vote down vote up
/** @reason Use the integrated server profiler rather than client profiler after F3 + S was pressed. */
@SuppressWarnings("InvalidMemberReference") // https://github.com/minecraft-dev/MinecraftDev/issues/387
@Redirect(method = {"displayDebugInfo", "updateDebugProfilerName"}, at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;profiler:Lnet/minecraft/profiler/Profiler;"))
private Profiler getCurrentProfiler(Minecraft minecraft) {
    return useIntegratedServerProfiler && integratedServer != null ? integratedServer.profiler : profiler;
}
 
Example #5
Source File: CommonProxy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public Profiler getProfiler() {
	return FMLCommonHandler.instance().getMinecraftServerInstance().profiler;
}
 
Example #6
Source File: ClientProxy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public Profiler getProfiler() {
	return Minecraft.getMinecraft().mcProfiler;
}
 
Example #7
Source File: WorldDummy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public WorldDummy(Profiler p_i45368_5_, StorageChunk storage) {
	super(new DummySaveHandler(), new WorldInfo(new NBTTagCompound()), dummyProvider, p_i45368_5_, false);
	this.storage = storage;
	this.chunkProvider = new ChunkProviderDummy(this);
}
 
Example #8
Source File: WorldEventHandler.java    From TickDynamic with MIT License 4 votes vote down vote up
private void setCustomProfiler(World world, Profiler profiler) throws Exception {
	ReflectionHelper.setPrivateValue(World.class, world, profiler, "theProfiler", "field_72984_F");
}
 
Example #9
Source File: CustomProfiler.java    From TickDynamic with MIT License 4 votes vote down vote up
public CustomProfiler(Profiler originalProfiler) {
	this.original = originalProfiler;
	this.stage = Stage.None;
	this.reachedTile = false;
}
 
Example #10
Source File: FakeWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FakeWorld(WorldProvider provider) {
    super(FakeSaveHandler.instance, "", null, provider, new Profiler());
    theProfiler.profilingEnabled = false;
    difficultySetting = EnumDifficulty.NORMAL;
}
 
Example #11
Source File: MixinMinecraftServer.java    From VanillaFix with MIT License 4 votes vote down vote up
@Override
public List<Profiler.Result> getLastProfilerData() {
    return lastProfilerData;
}
 
Example #12
Source File: MixinMinecraft.java    From VanillaFix with MIT License 4 votes vote down vote up
/** @reason Fix GUI logic being included as part of "root.tick.textures" (https://bugs.mojang.com/browse/MC-129556) */
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", ordinal = 0))
private void endStartGUISection(Profiler profiler, String name) {
    profiler.endStartSection("gui");
}
 
Example #13
Source File: WorldSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public WorldSchematic(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension,
        EnumDifficulty difficulty, Profiler profilerIn)
{
    super(netHandler, settings, dimension, difficulty, profilerIn);
}
 
Example #14
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void runTick(Profiler mcProfiler) {
    mcProfiler.startSection("hyperium_tick");
    EventBus.INSTANCE.post(new TickEvent());
    mcProfiler.endSection();
}
 
Example #15
Source File: WrapperProfiler.java    From ClientBase with MIT License 4 votes vote down vote up
public Profiler unwrap() {
    return this.real;
}
 
Example #16
Source File: WrapperProfiler.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperProfiler(Profiler var1) {
    this.real = var1;
}
 
Example #17
Source File: IPatchedMinecraftServer.java    From VanillaFix with MIT License votes vote down vote up
List<Profiler.Result> getLastProfilerData();