Hey guys ! This is my first tutorial ! Today I'm going to show you how to make a selective xray.
I didn't find any tutorial for this so I decided to make one.
P.S: I'm french, sorry for my bad english.
Let's start !
1) What you want to do first is create a boolean so you can activate the xray (You should know how to do this if you are here).
2) Then, create a class (I called mine "Xray") and make it extends the "Block" class
3) Now that this is done you want to add booleans for the blocks you want to show on the xray
4) Add this in your Xray class:
5) We are done with this class. Now go to the "Block" class. Find "public static boolean renderAsNormalBlock()"
and change the return method to: return !Variables.xray; (The boolean you created to activate the xray)
6) Still in the Block class, find this : public boolean shouldSideBeRendered()
You want to do like the "normal" xray but add the block booleans we made:
7) There was a return method before
return
return par5 == 0 && this.minY > 0.0D ? true : (par5 == 1 && this.maxY < 1.0D ? true : (par5 == 2 && this.minZ > 0.0D ? true : (par5 == 3 && this.maxZ < 1.0D ? true : (par5 == 4 && this.minX > 0.0D ? true : (par5 == 5 && this.maxX < 1.0D ? true : !par1IBlockAccess.isBlockOpaqueCube(par2, par3, par4))))));
Well, you want to put it after the last block you added starting at "par5" but add a ":" between.
Like so:
8)We're DONE.
9) To activate a block (Clickable gui is preferable) you have to call the boolean that is in the Xray class. For example : Xray.coal (You do : Xray.coal = !Xray.coal; )
and make it loadRenderers. (mc.renderGlobal.loadRenderers(); )
HOPE THIS HELPED !