Skip to content

Commit a3d66b9

Browse files
committed
Further API/documentation work
1 parent 56d9145 commit a3d66b9

File tree

6 files changed

+39
-12
lines changed

6 files changed

+39
-12
lines changed

src/main/java/gripe/_90/appliede/client/screen/TransmutationTerminalScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class TransmutationTerminalScreen<C extends TransmutationTerminalMenu> ex
3131

3232
public TransmutationTerminalScreen(C menu, Inventory playerInventory, Component title, ScreenStyle style) {
3333
super(menu, playerInventory, title, style);
34-
toggleShiftButton = new ToggleButton(Icon.ARROW_LEFT, Icon.ARROW_UP, menu::setShiftToTransmute);
34+
toggleShiftButton = new ToggleButton(Icon.ARROW_LEFT, Icon.ARROW_UP, b -> menu.toggleShiftToTransmute());
3535
toggleShiftButton.setTooltipOn(List.of(SHIFT_TRANSMUTING, TOGGLE_STORING));
3636
toggleShiftButton.setTooltipOff(List.of(SHIFT_STORING, TOGGLE_TRANSMUTING));
3737
widgets.add("toggleShiftToTransmute", toggleShiftButton);

src/main/java/gripe/_90/appliede/integration/ae2wtlib/WTTMenuHost.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public boolean getShiftToTransmute() {
3434
}
3535

3636
@Override
37-
public void setShiftToTransmute(boolean shift) {
38-
shiftToTransmute = shift;
37+
public void toggleShiftToTransmute() {
38+
shiftToTransmute = !shiftToTransmute;
3939
getItemStack().set(AppliedE.SHIFT_TO_TRANSMUTE.get(), shiftToTransmute);
4040
}
4141
}

src/main/java/gripe/_90/appliede/me/misc/TransmutationTerminalHost.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,32 @@
33
import appeng.api.networking.security.IActionHost;
44
import appeng.api.storage.ITerminalHost;
55

6+
/**
7+
* An extension of {@link ITerminalHost} for functionality specific to the {@linkplain
8+
* gripe._90.appliede.menu.TransmutationTerminalMenu Transmutation Terminal menu}.
9+
*/
610
public interface TransmutationTerminalHost extends ITerminalHost, IActionHost {
11+
/**
12+
* @return Whether "Shift to Transmute" mode is set for the menu, or in other words whether quick-moved
13+
* (Shift+Click) item stacks should be sent to the "transmutation" slot and turned to EMC rather than deposited to
14+
* the network's regular item storage.
15+
*/
716
boolean getShiftToTransmute();
817

9-
void setShiftToTransmute(boolean shift);
18+
/**
19+
* Toggles where quick-moved (Shift+Click) item stacks are sent within the Transmutation Terminal menu, i.e. whether
20+
* these should be directly transmuted to EMC or sent to the network's regular item storage.
21+
*/
22+
default void toggleShiftToTransmute() {
23+
setShiftToTransmute(getShiftToTransmute());
24+
}
25+
26+
/**
27+
* Sets whether quick-moved (Shift+Click) item stacks should be directly transmuted to EMC or sent to the network's
28+
* regular item storage.
29+
*
30+
* @deprecated Replaced by {@code toggleShiftToTransmute()}.
31+
*/
32+
@Deprecated(forRemoval = true)
33+
default void setShiftToTransmute(boolean shift) {}
1034
}

src/main/java/gripe/_90/appliede/me/service/KnowledgeService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.Set;
55
import java.util.UUID;
66

7+
import org.jetbrains.annotations.ApiStatus;
78
import org.jetbrains.annotations.Nullable;
89

910
import appeng.api.networking.IGridService;
@@ -19,9 +20,11 @@
1920
* implements {@link gripe._90.appliede.me.misc.TransmutationCapable TransmutationCapable} as the "action source" for
2021
* these operations to be able to transmute items into / out of EMC.
2122
*/
23+
@ApiStatus.NonExtendable
2224
public interface KnowledgeService extends IGridService {
2325
/**
24-
* @param uuid The UUID for a given player's Minecraft profile
26+
* @param uuid The UUID for a given player's Minecraft profile. Can be {@code null}, but the returned provider will
27+
* also be {@code null} as a result.
2528
* @return The {@link IKnowledgeProvider} for the (tracked) player with the given UUID (typically via player
2629
* {@linkplain net.neoforged.neoforge.capabilities.EntityCapability entity capabilities}), or {@code null} if the
2730
* UUID is not being tracked (i.e. the player with the given UUID does not have a Transmutation Module installed

src/main/java/gripe/_90/appliede/menu/TransmutationTerminalMenu.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TransmutationTerminalMenu extends MEStorageMenu implements Transmut
3535
protected static final SlotSemantic TRANSMUTE = SlotSemantics.register("APPLIEDE_TRANSMUTE", false);
3636
protected static final SlotSemantic UNLEARN = SlotSemantics.register("APPLIEDE_UNLEARN", false);
3737

38-
private static final String ACTION_SET_SHIFT = "setShiftDestination";
38+
private static final String ACTION_TOGGLE_SHIFT = "toggleShiftDestination";
3939
private static final String ACTION_HIDE_LEARNED = "hideLearnedText";
4040
private static final String ACTION_HIDE_UNLEARNED = "hideUnlearnedText";
4141

@@ -65,7 +65,7 @@ public TransmutationTerminalMenu(
6565
this.host = host;
6666
transmutationSource = IActionSource.ofPlayer(getPlayer(), this);
6767

68-
registerClientAction(ACTION_SET_SHIFT, Boolean.class, host::setShiftToTransmute);
68+
registerClientAction(ACTION_TOGGLE_SHIFT, host::toggleShiftToTransmute);
6969
registerClientAction(ACTION_HIDE_LEARNED, () -> learnedLabelTicks--);
7070
registerClientAction(ACTION_HIDE_UNLEARNED, () -> unlearnedLabelTicks--);
7171
addSlot(transmuteSlot, TRANSMUTE);
@@ -166,13 +166,13 @@ public void onLearn() {
166166
broadcastChanges();
167167
}
168168

169-
public void setShiftToTransmute(boolean transmute) {
169+
public void toggleShiftToTransmute() {
170170
if (isClientSide()) {
171-
sendClientAction(ACTION_SET_SHIFT, transmute);
171+
sendClientAction(ACTION_TOGGLE_SHIFT);
172172
return;
173173
}
174174

175-
shiftToTransmute = transmute;
175+
shiftToTransmute = !shiftToTransmute;
176176
}
177177

178178
public void decrementLearnedTicks() {

src/main/java/gripe/_90/appliede/part/TransmutationTerminalPart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public boolean getShiftToTransmute() {
3838
}
3939

4040
@Override
41-
public void setShiftToTransmute(boolean shift) {
42-
shiftToTransmute = shift;
41+
public void toggleShiftToTransmute() {
42+
shiftToTransmute = !shiftToTransmute;
4343
saveChanges();
4444
}
4545

0 commit comments

Comments
 (0)