Little(or not) rework of pipe raytracing
Opened this issue · 29 comments
Right now pipe raytracing is a little wonky in the code, i can done it a bit more nicely. Also, intercepting boxes of 'sides' of the pipe(where you put gates/plugs/facades) is annoying.
The whole raytracing thing can be redone so that you'll can mush more easily create more 'attachable' things (API? maybe) to it.
Can be part of #1881/#1886 (If you let me go really crazy, can be part of #1388 xD)
P.S Sorry for big pause in stripes pipe API, i was unexpectedly moved to another house with another computer, so yeah.
@anti344 I don't know much about FMP and Scala, but couldn't it be ported from Scala to Java?
No.
@Chicken-Bones use ASM hacks, traits, magic and horns of unicorns to make it work.
However you can include compiled code and scala API(which @cpw already did to make Forge officially support Scala) and it should work without installing Scala plugins to your IDE(the main @LexManos concern about it).
@anti344 I see. It would be cool if they did implement it.
Oh everything is so quick, i'll have a good times understanding changes =P
Working on a little sketch of it in local workspace.
It would be nice if the whole pipe/gate/plug/wire mechanic was made into multiparts. It would make possible more precise interaction with wires and gates, but would take a load of time and work though...
- Yes
- @SpaceToad said there'll not be an FMP support until it'll be part of Forge(it'll never be since it's written in Scala)
@anti344 It could be ported from Scala to Java but there is not significant reason to put forward the effort.
@Chicken-Bones wow, ok, i was thinking it is only possible using Scala. Like codechicken.multipart.asm package, it looks crazy.
P.S. Need some kind of discussion page on minecraftforge forum, here we talk about raytracing in BC =P
P.P.S. Should i make some kind of RaytraceUtil, where i can move a lot of repeatable code?
P.P.P.S. Actually, it is BC and FMP who helped me learn raytracing, thanks guys.
RayTracing is a separate and generally easily solved problem, see CCL's RayTracer and EnderStorage/ForgeMultipart for examples
@Chicken-Bones Yup, i know, and this method can be A LOT smaller.
Also, @SpaceToad, how about breaking facades instead of stripping them? Like real breaking but only facade breaks and drops from the pipe. Thanks again to FMP, it's awesome.
P.S For example
Look at facade, hold left click, watch breaking textures - facade dropped, pipe stays.
The same, but instant can be done with gates and stuff.
Ok - thinking further, it feels a bit over-engineered at this stage. I'd tend to leave this one on the side for now.
It's very easy with raytracing thing(only the particles is a bit less easy, but still, not hard).
Ok, so can i work on main issue now? (or not now, tomorrow, it's 2 am here)
@anti344 I'm not sure I understand your proposal - you mean with progress in breaking? That's an interesting proposal. I'm not against it.
I'm so proud of my RayTraceUtil class. So so proud. I never did code that clean before.
After half a day of trying to find the problem - IT WAS 0.5 INSTEAD OF 5.0.
I'm talking about:
double reach = 5.0;
if (player instanceof EntityPlayerMP) {
reach = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
}
Lol, here is already a base for my "some little kind of API", IPipePluggable interface.
@SpaceToad, can i use it to automatically do raytracing thing? It would be so easy and awesome.
Also, adding some JavaDoc would be nice too.
P.S. Right now everything works almost as before, just much less code.(And nice util class for the future).
Actually I've planning to make TileGenericPipe lighter by splitting
process/render logic for pluggables. It's will great if anti344 could take
this work)
@Prototik, btw we need hooks for render, tick updates and stuff for pluggables. A lot of things like placing, stripping, right clicking(open gate gui) and raytracing cleaned and moved to pluggables.
BlockGenericPipe.java - was 1340 lines, now it's 823 lines. A lot removed or moved/abstracted away.
EDIT:
Now 755, i'm still not done.
@anti344 Lol, you are great candidate for worker in google. Crazy guys can write >7000 lines of code into single .java file. Android rocks ✌️
Ugh, again. Client-Server relations. @Prototik, pluggables only exist on server so i can't(at least now) use them for clientside stuff(like bbox) =(
Can i try to do something with it(make them both sides existing)?
- I don't know Git enough, can i have 2 pull request at the same time?
- There was a problem with pluggables - they exist only on server(i need info from them about hitboxes on the client).
I still have the code for this, just don't know what to do with it.