Allow Machine Energy slot to hold items#18
Merged
serenibyss merged 6 commits intoGregTechCEu:masterfrom Jul 6, 2021
Merged
Conversation
serenibyss
reviewed
Jul 5, 2021
| @@ -75,7 +75,7 @@ public SimpleMachineMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap< | |||
| this.chargerInventory = new ItemStackHandler(1) { | |||
| @Override | |||
| public int getSlotLimit(int slot) { | |||
Member
There was a problem hiding this comment.
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) { |
Member
There was a problem hiding this comment.
I think you can just remove this override as well
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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