CoolOpacity Xray and FullBright {code}

Posts 19 of 9 · Page 1 of 1
Opacity Xray and FullBright {code}
This assumes that you know all triggers
so you know this is leeched but edited to make it simpler =3



so lets start assuming that you setup all your triggers etc
note Fe = Fullbright Xe= Xray
Find = ctrl + f


_____________Part 1 __________________________

Open Tesselator.java in eclipse

add
public static int opacity = 90;
note the number 90 is customizable to your preference
to
public class Tessellator
{
find
public void setColorOpaque(int i, int j, int k)
and add
if(GuiIngame.Xe)
{
setColorRGBA(i, j, k, opacity);
}
to it

Get to
Block.java

find
public int getRenderBlockPass()
and change

return 0; ===> return 1

_________________Part 1 Done________________

And you should have something like

This

____________________Part 2____________________
Getting the Xray!

Go back to
public int getRenderBlockPass()
and this time label the blocks that you want like this
if(GuiIngame.Xe)
{
return blockID == 14 || blockID == 15 || blockID == 16 || blockID == 21 || blockID == 54 || blockID == 54? 0:1 ;

}
else
return 0;
IMP BLOCK IDS

here


Then go to
RenderBlocks.java
and find
public boolean renderBlockByRenderType(Block block, int i, int j, int k)
and place your block ids like
int l = block.getRenderType();
block.setBlockBoundsBasedOnState(blockAccess, i, j, k);
if(GuiIngame.Xe)
{
renderAllFaces = block.blockID == 14 || block.blockID == 15 || block.blockID == 16 || block.blockID == 56 || block.blockID == 21 || block.blockID == 54;
}
__________________________________Part 2 done______________________

IT should be something like this

this




_______________________________________Part 3__________________________
The full Bright


In blocks.java
find
public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
and replace to something like
if(GuiIngame.Xe || GuiIngame.Fe)
{
return 1000f;
}else
return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
}
Fe is Fullbright.

then underneath it is
public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k)
change it to
if(GuiIngame.Xe || GuiIngame.Fe)
{
return 1000;
}else
return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]);


And that is your fullbright and opacity xray
it look something like this

[URL="http://i.imgur.com/this[/URL]





















Problem. when i dropblocks the drop form it doesnt appear and it crashes when i try to pick it up i know what classes it messes up but i dont know how to fix it
Error:

Code:
at net.minecraft.src.Render.loadTexture(Render.java:27)
	at net.minecraft.src.RenderItem.doRenderItem(RenderItem.java:49)
	at net.minecraft.src.RenderItem.doRender(RenderItem.java:342)
	at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:158)
	at net.minecraft.src.EntityPickupFX.renderParticle(EntityPickupFX.java:48)
	at net.minecraft.src.EffectRenderer.func_1187_b(EffectRenderer.java:115)
	at net.minecraft.src.EntityRenderer.renderWorld(EntityRenderer.java:903)
	at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:735)
	at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:17)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:737)
	at net.minecraft.client.Minecraft.run(Minecraft.java:634)
	at java.lang.Thread.run(Thread.java:680)
Didn't you forget to change the renderAsNormalBlock function in Block.java?
good tut but two problems: when fullbright is on things like cactus and sugar cane and tallgrass etc. don't get lit up like the blocks and second when xray is on the blocks aren't well lit up unless they're exposed to the light. I have fullbright working and here's my code:
Code:
 public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
    {
    	if(Hacks.fullbright || Hacks.xray) {
    		return 1000F;
    	} else {
    		return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
    	}
    }

    public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k)
    {
    	if(Hacks.fullbright || Hacks.xray) {
    		return 1000;
    	}else {
        return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]);
    	}
    }
Hm..
The xray works, but the ores are also transparent..
when I have xray turned on, and I go to type something in the chat, or if I hit the Escape key, then the ores are fully opaque, but as soon as I go back in-game or exit the text-box, they revert to being see-through..
Here's what I mean:
With Xray only:
5a921b33057614fe7d1778a9d10776b3.png
With Xray while typing:
621f5c88cfdc38d2dd67a8f813c7f19d.png

Now, before you think I just skidded the code and started complaining 'cause it didn't work right, think again - I've double-checked everything, I changed the 90 in (public static int opacity = 90), to see if it was the amount of opacity, but it wasn't, I've looked at other opacity tutorials to see if there was something else I missed, and once again, I have everything in-tact, but you saw what the ores look like...
Any ideas? :s
Quote Originally Posted by coolguy091 View Post
good tut but two problems: when fullbright is on things like cactus and sugar cane and tallgrass etc. don't get lit up like the blocks and second when xray is on the blocks aren't well lit up unless they're exposed to the light. I have fullbright working and here's my code:
Code:
 public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
    {
    	if(Hacks.fullbright || Hacks.xray) {
    		return 1000F;
    	} else {
    		return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
    	}
    }

    public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k)
    {
    	if(Hacks.fullbright || Hacks.xray) {
    		return 1000;
    	}else {
        return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]);
    	}
    }
Use the gamma settings to make them light up
Quote Originally Posted by Wampwire View Post
Use the gamma settings to make them light up
Block.java fullbright makes me die a little inside. Its so uneffective...
Thus gamma comes in to save the day!
Or you can teach the skids to actually learn java and do some oop coding.
@slash1997 I had the same problem and have resolved it. Make a boolean variable where ever your trigger booleans are and call it isBlockSeen or something. Then in the RenderBlocks.renderByRenderType([parameters]) method above where the if statement containing the renderAllFaces toggle is, write an if else statement toggling on the isBlockSeen boolean if the par1Block.blockID is equal to any of the IDs you chose to use and off when it does not. Then simply make your Tessellator activate if(GuiInGame.Xe && ![insert isBlockSeen variable call here]) to make it use full opaque color whenever the block is one matching one of the ID's you wish to see. Hope you can understand that. Happy coding.
Posts 19 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Need help?