Refactored the BaseActionSource (#3063)
* Refactored the BaseActionSource It now uses an interface `IActionSource` instead of a concrete class and further subclasses. Instead of relying on a specific class for a certain action type, it now uses methods with Optional as return values to determine a player or machine issuing an action. Refer to the JavaDocs for the exact behaviour. * `IActionHost` no longer extends `IGridHost` It never used the additional functionality and if needed the `IGridNode` will also provide a reference to the corresponding `IGridHost`. Due to most crafting related GUIs being hardcoded to `IGridHost`, they no longer work when `IActionHost` is not extending it. Actually `IActionHost` is the better solution for it, as it prevents us from looking the grid up via the `IGridHost` and potentially finding a wrong grid. * Interfaces now only lock the currently worked slot. This allows `DualityInterface#onChangeInventory` to update slots of the same interface, should they be the source for a requested item and therefore updating their working set accordingly to queue further crafting requests for unfulfilled stack requirements.
This commit is contained in:
@@ -51,10 +51,9 @@ import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -77,6 +76,7 @@ import appeng.core.sync.packets.PacketPartialItem;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
@@ -87,7 +87,7 @@ import appeng.util.item.AEItemStack;
|
||||
public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
private final InventoryPlayer invPlayer;
|
||||
private final BaseActionSource mySrc;
|
||||
private final IActionSource mySrc;
|
||||
private final HashSet<Integer> locked = new HashSet<>();
|
||||
private final TileEntity tileEntity;
|
||||
private final IPart part;
|
||||
@@ -280,7 +280,7 @@ public abstract class AEBaseContainer extends Container
|
||||
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSource()
|
||||
public IActionSource getActionSource()
|
||||
{
|
||||
return this.mySrc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user