Jump to content

[1.9.4] Redstone connecting to custom bluestone


MCrafterzz

Recommended Posts

Well, I guess that before anyone is willing to help you, you should make your code readable. Try putting code-tags around your code, or better yet, put it to pastebin. Then we shall talk about your problem.

 

Also, be patient. It has been 2 hours since you started this thread and you are already bumping it.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

Let me guess:

 

Your problem is not that your block connects to redstone, but that redstone connects to your block.

 

Am I correct?

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

Not easily.  Redstone connects to anything that accepts power.

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

This is probably not the best way, but you could somehow stop redstone being registered as an item, and instead initialise it as a class you mak by cloning the redstone dust class and adding an exception somehow.

Link to comment
Share on other sites

I don't want it to connect to my block.

 

protected static boolean canConnectTo(IBlockState blockState, @Nullable EnumFacing side, IBlockAccess world,

BlockPos pos) {

Block block = blockState.getBlock();

if (block == ModElements.bluestone_wire) {

return true;

} else if (Blocks.UNPOWERED_REPEATER.isSameDiode(blockState)) {

EnumFacing enumfacing = (EnumFacing) blockState.getValue(BlockRedstoneRepeater.FACING);

return enumfacing == side || enumfacing.getOpposite() == side;

}

if (block == Blocks.REDSTONE_WIRE) {

return false;

} else {

return false;

}

}

Link to comment
Share on other sites

Redstone won't connect to your block if you return

false

from

Block#canConnectRedstone

. This is what diesieben07 has been telling you.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Gosh, if only that method took in a World parameter that would let you check what block is at the location...

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

No, you need to walk through the connecting process in the debugger and spot where one of your bluestone methods is making the decision. At that point, it should notice that it is looking at another block of itself and decide to connect rather than calling the canConnect method.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

canConnectRedstone

takes a World, a position, and a side as parameters.

 

Using super duper fancy mathemagical logic, you can figure out which block is doing the asking and figure out whether that block is Bluestone or Redstone.

 

It's almost like you'd take the side (possibly reverse it) and do World#getBlockState() on the position passed plus the side's (or its reversed cousin's) offset, then compare it to Bluestone.  If bluestone, return true, else return false.

 

The only tricky part will be figuring out whether the side passed was the direction that redstone is checking in ("I am looking north") or in the direction it's checking from ("I am interested in your south side").  It's most likely the latter.

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.