Posted June 25, 201312 yr Hi guys, I'm fairly new to working with forge, and I ran into a bit of a rut while working on my mod. I'm trying to find some method or member I can call to check the strength of the redstone signal that my block is receiving. I've had a look at BlockRedstoneWire and BlockRedstoneLight for some hints, however the only public methods I could find tell me only if there is or is not power, not the strength of that signal between 0 and 15. My closest guess is that I may be able to use getMaxCurrentStrength(), though the comments on that were a bit ambiguous. My goal for this block is to detect the strength of a redstone signal and then adjust its texture accordingly.
June 26, 201312 yr world.getBlockMetadata(x, y, z) 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.
June 26, 201312 yr world.getBlockMetadata(x, y, z) Which is clumsy, because you have to check where the signal is coming from. If there's not such a function as he wants for the block receiving the signal, there should be. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 26, 201312 yr Unfortunately not even redstone wire works better than that. So he's SOL. 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.
June 26, 201312 yr Unfortunately not even redstone wire works better than that. So he's SOL. SOL? BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 26, 201312 yr Unfortunately not even redstone wire works better than that. So he's SOL. SOL? Sh*t Out of Luck. His option is to either check all the blocks that could possibly be providing power (6 for strong, significantly more for weak) or nothing. 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.
June 26, 201312 yr Unfortunately not even redstone wire works better than that. So he's SOL. SOL? Sh*t Out of Luck. His option is to either check all the blocks that could possibly be providing power (6 for strong, significantly more for weak) or nothing. Well, if that's how redstone itself works, I guess I wouldn't feel bad about checking all six. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 26, 201312 yr Well, if that's how redstone itself works, I guess I wouldn't feel bad about checking all six. Here's what redstone wire does: Vanilla Redstone behaviour: - Block update event received - Check if can stay - Update strength of block - Calculate the changes in current - Get the current strength - Get the current strength again but this time with the other set of coordinates, gives the same result - Toggle off flag so wires don't give power themselves - Get the strongest indirect power from the world - Toggle the flag back on - If the indirect power is greater than the current strength minus 1, set the strength to the indirect power - For every cardinal direction, check the strength unless the block is the origin (the block is never the origin) - * If any side has a greater strength than the current strength, subtract one and set it to the current strength * Otherwise subtract the current strength or set it to 0 - If the indirect power is smaller than the current strength minus 1, set the strength to the indirect power (repeat?) - If the resulting strength isn't equal to the original strength, update the block and add the surrounding blocks to a list that holds the blocks that need to update - Copy the list of to-be-updated blocks to a new list - Clear the old list - For every block in the list, trigger a block update 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.
June 26, 201312 yr Well, if that's how redstone itself works, I guess I wouldn't feel bad about checking all six. Here's what redstone wire does: Vanilla Redstone behaviour: - Block update event received - Check if can stay - Update strength of block - Calculate the changes in current - Get the current strength - Get the current strength again but this time with the other set of coordinates, gives the same result - Toggle off flag so wires don't give power themselves - Get the strongest indirect power from the world - Toggle the flag back on - If the indirect power is greater than the current strength minus 1, set the strength to the indirect power - For every cardinal direction, check the strength unless the block is the origin (the block is never the origin) - * If any side has a greater strength than the current strength, subtract one and set it to the current strength * Otherwise subtract the current strength or set it to 0 - If the indirect power is smaller than the current strength minus 1, set the strength to the indirect power (repeat?) - If the resulting strength isn't equal to the original strength, update the block and add the surrounding blocks to a list that holds the blocks that need to update - Copy the list of to-be-updated blocks to a new list - Clear the old list - For every block in the list, trigger a block update Ouch. I didn't think it would be *that* inefficient. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
July 5, 201312 yr Author Hey guys, after taking a break from modding for a couple weeks, I may have found the solution. I was browsing the World code today when I ran across this nifty function. net.minecraft.world.World /** * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z. */ public int getBlockPowerInput(int par1, int par2, int par3){} I have not yet finished up the other stuff I need before I test this, but just looking it over, it seems to be what I was looking for.
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.