BuildCraft|Core

BuildCraft|Core

7M Downloads

API request: Insert item to pipe with colour

buttilda opened this issue ยท 13 comments

commented

As it stands there's no easy way to insert an item into a pipe with an specific colour (unless I'm missing something really obvious).
It would be nice to have something like that to improve the interaction with other mods

I thought perhaps a method in IPipeTile somewhat like this:

int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, int colour);

The parameter "colour" would be the metadata of the dye (1 for black, 15 for white and so on)

As this would probably break the API for other mods, I think that now is right time to do it.

commented

Works for me.

commented

Do you have a specific mod in mind? In which case, I agree with CJ, no problem, and this is the right time. I'm closing this issue, though, as I'm not sure if anyone is planning to implement it at this stage, but feel free to submit a pull request!

commented

I'd like to use it on my mods.
But I also think it would be a nice feature to have available for whoever wants it.

I could submit a PR but it will probably take a while because I haven't touched 1.7 code yet.

commented

Alright :)
Thank you a lot. I'll see if I can have a go at it this week.

commented

Understood. I'd like to keep the "nice to have" closed, so that we concentrate on things that can have a direct use. Don't hesitate to open a PR when you get to it. Even if you miss the 5.0.x train, there will be others API changes possible :-)

commented

Question @SpaceToad
Should I add a new "injectItem" method or should I just add the colour parameter to the existing one?

commented

Just change the existing one to have a colour parameter, and make a new

int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
    injectItem(stack, doAdd, from, -1);
}

or something like that.

commented

Can't do that. IPipeTile is an interface

commented

I agree with @psxlover.

commented

And like any other interface it has to be implemented somewhere. You can't just change the interface you have to change it's implementations too.

commented

Yes, so should I add another method to the interface or should I just add the colour parameter to the old one?
Which was my original question....

commented

Add a new one. You don't want to always add colour to the items.

commented

Or... I add the parameter and if whoever is using the method doesn't want to use colour just passes it a negative value