Jump to content

Vertical Redstone Wire Block... Help? [UNSOLVED]


CL4551C

Recommended Posts

I am trying to make a mod that adds a cleaner housing system. This would include hidden wiring... I have already gotten through the headaches of all of the initial crashes, but things keep popping up.

 

I am obviously new to modding... this is my first. I have created a lever block (though it doesn't act like a block... you can't place anything on top of it, and you can walk through it...), a basic wall block, and a redstone wire block. Sort of.

 

The block acts just like redstone, but with textures of a block. I can't seem to treat it like a block without screwing up it's redstone properties. It can be placed anywhere redstone can, and all.

 

ProblemsINeedHelpWith

{

//You can walk through them(Solution = don't use getCollisionBoundBoxFromPool);

//You can't place them on the side of a block(Solution = canPlaceBlockAt return true);

//You can't place them on top of one another(Solution = canPlaceBlockAt return true);

You must make a diagonal chain to go vertical;

}

 

Here is my source code (I'm not too far into mod development, so I'm not worrying about anyone stealing. It's honestly just redstone wiring with some rendering changes):

 

I will enter my codes into GitHub once I find out how to use it...

 

For now, if you want to help, run eclipse through this folder at startup:

 

http://www.mediafire.com/download/zbgux6x792caipc/forge.zip

 

For right now, I need help with the redstone output... As of right now, electricity flows in every direction but up. Can someone help me? I don't understand how to add a direction. All I see is a bunch of numbers, letters, and +/- signs...

 

Stuff like this:

 

if (i2 > 0 && i2 > l1-1)

{

    l1 = i2;

}

With some things, you just have to run before you learn to crawl.

Link to comment
Share on other sites

Hi

 

Sounds like you've made an ambitious place to start :-)

 

For posting code, github.com is very useful (create a "gist").  In fact, even better is to host your entire project on GitHub, if you are willing to put in a bit of time to set up git version control for your project.

https://gist.github.com/

eg

https://gist.github.com/TheGreyGhost/7613416

 

For the answers to your questions... best place is to look through BlockRedstoneWire and see which methods it is overriding.  You can usually guess from the name or the comments what it does.

 

in particular

getCollisionBoundingBoxFromPool

canPlaceBlockAt

 

If your new block is supposed to interact with redstone, you should probably inherit it from one of the Redstone Blocks.

 

You're probably in for a fair bit more frustration and trial & error before it works right...  good luck :-)

 

-TGG

 

 

 

Link to comment
Share on other sites

Hi, thanks for helping! I've seen you help quite a bit of folks!

 

I did try looking for the methods before, with some strange outcomes... canPlaceBlockAt was making it so I couldn't place blocks on the sides of walls and such, but when I got rid of that (I used //), I found that when I placed it, it spit out the itemID of redstone.

 

I left the "return redstone" there for future changing, but it helps me see when something went wrong... I don't know how to enter my item ID into the place of Item.redstone.itemID, because mine is a block.

 

Yeah, so now the block wouldn't even place. I found I could stop this by //-ing

par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID);

and

par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID);

 

I don't really know what that did... but I could place the blocks. Anywhere.

 

But... I couldn't place them anywhere where they would normally connect. If I placed a long chain of the blocks diagonally, so they didn't connect, and then at the end, connected two, all of them would be destroyed and would drop redstone.

 

I still need help.

 

My block doesn't do anything now, because it can't connect to others.

 

Sorry for the... I don't know, complicity? Over-Complicatedness?

 

By the way, thanks for the recommendation. I will try GitHub. I've never really heard of it before.

 

Edit: Hey, what do you mean, host my entire project on GitHub? What is a git version control? Can I somehow show where the packages and classes are at? Oh, and what language do I copy it in? Java or JavaScript?

With some things, you just have to run before you learn to crawl.

Link to comment
Share on other sites

Hi

 

GitHub is a way to manage all of your code for a particular project.  If you just want to post a bit of code for others to look at, use a gist ("Java" is fine).

 

Version control is a tool for you to manage changes to your code.  You can keep several different "branches" of your code to try different ideas, you can roll back changes if they don't work, you can keep  "release" versions of your code (eg version 1.1, version 1.2, etc) while you work on adding changes for the next version.  There are a lot of version control tools around, GIT is just one of them.

http://www.git-scm.com/book/en/Getting-Started-About-Version-Control

 

The advantage of GitHub is that your project gets stored on the web, not just on your own local machine.  If your hard drive dies, no problem.  If you have a desktop and a laptop and swap between them, no problem.  You can also have other people work on the same project as you and merge the changes later.

 

Here's an example of a GitHub project.

https://github.com/TheGreyGhost/ItemRendering

It is synchronised with the code on my local machine.  Anyone who is interested can download it as a zip and compile on their own machine.

 

Re blocks not placing - yeah it's going to be a challenge.  Off the top of my head I don't know what exactly is happening  (someone else on this forum might...). 

 

canPlaceBlockAt should probably return true instead of you commenting it out entirely.

 

If you post your code we can give it a crack ourselves.

 

-TGG

 

 

 

 

Link to comment
Share on other sites

.    .    .    .    .    .    .

 

You are a genius.

 

Simple as that.

 

I didn't think to return true.

 

It now acts perfectly.

 

Vertically.

 

Horizontally.

 

I envy your logic.

 

Yeah, so how might I make it not act like air? I can still walk through it...

Same with the lever block.

 

Oh, and I can't seem to click and drag or copy and paste my code to my gist. Any ideas?

 

Edit: I didn't understand what getCollisionBoundingBoxFromPool did... I just solved the "walk right through the block" problem. I'm stupid. Thanks.

With some things, you just have to run before you learn to crawl.

Link to comment
Share on other sites

Honestly, you are good.

 

The Cmd-C and Cmd-V (I use mac, so it's command) works. I'll post a link.

 

Yeah, so now the only thing left is really complicated stuff. I can place the block anywhere, but redstone isn't actually programmed to transmit strait up and down. It works on a small scale, but you have to place it diagonally to go up and down, like this:

 

          O

        O

          O

        O

 

I suppose I will have to somehow read the gibberish coding in the output section of redstone.

 

Thanks!

With some things, you just have to run before you learn to crawl.

Link to comment
Share on other sites

You may be interested in the source for one of my mods:

http://www.mediafire.com/download/422x2dlo1co3v2n/phaseblocks-src-164.zip

 

The RedPhaseStone handles transmission of a redstone-like signal in all six directions.  It's not as...perfect as redstone at turning off (probably because of an in-build delay), but it was sufficient for my purposes.

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

Thanks for the help, but I don't even know what that mod is. I don't understand the code, because I don't know what that is even supposed to do... So I still need help transmitting redstone vertically...

With some things, you just have to run before you learn to crawl.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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