Jump to content

Recommended Posts

Posted (edited)

Dear Modding Community

 

so I am working on a Mod which requires Wireless Redstone.

How can I make a Redstone Output on my custome Receiver Block and turn it on and off.

 

Thank you in advance

Aaron

Edited by arkeN
Posted

I wonder if any vanilla blocks have a similar feature. Maybe you could go look at them.

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.

Posted (edited)
19 minutes ago, Draco18s said:

I wonder if any vanilla blocks have a similar feature. Maybe you could go look at them.

Hey,

 

I already made a transmitter in form of a lever, but I want my receiver to always have the same power state than my transmitter.

I don't quite now what you think of but a lever.

 

Aaron

Edited by arkeN
Posted (edited)

Great, cool, I wonder if there are vanilla blocks that output a redstone signal.

So you can go look at it.

And figure out how it does it.

Then adapt that to your new block.

Edited by Draco18s

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.

Posted
31 minutes ago, Draco18s said:

Great, cool, I wonder if there are vanilla blocks that output a redstone signal.

So you can go look at it.

And figure out how it does it.

Then adapt that to your new block.

Thank you for you answer,

 

so I set my Receiver to an RedstoneBlock and changed the canProvidePower Property to false, but it sends out a Redstone Signal anyways, and even if I can change it, that it doesn't send out a Redstone Signal, how can I set it back.

 

Since I don't want to wait for an answer and you don't want to answer my questions; Do you have a good Documention about the Forge API so I can get into this myself?

 

Regards

Posted

All the documentation is found within the source code. There is no externally hosted version because changes are made too rapidly that any such external version would be out of date immediately.

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.

Posted
38 minutes ago, Draco18s said:

All the documentation is found within the source code. There is no externally hosted version because changes are made too rapidly that any such external version would be out of date immediately.

Thank you for the answer it really helped me out.

 

So I managed to power the block by default, may you tell me how I can modify getWeakPower() to 0 in another class?

 

Regards

Aaron

Posted

Yeah, unclear what you're trying to do.

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.

Posted (edited)
15 minutes ago, Draco18s said:

Yeah, unclear what you're trying to do.

Well my Goal is that if I flick my custom lever my receiver should send out the same power signal.

I made an IntegerProperty called power but I get this error:

[19:14:40] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Cannot set property IntegerProperty{name=power, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]} as it does not exist in Block{null}

 

My class:

public class RedstoneReceiverBlock extends Block {

    public static final IntegerProperty POWER = IntegerProperty.create("power", 0, 15);

    public RedstoneReceiverBlock() {
        super(AbstractBlock.Properties.create(Material.IRON, MaterialColor.EMERALD));
        this.setDefaultState(this.getStateContainer().getBaseState().with(POWER, Integer.valueOf(0)));
    }

    @Override
    public boolean canProvidePower(BlockState state) {
        return true;
    }

    @Override
    public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
        return true;
    }

    @Override
    public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
        return blockState.get(POWER);
    }

}

My method which changes Power:

    public static void switchState(World w, BlockPos pos) {
        BlockState state = w.getBlockState(pos);
        if(isPowered(w, pos)) {
            w.setBlockState(pos, RegistryHandler.REDSTONE_RECEIVER.get().getDefaultState().with(RedstoneReceiverBlock.POWER, 0));
        }else{
            w.setBlockState(pos, RegistryHandler.REDSTONE_RECEIVER.get().getDefaultState().with(RedstoneReceiverBlock.POWER, 15));
        }
    }

 

Regards

Edited by arkeN
Posted

You need to have your receiver examine the blocks around it to find your lever, and if it does, and the lever is on, then output a signal.

Alternatively if you want a specific lever-receiver pairing system you need a TileEntity to store that information.

 

There is only One Lever instance and One Receiver instance. If you were to have your lever class modify data in the receiver class, then ALL receivers would activate any time you flipped ANY lever.

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.

Posted
Quote

Well. I fixed my errors, thank you all for your help.

In the future, don't just say "I fixed it", tell us what you fixed so others know what was the cause (if they ran into the same problem), and for anyone to point out other errors/mistakes/bad-practices in your code!

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.