Jump to content

[1.7.10] Connected textures when certain conditions are met


TheSeaOfSpace

Recommended Posts

Alright. This question sound familiar? I hope so. Unlike most projects, mines a bit more unusual.

 

I'm trying to get it so that when these blocks (note- they are animated and multitextured)are put in a 4x4 position like so:

JJut14F.png

(Code of block: http://pastebin.com/dJSEzxNi)

 

When placed in this condition, I want these blocks to create a connected texture that like so:

RxcxHF5.png (64x64)

 

One thing- I have absolutely no clue as to where to even begin. I've tried making my own rudimentary attempt, but alas, to no avail.

 

Perhaps one more knowledgeable may be able to assist.

Link to comment
Share on other sites

 

You are looking to do something similar to how Snow / Iron golems are created?

 

Once the last block is placed, if placed in the proper fashion, it will remove the old blocks and replace them with a large clock?

 

I hadn't thought of that. What I actually want is for that 4x4 block setup to have a new texture. So that each block will form that 64x64 texture down there in the bottom. Similarly to how many mods have seamless glass textures.

Link to comment
Share on other sites

You're creating a multiblock structure (don't think of it like a snowman, that's an entity).

 

Once your 16 blocks are in place, replace them with a different block that has metadata from 1 to 16 corresponding to which segment of the texture it should display.

 

You could do it with the existing block, but it would be more difficult and less efficient (the getIcon method would need to validate the structure every time it was called, where as using metadata means it only needs to be done once).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You're creating a multiblock structure (don't think of it like a snowman, that's an entity).

 

Once your 16 blocks are in place, replace them with a different block that has metadata from 1 to 16 corresponding to which segment of the texture it should display.

 

You could do it with the existing block, but it would be more difficult and less efficient (the getIcon method would need to validate the structure every time it was called, where as using metadata means it only needs to be done once).

 

Excellent, just what I needed! So, I've created a new block to handle all this. Registered all the icons (split the 64x64 into 16x16 sub-images), believe I set up metadata properly, however, I have no idea how to go about using getIcon() and such.

 

I also believe that I should not be using the OnBlockPlacedBy method, but I could be incorrect.

 

http://pastebin.com/txXeTgww

Link to comment
Share on other sites

@Override
public IIcon getIcon(int meta, int side) {
    return icons[meta];
}

 

Make sure it's actually overriding a method in Block to make sure I didn't typo something.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

@Override
public IIcon getIcon(int meta, int side) {
    return icons[meta];
}

 

Make sure it's actually overriding a method in Block to make sure I didn't typo something.

 

That put textures on my block, so that's working now. But I still can't get manage to figure out how to get the correct textures and connect everything :/

 

There must be a lot wrong with my logic in the code.

Link to comment
Share on other sites

Your structure should be laid out with metadata as follows:

 

[ 1] [ 2] [ 3] [ 4]
[ 5] [ 6] [ 7] [ 8]
[ 9] [10] [11] [12]
[13] [14] [15] [16]

 

As your texture should be split up as well.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Your structure should be laid out with metadata as follows:

 

[ 1] [ 2] [ 3] [ 4]
[ 5] [ 6] [ 7] [ 8]
[ 9] [10] [11] [12]
[13] [14] [15] [16]

 

As your texture should be split up as well.

 

Indeed, that's the part I understand. But setting up the metadata,recognizing when the blocks should be placed and setting the textures accordingly completely evades me. I've never dealt with anything quite like this; going through other's source code isn't adding to my well of knowledge. (Even Galacticrafts! And I've been looking at the launchpad classes extensively!)

 

Currently, all I've got is:

http://pastebin.com/AXVBEFCe

 

I don't suppose you've got any knowledge on this or sources I can use?

Link to comment
Share on other sites

That's going to be on your multiblock detection code, you'll identify a "top left" and set that one to clock:1 and work outwards from there.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Oh m yeah, 0.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.