Cleanup counter command (#1695)

- Import `Commands.literal`
- Use more readable syntax for Brigadier command
- Use `DyeColor` directly instead of toString -> fromString everywhere
  - Also updates `WoolTool` to use the new `HopperCounter` getter that supports it
- Split `resetCounter` in two, one for single and one for all

Also: HopperCounter now uses `.overworld()` and its `//OW` comments are removed
This commit is contained in:
altrisi authored and GitHub committed 2023-04-08 20:14:26 +02:00
1 parent 8cd60db5e4
commit 51f213fa15
3 files changed
+43 -48

No files matched your search

+3 -5
View File
@@ -107,9 +107,8 @@ public class WoolTool
{
DyeColor under = getWoolColorAtPosition(worldIn, pos.below());
if (under == null) return;
HopperCounter counter = HopperCounter.getCounter(under.toString());
if (counter != null)
Messenger.send(placer, counter.format(worldIn.getServer(), false, false));
HopperCounter counter = HopperCounter.getCounter(under);
Messenger.send(placer, counter.format(worldIn.getServer(), false, false));
}
break;
case RED:
@@ -117,8 +116,7 @@ public class WoolTool
{
DyeColor under = getWoolColorAtPosition(worldIn, pos.below());
if (under == null) return;
HopperCounter counter = HopperCounter.getCounter(under.toString());
if (counter == null) return;
HopperCounter counter = HopperCounter.getCounter(under);
counter.reset(placer.getServer());
List<Component> res = new ArrayList<>();
res.add(Messenger.s(String.format("%s counter reset",under.toString())));