-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
277 additions
and
218 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
22 changes: 0 additions & 22 deletions
22
src/main/java/uk/protonull/civ/chesttracker/gui/widgets/ForgetContainerButton.java
This file was deleted.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
src/main/java/uk/protonull/civ/chesttracker/gui/widgets/OpenedInventoryButtons.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package uk.protonull.civ.chesttracker.gui.widgets; | ||
|
||
import com.google.common.util.concurrent.Runnables; | ||
import java.util.function.Consumer; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.components.WidgetSprites; | ||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.jetbrains.annotations.NotNull; | ||
import red.jackf.chesttracker.api.providers.MemoryLocation; | ||
import red.jackf.chesttracker.impl.gui.invbutton.ui.SecondaryButton; | ||
import red.jackf.chesttracker.impl.gui.screen.MemoryBankManagerScreen; | ||
import red.jackf.chesttracker.impl.memory.MemoryBankImpl; | ||
import red.jackf.chesttracker.impl.util.GuiUtil; | ||
import uk.protonull.civ.chesttracker.CivChestTrackerPlugin; | ||
import uk.protonull.civ.chesttracker.gui.screens.ContainerLocationDeciderScreen; | ||
import uk.protonull.civ.chesttracker.utilities.Shortcuts; | ||
|
||
public final class OpenedInventoryButtons { | ||
public static final SecondaryButton BLACKLISTED = new SecondaryButton( | ||
new WidgetSprites( | ||
ResourceLocation.fromNamespaceAndPath(CivChestTrackerPlugin.ID, "cannot"), | ||
ResourceLocation.fromNamespaceAndPath(CivChestTrackerPlugin.ID, "cannot_highlighted") | ||
), | ||
Component.translatable("civchesttracker.inventoryButton.blacklisted"), | ||
Runnables.doNothing() | ||
); | ||
|
||
public static final class NoMemoryBank extends SecondaryButton { | ||
private static final WidgetSprites SPRITES = new WidgetSprites( | ||
ResourceLocation.fromNamespaceAndPath(CivChestTrackerPlugin.ID, "unknown"), | ||
ResourceLocation.fromNamespaceAndPath(CivChestTrackerPlugin.ID, "unknown_highlighted") | ||
); | ||
public NoMemoryBank( | ||
final @NotNull AbstractContainerScreen<?> parent | ||
) { | ||
super( | ||
SPRITES, | ||
Component.translatable("civchesttracker.inventoryButton.nomemorybank"), | ||
() -> Minecraft.getInstance().setScreen(new MemoryBankManagerScreen(parent, Runnables.doNothing())) | ||
); | ||
} | ||
} | ||
|
||
public static final class ForgetContainer extends SecondaryButton { | ||
private static final WidgetSprites SPRITES = GuiUtil.twoSprite("inventory_button/forget"); | ||
public ForgetContainer( | ||
final @NotNull AbstractContainerScreen<?> parent, | ||
final @NotNull MemoryBankImpl serverStorage, | ||
final @NotNull MemoryLocation target | ||
) { | ||
super( | ||
SPRITES, | ||
Component.translatable("civchesttracker.inventoryButton.forgetcontainer"), | ||
() -> { | ||
serverStorage.removeMemory(target.memoryKey(), target.position()); | ||
Shortcuts.forciblyRefreshScreen(parent); | ||
} | ||
); | ||
} | ||
} | ||
|
||
public static final class TrackContainer extends SecondaryButton { | ||
private static final WidgetSprites SPRITES = GuiUtil.twoSprite("inventory_button/remember_container/never"); | ||
public TrackContainer( | ||
final @NotNull AbstractContainerScreen<?> parent, | ||
final @NotNull Consumer<@NotNull BlockPos> setInventoryLocation | ||
) { | ||
super( | ||
SPRITES, | ||
Component.translatable("civchesttracker.inventoryButton.trackcontainer"), | ||
() -> Minecraft.getInstance().setScreen(new ContainerLocationDeciderScreen( | ||
parent, | ||
setInventoryLocation | ||
)) | ||
); | ||
} | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
src/main/java/uk/protonull/civ/chesttracker/gui/widgets/TrackContainerButton.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/protonull/civ/chesttracker/mixing/InventoryWindow.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
package uk.protonull.civ.chesttracker.mixing; | ||
|
||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import red.jackf.chesttracker.api.providers.MemoryLocation; | ||
|
||
public interface InventoryWindow { | ||
@NotNull LocalPlayer civchesttracker$getPlayer(); | ||
|
||
@Nullable MemoryLocation civchesttracker$getInventoryIdentifier(); | ||
|
||
void civchesttracker$setInventoryIdentifier( | ||
MemoryLocation inventoryIdentifier | ||
); | ||
|
||
static @NotNull LocalPlayer getPlayer( | ||
final @NotNull AbstractContainerScreen<?> screen | ||
) { | ||
return ((InventoryWindow) screen).civchesttracker$getPlayer(); | ||
} | ||
|
||
static @Nullable MemoryLocation getIdentifier( | ||
final @NotNull AbstractContainerScreen<?> screen | ||
) { | ||
return ((InventoryWindow) screen).civchesttracker$getInventoryIdentifier(); | ||
} | ||
|
||
static void setIdentifier( | ||
final @NotNull AbstractContainerScreen<?> screen, | ||
final MemoryLocation inventoryIdentifier | ||
) { | ||
((InventoryWindow) screen).civchesttracker$setInventoryIdentifier(inventoryIdentifier); | ||
} | ||
} |
Oops, something went wrong.