Skip to content

Allow Machine Energy slot to hold items#18

Merged
serenibyss merged 6 commits intoGregTechCEu:masterfrom
BraggestSage833:fixEnergyslot
Jul 6, 2021
Merged

Allow Machine Energy slot to hold items#18
serenibyss merged 6 commits intoGregTechCEu:masterfrom
BraggestSage833:fixEnergyslot

Conversation

@BraggestSage833
Copy link
Copy Markdown
Contributor

What:
Allows the energy slot on machines to take items in addition to batteries.

How solved:
I added a check to canPutStack() for Electric items in DischargerSlotWidget. When an Electric item is placed the slot gains the Electric item capability. If it is not an electric item the slot changes to an item storage container.

Outcome:
People can place items such as lenses and extruder shapes into this slot.

Additional info:
I have also modified getSlotLimit() in SimpleMachineMetaTileEntity to allow for stack sizes of 64.

Possible compatibility issue:
none

@@ -75,7 +75,7 @@ public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap<
this.chargerInventory = new ItemStackHandler(1) {
@Override
public int getSlotLimit(int slot) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this anonymous override is unnecessary since it should default to 64

public boolean canPutStack(ItemStack stack) {
IElectricItem capability = stack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
return capability != null && capability.canProvideChargeExternally();
if (this instanceof IElectricItem) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just remove this override as well

@serenibyss serenibyss merged commit 3e66025 into GregTechCEu:master Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants