Merge pull request #1 from HoosierTransfer/no-profiler

thingy
This commit is contained in:
HoosierTransfer 2024-04-27 17:48:38 -04:00 committed by GitHub
commit 074bd57995
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 45098 additions and 23658 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

File diff suppressed because one or more lines are too long

View File

@ -32,4 +32,9 @@ public class Config {
public static boolean animateTick() { public static boolean animateTick() {
return false; return false;
} }
public static boolean renderParticles() {
return false;
}
} }

View File

@ -5,6 +5,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.hoosiertransfer.Config;
/** /**
* Copyright (c) 2022 lax1dude. All Rights Reserved. * Copyright (c) 2022 lax1dude. All Rights Reserved.
@ -47,12 +48,14 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override @Override
public void draw(float texCoordWidth, float texCoordHeight) { public void draw(float texCoordWidth, float texCoordHeight) {
if (!Config.renderParticles()) return;
InstancedParticleRenderer.render(texCoordWidth, texCoordHeight, 0.0625f, f1, f5, f2, f3, f4); InstancedParticleRenderer.render(texCoordWidth, texCoordHeight, 0.0625f, f1, f5, f2, f3, f4);
} }
@Override @Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData, public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, float r, float g, float b, float a) { int texSize, float particleSize, float r, float g, float b, float a) {
if (!Config.renderParticles()) return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX); float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX);
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY); float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY);
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ); float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ);
@ -62,6 +65,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override @Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData, public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, int rgba) { int texSize, float particleSize, int rgba) {
if (!Config.renderParticles()) return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX); float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX);
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY); float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY);
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ); float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ);
@ -71,6 +75,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override @Override
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY, public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
int lightMapData, int texSize, float particleSize, float r, float g, float b, float a) { int lightMapData, int texSize, float particleSize, float r, float g, float b, float a) {
if (!Config.renderParticles()) return;
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF, InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, r, g, b, a); (lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, r, g, b, a);
} }
@ -78,6 +83,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override @Override
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY, public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
int lightMapData, int texSize, float particleSize, int rgba) { int lightMapData, int texSize, float particleSize, int rgba) {
if (!Config.renderParticles()) return;
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF, InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, rgba); (lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, rgba);
} }

View File

@ -46,6 +46,7 @@ public class ChunkUpdateManager {
} }
private void runGenerator(ChunkCompileTaskGenerator generator, Entity entity) { private void runGenerator(ChunkCompileTaskGenerator generator, Entity entity) {
Minecraft.getMinecraft().mcProfiler.startSection("chunkCompile");
generator.setRegionRenderCacheBuilder(renderCache); generator.setRegionRenderCacheBuilder(renderCache);
float f = (float) entity.posX; float f = (float) entity.posX;
float f1 = (float) entity.posY + entity.getEyeHeight(); float f1 = (float) entity.posY + entity.getEyeHeight();
@ -101,6 +102,7 @@ public class ChunkUpdateManager {
} }
public boolean updateChunks(long timeout) { public boolean updateChunks(long timeout) {
Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
if (entity == null) { if (entity == null) {
queue.clear(); queue.clear();

View File

@ -1,6 +1,8 @@
package net.minecraft.block; package net.minecraft.block;
import java.util.List; import java.util.List;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;

View File

@ -5,6 +5,8 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.minecraft.AcceleratedEffectRenderer; import net.lax1dude.eaglercraft.v1_8.minecraft.AcceleratedEffectRenderer;
import net.lax1dude.eaglercraft.v1_8.minecraft.IAcceleratedParticleEngine; import net.lax1dude.eaglercraft.v1_8.minecraft.IAcceleratedParticleEngine;
@ -36,6 +38,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.hoosiertransfer.Config;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -151,6 +154,7 @@ public class EffectRenderer {
*/ */
public EntityFX spawnEffectParticle(int particleId, double parDouble1, double parDouble2, double parDouble3, public EntityFX spawnEffectParticle(int particleId, double parDouble1, double parDouble2, double parDouble3,
double parDouble4, double parDouble5, double parDouble6, int... parArrayOfInt) { double parDouble4, double parDouble5, double parDouble6, int... parArrayOfInt) {
if (!Config.renderParticles()) return null;
IParticleFactory iparticlefactory = (IParticleFactory) this.particleTypes.get(Integer.valueOf(particleId)); IParticleFactory iparticlefactory = (IParticleFactory) this.particleTypes.get(Integer.valueOf(particleId));
if (iparticlefactory != null) { if (iparticlefactory != null) {
EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, parDouble1, parDouble2, EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, parDouble1, parDouble2,
@ -214,6 +218,7 @@ public class EffectRenderer {
} }
private void tickParticle(final EntityFX parEntityFX) { private void tickParticle(final EntityFX parEntityFX) {
if (!Config.renderParticles()) return;
try { try {
parEntityFX.onUpdate(); parEntityFX.onUpdate();
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -248,6 +253,7 @@ public class EffectRenderer {
* Renders all current particles. Args player, partialTickTime * Renders all current particles. Args player, partialTickTime
*/ */
public void renderParticles(Entity entityIn, float partialTicks, int pass) { public void renderParticles(Entity entityIn, float partialTicks, int pass) {
if (!Config.renderParticles()) return;
float f = ActiveRenderInfo.getRotationX(); float f = ActiveRenderInfo.getRotationX();
float f1 = ActiveRenderInfo.getRotationZ(); float f1 = ActiveRenderInfo.getRotationZ();
float f2 = ActiveRenderInfo.getRotationYZ(); float f2 = ActiveRenderInfo.getRotationYZ();
@ -354,6 +360,7 @@ public class EffectRenderer {
} }
public void renderLitParticles(Entity entityIn, float parFloat1) { public void renderLitParticles(Entity entityIn, float parFloat1) {
if (!Config.renderParticles()) return;
float f = 0.017453292F; float f = 0.017453292F;
float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F); float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F); float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
@ -389,6 +396,7 @@ public class EffectRenderer {
} }
public void addBlockDestroyEffects(BlockPos pos, IBlockState state) { public void addBlockDestroyEffects(BlockPos pos, IBlockState state) {
if (!Config.renderParticles()) return;
if (state.getBlock().getMaterial() != Material.air) { if (state.getBlock().getMaterial() != Material.air) {
state = state.getBlock().getActualState(state, this.worldObj, pos); state = state.getBlock().getActualState(state, this.worldObj, pos);
byte b0 = 4; byte b0 = 4;
@ -413,6 +421,7 @@ public class EffectRenderer {
* Adds block hit particles for the specified block * Adds block hit particles for the specified block
*/ */
public void addBlockHitEffects(BlockPos pos, EnumFacing side) { public void addBlockHitEffects(BlockPos pos, EnumFacing side) {
if (!Config.renderParticles()) return;
IBlockState iblockstate = this.worldObj.getBlockState(pos); IBlockState iblockstate = this.worldObj.getBlockState(pos);
Block block = iblockstate.getBlock(); Block block = iblockstate.getBlock();
if (block.getRenderType() != -1) { if (block.getRenderType() != -1) {

View File

@ -10,6 +10,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import net.hoosiertransfer.Config;
import net.hoosiertransfer.Alfheim.ILightInfoProvider; import net.hoosiertransfer.Alfheim.ILightInfoProvider;
import net.hoosiertransfer.Alfheim.ILightLevelProvider; import net.hoosiertransfer.Alfheim.ILightLevelProvider;
import net.hoosiertransfer.Alfheim.ILightingEngineProvider; import net.hoosiertransfer.Alfheim.ILightingEngineProvider;
@ -857,18 +858,21 @@ public abstract class World implements IBlockAccess, ILightingEngineProvider, IL
public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord,
double xOffset, double yOffset, double zOffset, int... parArrayOfInt) { double xOffset, double yOffset, double zOffset, int... parArrayOfInt) {
if (!Config.renderParticles()) return;
this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange(), xCoord, yCoord, zCoord, this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange(), xCoord, yCoord, zCoord,
xOffset, yOffset, zOffset, parArrayOfInt); xOffset, yOffset, zOffset, parArrayOfInt);
} }
public void spawnParticle(EnumParticleTypes particleType, boolean xCoord, double yCoord, double zCoord, public void spawnParticle(EnumParticleTypes particleType, boolean xCoord, double yCoord, double zCoord,
double xOffset, double yOffset, double zOffset, double parDouble6, int... parArrayOfInt) { double xOffset, double yOffset, double zOffset, double parDouble6, int... parArrayOfInt) {
if (!Config.renderParticles()) return;
this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange() | xCoord, yCoord, zCoord, this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange() | xCoord, yCoord, zCoord,
xOffset, yOffset, zOffset, parDouble6, parArrayOfInt); xOffset, yOffset, zOffset, parDouble6, parArrayOfInt);
} }
private void spawnParticle(int particleID, boolean xCood, double yCoord, double zCoord, double xOffset, private void spawnParticle(int particleID, boolean xCood, double yCoord, double zCoord, double xOffset,
double yOffset, double zOffset, double parDouble6, int... parArrayOfInt) { double yOffset, double zOffset, double parDouble6, int... parArrayOfInt) {
if (!Config.renderParticles()) return;
for (int i = 0; i < this.worldAccesses.size(); ++i) { for (int i = 0; i < this.worldAccesses.size(); ++i) {
((IWorldAccess) this.worldAccesses.get(i)).spawnParticle(particleID, xCood, yCoord, zCoord, xOffset, ((IWorldAccess) this.worldAccesses.get(i)).spawnParticle(particleID, xCood, yCoord, zCoord, xOffset,
yOffset, zOffset, parDouble6, parArrayOfInt); yOffset, zOffset, parDouble6, parArrayOfInt);