Removed Profiler usage

This commit is contained in:
Ellpeck 2016-07-25 22:37:14 +02:00
parent 2a5e2787bb
commit 3f660f7c01
10 changed files with 11 additions and 28 deletions

View file

@ -114,7 +114,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityAtomicReconstructor){ if(tile instanceof TileEntityAtomicReconstructor){
ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0); ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);

View file

@ -133,7 +133,7 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityBookletStand){ if(tile instanceof TileEntityBookletStand){
EntrySet set = ((TileEntityBookletStand)tile).assignedEntry; EntrySet set = ((TileEntityBookletStand)tile).assignedEntry;

View file

@ -157,7 +157,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityCompost){ if(tile instanceof TileEntityCompost){
ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0); ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0);

View file

@ -51,7 +51,7 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(factory != null){ if(factory != null){
int state = factory.isMultiblock(); int state = factory.isMultiblock();

View file

@ -79,7 +79,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityMiner){ if(tile instanceof TileEntityMiner){
String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+"."; String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+".";

View file

@ -127,7 +127,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile != null){ if(tile != null){
if(tile instanceof IPhantomTile){ if(tile instanceof IPhantomTile){

View file

@ -74,7 +74,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile != null){ if(tile != null){
if(tile instanceof TileEntityPlayerInterface){ if(tile instanceof TileEntityPlayerInterface){

View file

@ -22,6 +22,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public interface IHudDisplay{ public interface IHudDisplay{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution); void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
} }

View file

@ -129,19 +129,14 @@ public class ClientEvents{
public void onGameOverlay(RenderGameOverlayEvent.Post event){ public void onGameOverlay(RenderGameOverlayEvent.Post event){
if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){ if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){
Minecraft minecraft = Minecraft.getMinecraft(); Minecraft minecraft = Minecraft.getMinecraft();
Profiler profiler = minecraft.mcProfiler;
EntityPlayer player = minecraft.thePlayer; EntityPlayer player = minecraft.thePlayer;
RayTraceResult posHit = minecraft.objectMouseOver; RayTraceResult posHit = minecraft.objectMouseOver;
FontRenderer font = minecraft.fontRendererObj; FontRenderer font = minecraft.fontRendererObj;
ItemStack stack = player.getHeldItemMainhand(); ItemStack stack = player.getHeldItemMainhand();
profiler.startSection(ModUtil.MOD_ID+"Hud");
if(stack != null){ if(stack != null){
if(stack.getItem() instanceof IHudDisplay){ if(stack.getItem() instanceof IHudDisplay){
profiler.startSection("ItemHudDisplay"); ((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, event.getResolution());
((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution());
profiler.endSection();
} }
} }
@ -150,16 +145,12 @@ public class ClientEvents{
TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(blockHit instanceof IHudDisplay){ if(blockHit instanceof IHudDisplay){
profiler.startSection("BlockHudDisplay"); ((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, event.getResolution());
((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution());
profiler.endSection();
} }
if(tileHit instanceof TileEntityBase){ if(tileHit instanceof TileEntityBase){
TileEntityBase base = (TileEntityBase)tileHit; TileEntityBase base = (TileEntityBase)tileHit;
if(base.isRedstoneToggle()){ if(base.isRedstoneToggle()){
profiler.startSection("RedstoneToggleHudDisplay");
String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(base.isPulseMode ? "Pulse" : "Deactivation")+TextFormatting.RESET; String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(base.isPulseMode ? "Pulse" : "Deactivation")+TextFormatting.RESET;
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE); font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
@ -167,16 +158,12 @@ public class ClientEvents{
String expl = TextFormatting.GREEN+"Right-Click to toggle!"; String expl = TextFormatting.GREEN+"Right-Click to toggle!";
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE); font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
} }
profiler.endSection();
} }
} }
if(tileHit instanceof IEnergyDisplay){ if(tileHit instanceof IEnergyDisplay){
IEnergyDisplay display = (IEnergyDisplay)tileHit; IEnergyDisplay display = (IEnergyDisplay)tileHit;
if(!display.needsHoldShift() || player.isSneaking()){ if(!display.needsHoldShift() || player.isSneaking()){
profiler.startSection("EnergyDisplay");
if(energyDisplay == null){ if(energyDisplay == null){
energyDisplay = new EnergyDisplay(0, 0, null); energyDisplay = new EnergyDisplay(0, 0, null);
} }
@ -186,13 +173,9 @@ public class ClientEvents{
GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F, 1F);
energyDisplay.draw(); energyDisplay.draw();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
profiler.endSection();
} }
} }
} }
profiler.endSection();
} }
} }

View file

@ -97,7 +97,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
} }
@Override @Override
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
if(posHit != null && posHit.getBlockPos() != null){ if(posHit != null && posHit.getBlockPos() != null){
IBlockState state = minecraft.theWorld.getBlockState(posHit.getBlockPos()); IBlockState state = minecraft.theWorld.getBlockState(posHit.getBlockPos());
Block block = state.getBlock(); Block block = state.getBlock();