Skip to content

Commit

Permalink
Switch to ChestTracker plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Protonull committed Oct 1, 2024
1 parent 68f92e6 commit ff06871
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/main/java/uk/protonull/civ/chesttracker/CivChestTracker.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package uk.protonull.civ.chesttracker;

import net.minecraft.client.gui.screens.inventory.BeaconScreen;
import net.minecraft.client.gui.screens.inventory.CartographyTableScreen;
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
import net.minecraft.client.gui.screens.inventory.EnchantmentScreen;
import net.minecraft.client.gui.screens.inventory.GrindstoneScreen;
import net.minecraft.client.gui.screens.inventory.ItemCombinerScreen;
import net.minecraft.client.gui.screens.inventory.LoomScreen;
import net.minecraft.client.gui.screens.inventory.StonecutterScreen;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import red.jackf.chesttracker.api.ChestTrackerPlugin;
import red.jackf.chesttracker.api.gui.ScreenBlacklist;
import red.jackf.chesttracker.api.providers.ProviderUtils;
import red.jackf.chesttracker.api.providers.ServerProvider;
import red.jackf.chesttracker.api.providers.context.ScreenCloseContext;
import red.jackf.chesttracker.api.providers.context.ScreenOpenContext;
import red.jackf.jackfredlib.client.api.gps.Coordinate;
import uk.protonull.civ.chesttracker.gui.screens.ContainerLocationDeciderScreen;

public final class CivChestTrackerPlugin implements ChestTrackerPlugin {
/**
* Pretty heavily based on {@link red.jackf.chesttracker.impl.DefaultChestTrackerPlugin}
*/
@Override
public void load() {
ScreenBlacklist.add(
// workstations with no item retention
CartographyTableScreen.class,
EnchantmentScreen.class,
GrindstoneScreen.class,
ItemCombinerScreen.class,
LoomScreen.class,
StonecutterScreen.class,
BeaconScreen.class,
// inventory (surv & creative)
EffectRenderingInventoryScreen.class
);

ProviderUtils.registerProvider(new Provider());

ContainerLocationDeciderScreen.setupPickerRendering();
}

private static final class Provider extends ServerProvider {
@Override
public ResourceLocation id() {
return ResourceLocation.fromNamespaceAndPath("civchesttracker", "provider");
}

@Override
public boolean appliesTo(
final @NotNull Coordinate coordinate
) {
return true; // Apply to singleplayer, multiplayer, etc
}

@Override
public void onScreenOpen(
final @NotNull ScreenOpenContext context
) {

}

@Override
public void onScreenClose(
final ScreenCloseContext context
) {

}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"icon": "assets/civchesttracker/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"uk.protonull.civ.chesttracker.CivChestTracker::bootstrap"
"chesttracker": [
"uk.protonull.civ.chesttracker.CivChestTrackerPlugin"
],
"modmenu": [
"red.jackf.chesttracker.impl.compat.mods.ChestTrackerModMenu"
Expand Down

0 comments on commit ff06871

Please sign in to comment.