Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void handleClick(PlatformView view) {
final ItemStack ingredientItem = requireNonNull(clickedInventory.getItem(INGREDIENT_SLOT));
final ItemMeta ingredientMeta = requireNonNull(ingredientItem.getItemMeta());
ingredientMeta.setDisplayName(text);
context.updateState(anvilInput.internalId(), text);
context.updateState(anvilInput, text);
ingredientItem.setItemMeta(ingredientMeta);

if (config.closeOnSelect) {
Expand Down Expand Up @@ -189,7 +189,7 @@ private void handleClose(PlatformView view) {
if (item == null || item.getType() == Material.AIR) return;

final String input = requireNonNull(item.getItemMeta()).getDisplayName();
context.updateState(anvilInput.internalId(), input);
context.updateState(anvilInput, input);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public interface StateValueHost {
* <p><b><i>This is an internal inventory-framework API that should not be used from outside of
* this library. No compatibility guarantees are provided.</i></b>
*
* @param id The state id.
* @param state The target state to update.
* @param value The new state value.
*/
@ApiStatus.Internal
void updateState(long id, Object value);
void updateState(State<?> state, Object value);

@ApiStatus.Internal
void watchState(long id, StateWatcher listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public void updated(@NotNull IFSlotRenderContext context) {
*/
private void simulateStateUpdate() {
debug("[Pagination] State update simulation triggered on %d", getState().internalId());
host.updateState(getState().internalId(), this);
host.updateState(getState(), this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public BaseMutableState(long id, StateValueFactory valueFactory) {

@Override
public final void set(T value, @NotNull StateValueHost host) {
host.updateState(internalId(), value);
host.updateState(this, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public void initializeState(long id, @NotNull StateValue value) {
}

@Override
public void updateState(long id, Object value) {
final StateValue stateValue = getUninitializedStateValue(id);
public void updateState(State<?> state, Object value) {
final StateValue stateValue = getInternalStateValue(state);
final Object oldValue = stateValue.get();
stateValue.set(value);

final Object newValue = stateValue.get();
IFDebug.debug("State %s updated (oldValue = %s, newValue = %s)", id, oldValue, newValue);
IFDebug.debug("State %s updated (oldValue = %s, newValue = %s)", state.internalId(), oldValue, newValue);
callListeners(stateValue, listener -> listener.stateValueSet(this, stateValue, oldValue, newValue));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public MutableGenericStateImpl(long id, @NotNull StateValueFactory valueFactory)

@Override
public void set(T value, @NotNull StateValueHost host) {
host.updateState(internalId(), value);
host.updateState(this, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public final StateValue getUninitializedStateValue(long stateId) {
}

@Override
public final void updateState(long id, Object value) {
getParent().updateState(id, value);
public final void updateState(State<?> state, Object value) {
getParent().updateState(state, value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public final void initializeState(long id, @NotNull StateValue value) {
}

@Override
public final void updateState(long id, Object value) {
getParent().updateState(id, value);
public final void updateState(State<?> state, Object value) {
getParent().updateState(state, value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ class CloseContext
override fun getUninitializedStateValue(stateId: Long): StateValue = getParent().getUninitializedStateValue(stateId)

override fun updateState(
id: Long,
state: State<*>,
value: Any,
) {
getParent().updateState(id, value)
getParent().updateState(state, value)
}

override fun toString(): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ abstract class SlotContext
}

override fun updateState(
id: Long,
state: State<*>,
value: Any,
) {
getParent().updateState(id, value)
getParent().updateState(state, value)
}

override fun watchState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class GlobalClickInterceptor : PipelineInterceptor<VirtualView> {

// inherit cancellation so we can un-cancel it
subject.isCancelled =
event.isCancelled ||
subject.config.isOptionSet(ViewConfig.CANCEL_ON_CLICK, true)
event.isCancelled || subject.config.isOptionSet(ViewConfig.CANCEL_ON_CLICK, true)
subject.root.onClick(subject)
}
}
Loading