-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework Multiblock Abilities #2420
base: master
Are you sure you want to change the base?
Conversation
0c22cbd
to
6b8c11a
Compare
b58ef1c
to
f6b840f
Compare
6bdc2d7
to
6d0fcf2
Compare
6d0fcf2
to
dff15e9
Compare
829ea5f
to
04ad422
Compare
src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java
Outdated
Show resolved
Hide resolved
for (IMultiblockPart multiblockPart : parts) { | ||
if (multiblockPart instanceof IMultiblockAbilityPart) { | ||
@SuppressWarnings("unchecked") | ||
IMultiblockAbilityPart<Object> abilityPart = (IMultiblockAbilityPart<Object>) multiblockPart; | ||
List<Object> abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), | ||
k -> new ArrayList<>()); | ||
abilityPart.registerAbilities(abilityInstancesList); | ||
for (IMultiblockPart part : parts) { | ||
if (part instanceof IMultiblockAbilityPart abilityPart) { | ||
List<MultiblockAbility> abilityList = abilityPart.getAbilities(); | ||
for (MultiblockAbility ability : abilityList) { | ||
List abilityInstancesList = abilities.computeIfAbsent(ability, | ||
k -> new ArrayList<>()); | ||
abilityInstancesList.addAll(abilityPart.registerAbilities(ability)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here if a single multiblock part has IMPORT_ITEMS
and IMPORT_FLUIDS
, but the multiblock only allows one of these in the structure at that position. Should the part be allowed or rejected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a method that skips adding abilities at certain positions, but should i just invalidate the multiblock instead?
3700d34
to
bfd2e2f
Compare
fd8136b
to
4ac4934
Compare
src/main/java/gregtech/api/capability/impl/MultiblockRecipeLogic.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java
Outdated
Show resolved
Hide resolved
ce00ff9
to
734585c
Compare
7e565d2
to
73bc303
Compare
4406c85
to
52177f4
Compare
return isExportHatch ? MultiblockAbility.EXPORT_FLUIDS : MultiblockAbility.IMPORT_FLUIDS; | ||
public @NotNull List<MultiblockAbility<?>> getAbilities() { | ||
return isExportHatch ? | ||
Collections.singletonList(MultiblockAbility.EXPORT_FLUIDS) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the slots for filling fluid containers technically not count for abilities here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it makes sense to include the IO slots when searching for a recipe
...ain/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java
Show resolved
Hide resolved
...ain/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java
Show resolved
Hide resolved
Should the reservoir hatch also get a circuit slot? |
7f5f0be
to
7e2e27a
Compare
src/main/java/gregtech/api/metatileentity/multiblock/AbilityInstances.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will take a look at the Fluid Hatch GUI stuff next time
if (items instanceof IMultipleTankHandler tankHandler) { | ||
tanks.addAll(tankHandler.getFluidTanks()); | ||
} | ||
return new FluidTankList(getInputTank().allowSameFluidFill(), tanks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this takes allowSameFluidFill
from the normal input tanks, but does not take into account if any of the dual handlers discovered set this value to true. Do we want to check if any of the discovered tanks have this set to true, and if so pass that to the FluidTankList? Or what happens when a dual handler allows same fill, but normal hatches on the multiblock do not?
* Entry of multi fluid tanks. Retains reference to original {@link IMultipleTankHandler} for accessing | ||
* information such as {@link IMultipleTankHandler#allowSameFluidFill()}. | ||
*/ | ||
private static final class MultiFluidTankEntry implements ITankEntry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sort of confused why we need this class in the first place. The incoming fluid data is wrapped into this MultiFluidTankEntry, but then immediately unwrapped into an ITankEntry.
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockAbility.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java
Show resolved
Hide resolved
} | ||
} | ||
|
||
return new FluidTankList(allowSameFluidFillForOutputs(), tanks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about if the DualHandler allows same fill, but the normal hatches on the structure do not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the tanks are already wrapped, then they should respect the setting of their parent fluid tank list
7946c82
to
23fc855
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this error in the log when I was playing around with the reservoir hatch,
[22:41:51] [Client thread/ERROR] [modularui]: Tried to open a panel, but a panel handler that opens the same panel already exists. Using existing panel handler!
Repeat by shift clicking the circuit slot, set a circuit number with shift click, and then shift click the circuit slot again and set a new number with shift click.
super.initializeInventory(); | ||
if (this.hasGhostCircuitInventory()) { | ||
this.circuitInventory = new GhostCircuitItemStackHandler(this); | ||
this.circuitInventory.addNotifiableMetaTileEntity(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add the fluid hatch to the notified list? Since the hatch can never perform any recipes. We get the multiblock in the add to structure override, but I don't think there is any need for the hatch itself to be notified, is there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, every other usage of GhostCircuitItemStackHandler
does this as well, but it doesn't seem to be needed?
...java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java
Outdated
Show resolved
Hide resolved
this is because the ghost circuit slot calls IPanelHandler.simple() on each mouse click. it isn't really the ideal way to handle the popup, but that should be changed in the rc4 pr imo. |
b572825
to
b29e781
Compare
spotless
…nstead of sealed class casually rework DualEntry to not be an item handler
fix distinct fluids
spotless
clarify existing check at set use simple name instead of class string
initial sync circuit value
remove unused methods simplify AbilityInstances a bit remove exception throwing remove getAbilitiesModifiable()
add contains check
rename delegate methods add annotations add javadoc remove unused method
add toString to instances
0b42db8
to
83a4325
Compare
What
Reworks
IMultiblockAbilityPart
to allow for multiple abilities from one part.MultiblockRecipeLogic
checks if an item handler could also be a fluid handler (only for distinct mode atm)Implements a ghost circuit slot for single-tank fluid input hatches.
Implementation Details
add a class to
MultiblockAbility
's constructor so that class types can be checkedadd a new class to store instances of a
MultilbockAbility
. types are checked and an exception is thrown when the wrong type is added.a new class,
DualHandler
, is added to implement item and fluid handling capabilities. (not used for anything atm)Should multitank fluid hatches (quad/nonuple) have ghost circuits as well?
Outcome
fluid hatches are more spooky