Hello JGO, today I've been messing around with cubes in a 3D application ^_^
Basically what I'm trying to accomplish is shown in the images below, but I'll also explain it:
Say there is 4 blocks stacked on top of each other.
I'd like the bottom 3 to be textured solid while the top block is textured as a top block. (Signifying a difference)
Here is what I am starting with:
I'm trying to accomplish something around the lines of:

Now I have been experimenting with this for the past few hours and I can't seem to write a method that "Dynamically" adjusts.
Here is the method at the moment (Clean restart, was WAY too long):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| public void updateBlockTexture(Chunk parentChunk) {
final Block b1 = (Block) this;
for (int i = 0; i < parentChunk.getBlockList().size(); i++) {
final Block b2 = parentChunk.getBlockList().get(i);
final boolean identical = Boolean.valueOf(b1 == b2 || b2 == b1);
if (!identical) {
if (b1.isOntopOf(b2)) {
} if (b2.isOntopOf(b1)) { }
} } } |
When I wrote a somewhat decent version of this earlier I managed to get it to do what I want, but when I changed the chunks size It wouldn't function properly xD.
If somebody whose done this before could help me out with a explanation / pseudo code or if anybody could link me to a tutorial I'd be very grateful thanks JGO ^_^
If you need anymore information, please ask ^_^