Fixing small issues (#717)

* adding unix_time and convert_dat eto editor autocomplete

I never used it, and only realised rn when I needed it.

* updating npp docs too

* Fixes #690

Fixes #690

* Fixes #687

Fixes #687

* fixes #672

* adding comma to make it look gooder

* Update src/main/java/carpet/helpers/HopperCounter.java

* using alias to shorten code

* compacting wool code

* Fixing minor todos

* removing hit/hand garbage

* removing scoreboards garbage

* making sure I dont edit file accidentally

* fixing borken code and problem with pink and magenta showing same colour

* Change name of mod to, you know, actually be the name of the mod

* Reverting previous change because it is more descriptive of the actual mod

* Update src/main/java/carpet/script/api/WorldAccess.java

Co-authored-by: Ghoulboy78 <ghoulboy78@gmail.com>
Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2021-04-14 22:47:14 -03:00
1 parent eff3a1734e
commit b7252a3465
3 files changed
+33 -10

No files matched your search

+12 -10
View File
@@ -1,5 +1,6 @@
package carpet.helpers;
import carpet.utils.WoolTool;
import carpet.utils.Messenger;
import com.google.common.collect.Maps;
import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
@@ -35,6 +36,7 @@ public class HopperCounter
}
public final DyeColor color;
private final String prettyColour;
private final Object2LongMap<Item> counter = new Object2LongLinkedOpenHashMap<>();
private long startTick;
private long startMillis;
@@ -43,7 +45,7 @@ public class HopperCounter
private HopperCounter(DyeColor color)
{
this.color = color;
// pubSubProvider = new PubSubInfoProvider<>(QuickCarpet.PUBSUB, "carpet.counter." + color.getName(), 0, this::getTotalItems);
this.prettyColour = WoolTool.Material2DyeName.getOrDefault(color.getMaterialColor(),"w ") + color.getName();
}
public void add(MinecraftServer server, ItemStack stack)
@@ -100,9 +102,9 @@ public class HopperCounter
{
if (brief)
{
return Collections.singletonList(Messenger.c("g "+color+": -, -/h, - min "));
return Collections.singletonList(Messenger.c("g ", prettyColour,"w : -, -/h, - min "));
}
return Collections.singletonList(Messenger.s(String.format("No items for %s yet", color.getName())));
return Collections.singletonList(Messenger.c("w No items for ", prettyColour, "w yet"));
}
long total = getTotalItems();
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getWorld(World.OVERWORLD).getTime() - startTick, 1); //OW
@@ -110,20 +112,20 @@ public class HopperCounter
{
if (brief)
{
return Collections.singletonList(Messenger.c(String.format("c %s: 0, 0/h, %.1f min ", color, ticks / (20.0 * 60.0))));
return Collections.singletonList(Messenger.c(prettyColour,String.format("c : 0, 0/h, %.1f min ", ticks / (20.0 * 60.0))));
}
return Collections.singletonList(Messenger.c(String.format("w No items for %s yet (%.2f min.%s)",
color.getName(), ticks / (20.0 * 60.0), (realTime ? " - real time" : "")),
return Collections.singletonList(Messenger.c("w No items for ", prettyColour, String.format("w yet (%.2f min.%s)",
ticks / (20.0 * 60.0), (realTime ? " - real time" : "")),
"nb [X]", "^g reset", "!/counter " + color.getName() +" reset"));
}
if (brief)
{
return Collections.singletonList(Messenger.c(String.format("c %s: %d, %d/h, %.1f min ",
color.getName(), total, total * (20 * 60 * 60) / ticks, ticks / (20.0 * 60.0))));
return Collections.singletonList(Messenger.c(prettyColour,String.format("c : %d, %d/h, %.1f min ",
total, total * (20 * 60 * 60) / ticks, ticks / (20.0 * 60.0))));
}
List<BaseText> items = new ArrayList<>();
items.add(Messenger.c(String.format("w Items for %s (%.2f min.%s), total: %d, (%.1f/h):",
color, ticks*1.0/(20*60), (realTime?" - real time":""), total, total*1.0*(20*60*60)/ticks),
items.add(Messenger.c("w Items for ", prettyColour, String.format("w (%.2f min.%s), total: %d, (%.1f/h):",
ticks*1.0/(20*60), (realTime?" - real time":""), total, total*1.0*(20*60*60)/ticks),
"nb [X]", "^g reset", "!/counter "+color+" reset"
));
items.addAll(counter.object2LongEntrySet().stream().sorted((e, f) -> Long.compare(f.getLongValue(), e.getLongValue())).map(e ->
+20
View File
@@ -21,6 +21,26 @@ import java.util.List;
public class WoolTool
{
private static final HashMap<MaterialColor,DyeColor> Material2Dye = new HashMap<>();
public static final HashMap<MaterialColor,String> Material2DyeName = new HashMap<MaterialColor, String>(){{
put(MaterialColor.WHITE, "w ");
put(MaterialColor.ORANGE, "#F9801D ");
put(MaterialColor.MAGENTA, "m ");
put(MaterialColor.LIGHT_BLUE, "t ");
put(MaterialColor.YELLOW, "y ");
put(MaterialColor.LAPIS, "l ");
put(MaterialColor.PINK, "#FFACCB ");
put(MaterialColor.GRAY, "f ");
put(MaterialColor.LIGHT_GRAY, "g ");
put(MaterialColor.CYAN, "c ");
put(MaterialColor.PURPLE, "p ");
put(MaterialColor.BLUE, "v ");
put(MaterialColor.BROWN, "#835432 ");
put(MaterialColor.GREEN, "e ");
put(MaterialColor.RED, "r ");
put(MaterialColor.BLACK, "k ");
}};
static
{
for (DyeColor color: DyeColor.values())