MCrafterzz Posted June 11, 2016 Posted June 11, 2016 Hello, I have made a custom redstone named bluestone. It works perfectly except that it connect to redstone. Please reply if you know a sollution for this problem. My code: http://pastebin.com/a3hPY4BF Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted June 11, 2016 Author Posted June 11, 2016 Noone have no idea how redstone works? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
sham1 Posted June 11, 2016 Posted June 11, 2016 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. Quote 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.
MCrafterzz Posted June 11, 2016 Author Posted June 11, 2016 Added pastebin link Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted June 11, 2016 Posted June 11, 2016 Let me guess: Your problem is not that your block connects to redstone, but that redstone connects to your block. Am I correct? Quote 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.
MCrafterzz Posted June 11, 2016 Author Posted June 11, 2016 Proberly, is there a way to fix that? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted June 11, 2016 Posted June 11, 2016 Not easily. Redstone connects to anything that accepts power. Quote 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.
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 I know what code that needs to be changed in the redstone class, I just need to override it in some way. Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
mlugg Posted June 12, 2016 Posted June 12, 2016 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. Quote
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 I created a new redstone class ModRedstone and added this code: Blocks.REDSTONE_DUST = new ModRedstone() But I gave me this error message: Can't convert from ModRedstone to BlockRedstone Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 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; } } Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 The problem is that REDSTONE connect to bluestone not that bluestone connects to redstone, so that problem is that I can't change the redstone class. Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Choonster Posted June 12, 2016 Posted June 12, 2016 Redstone won't connect to your block if you return false from Block#canConnectRedstone . This is what diesieben07 has been telling you. Quote 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.
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 And how do I do that Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Choonster Posted June 12, 2016 Posted June 12, 2016 Override the method in your class. It's not hard. Quote 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.
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 Can you give me the code because the isn't any methoud canConnectToRedstone to override in the bloxk class that it extends Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Choonster Posted June 12, 2016 Posted June 12, 2016 Nobody said anything about canConnectToRedstone , the method is called canConnectRedstone . Quote 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.
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 Thank you it now doesn't connect to redstone but now I have a bigger problem it doesn't connect to it self. How should I change the code so it doesn't check if the block can connect to redstone Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted June 12, 2016 Posted June 12, 2016 Gosh, if only that method took in a World parameter that would let you check what block is at the location... Quote 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.
MCrafterzz Posted June 12, 2016 Author Posted June 12, 2016 So is it impossible ; c Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
jeffryfisher Posted June 12, 2016 Posted June 12, 2016 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. Quote 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.
MCrafterzz Posted June 13, 2016 Author Posted June 13, 2016 Ok, I'll test it Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
MCrafterzz Posted June 13, 2016 Author Posted June 13, 2016 I didn't find anything in the console so could you maybe send a example? Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Draco18s Posted June 13, 2016 Posted June 13, 2016 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. Quote 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.
MCrafterzz Posted June 13, 2016 Author Posted June 13, 2016 Ok... very confusing could you possibly help me more exactly what I need to do. Thank you very much for your answer Quote http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod]
Recommended Posts
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.