LordFokas / StargateTech2

http://mod-stargatetech.com
Other
29 stars 10 forks source link

Shield block looks good now #90

Closed marcin212 closed 9 years ago

marcin212 commented 9 years ago

Screen: http://i.gyazo.com/97c99a54e88e8f3c83df500fb7886202.png Build: http://starchasers.pl/SGT2/stargatetech2-Alpha-0.7.5-MC1710-Forge1232-B6-UnOfficial.jar

LizzyTrickster commented 9 years ago

GAH, use the Abstract Bus Card! :<

marcin212 commented 9 years ago

@JoshTheEnder hmm, I didn't see now. In earlier version of OC I couldn't put it to computer case. My version OC: OpenComputers-MC1.7.10-1.4.0.215-dev-universal.jar

LordFokas commented 9 years ago

I was going to work on it today, I guess that's one less thing on my list. But the way you've fixed it has a couple of problems:

I haven't tested it, but I can tell it will work like that. The reason is you're testing for a shield block, when there are many blocks that can be "shieldable" (well actually just one for now) that aren't a BlockShield. Naquadah Rails extend the vanilla BlockRailBase. You need to test for adjacent IShieldable blocks AND check if the shield for that block is enabled (it can be a shieldable block with no shield on adjacent to an activated shield).

I don't mean to boss you around, the only reason I'm saying all this is so you can learn a thing or two from me, not that I have much to teach but I'm still the most knowledgeable person around my code :p If you don't want to bother with it, leave it be, I was going to do it anyways. If you want to take another shot, let me know and I'll leave it up to you and work on something else before releasing v0.7.5

Oh, also, you don't need to make builds for every little change you make. It's necessary for massive changes like your (awesome!) port, but in most cases screenshots are enough.

marcin212 commented 9 years ago

@LordFokas thx. I have problem. When I try rendering blok without blank texture then I get: http://i.gyazo.com/b3c85c4ec0366f0764b9b8ed7817be71.png How do I check if side of block is internal or external ?

LordFokas commented 9 years ago

what you should be doing is using the tessellator directly in RenderBlockShield to render faces manually with the shield texture. Invisible sides don't get rendered at all. This also fixes the issue for the naquadah rail because it calls the shield renderer to render the shield over the rail...

The sides of blocks are always external, because OpenGL is set to cull faces, so the "inside" never gets drawn...

I'm not sure what else I can say to help you.

marcin212 commented 9 years ago

I looked into minecraft glass code and: http://gyazo.com/9d2633cf5e0cbdf5e606a8ace1f4fa83

LordFokas commented 9 years ago

As long as that was done in the renderer, that's perfect :D I'm just waiting for you to reformulate the PR :)

marcin212 commented 9 years ago

If I check shield status then I can't use IShieldable. ex:

if(tile instanceof TileShield && ((TileShield)tile).getController()!=null){
            return !((TileShield)tile).getController().isShieldOn();
}
LordFokas commented 9 years ago

yeah, we'll go with TileShield for now. If we come up with IShieldables that aren't TileShield we'll find a better solution then. Using the tile entity is good enough for me.

LordFokas commented 9 years ago

Actually, the fact that there is a shield TE in there means the shield is on... although checking with the controller isn't a bad idea. Just keep in mind getController() can return null anda cause NPEs. I'm leaving for today, I'll check back tomorrow and hopefully get something done.

LordFokas commented 9 years ago

@marcin212 while the code you've produced is fine, I think it will still render too many faces when you have multiple adjacent naquadah rails, because you're fixing it in the block and not in the renderer. Though, I'll have a look myself. I'll merge this and if it doesn't fix stuff properly I'll fix.