aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-04-12 21:30:18 +0800
committershedaniel <daniel@shedaniel.me>2021-04-12 21:30:18 +0800
commit5467c2f08da6f3c6dae7ae603e3708d4f6eb1638 (patch)
treecd923542890f062bf270b51e586270795ca9c260 /runtime/src/main
parent513347f841a401391f59b4c9fe3cbcb4f554f86d (diff)
downloadRoughlyEnoughItems-5467c2f08da6f3c6dae7ae603e3708d4f6eb1638.tar.gz
RoughlyEnoughItems-5467c2f08da6f3c6dae7ae603e3708d4f6eb1638.tar.bz2
RoughlyEnoughItems-5467c2f08da6f3c6dae7ae603e3708d4f6eb1638.zip
Fix #502 and Fix #499
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java7
4 files changed, 11 insertions, 6 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java
index 3fac9255f..f2acf7bdc 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java
@@ -67,7 +67,7 @@ public class CategoryRegistryImpl implements CategoryRegistry {
}
@Override
- public <T extends Display> void register(DisplayCategory<T> category, Consumer<CategoryConfiguration<T>> configurator) {
+ public <T extends Display> void add(DisplayCategory<T> category, Consumer<CategoryConfiguration<T>> configurator) {
Configuration<T> configuration = new Configuration<>(category);
this.categories.put(category.getCategoryIdentifier(), configuration);
configurator.accept(configuration);
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java
index 04f44839f..c08e2ac38 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java
@@ -65,7 +65,7 @@ public class DisplayRegistryImpl extends RecipeManagerContextImpl<REIClientPlugi
}
@Override
- public void registerDisplay(Display display) {
+ public void add(Display display) {
displays.computeIfAbsent(display.getCategoryIdentifier(), location -> new ArrayList<>())
.add(display);
displayCount.increment();
@@ -78,7 +78,7 @@ public class DisplayRegistryImpl extends RecipeManagerContextImpl<REIClientPlugi
}
@Override
- public Map<CategoryIdentifier<?>, List<Display>> getAllDisplays() {
+ public Map<CategoryIdentifier<?>, List<Display>> getAll() {
return Collections.unmodifiableMap(displays);
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
index fe0fd0453..31a667a34 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
@@ -60,7 +60,7 @@ public class ViewsImpl implements Views {
for (CategoryRegistry.CategoryConfiguration<?> categoryConfiguration : CategoryRegistry.getInstance()) {
DisplayCategory<?> category = categoryConfiguration.getCategory();
CategoryIdentifier<?> categoryId = categoryConfiguration.getCategoryIdentifier();
- List<Display> allRecipesFromCategory = DisplayRegistry.getInstance().getDisplays((CategoryIdentifier<Display>) categoryId);
+ List<Display> allRecipesFromCategory = DisplayRegistry.getInstance().get((CategoryIdentifier<Display>) categoryId);
Set<Display> set = Sets.newLinkedHashSet();
if (categories.contains(categoryId)) {
@@ -184,7 +184,7 @@ public class ViewsImpl implements Views {
@Override
public Collection<EntryStack<?>> findCraftableEntriesByMaterials(Iterable<? extends EntryStack<?>> inventoryItems) {
Set<EntryStack<?>> craftables = new HashSet<>();
- for (List<Display> displays : DisplayRegistry.getInstance().getAllDisplays().values()) {
+ for (List<Display> displays : DisplayRegistry.getInstance().getAll().values()) {
for (Display display : displays) {
int slotsCraftable = 0;
List<EntryIngredient> requiredInput = display.getRequiredEntries();
diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java
index eadb3f947..9344eb9e8 100644
--- a/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java
+++ b/runtime/src/main/java/me/shedaniel/rei/plugin/client/entry/FluidEntryDefinition.java
@@ -212,7 +212,7 @@ public class FluidEntryDefinition implements EntryDefinition<FluidStack>, EntryS
List<Component> toolTip = Lists.newArrayList(entry.asFormattedText());
Fraction amount = entry.getValue().getAmount();
if (!amount.isLessThan(Fraction.zero())) {
- String amountTooltip = I18n.get(FLUID_AMOUNT, EntryStacks.simplifyAmount(entry).getValue().getAmount());
+ String amountTooltip = I18n.get(FLUID_AMOUNT, simplifyAmount(entry).getValue().getAmount());
if (amountTooltip != null) {
toolTip.addAll(Stream.of(amountTooltip.split("\n")).map(TextComponent::new).collect(Collectors.toList()));
}
@@ -224,4 +224,9 @@ public class FluidEntryDefinition implements EntryDefinition<FluidStack>, EntryS
return Tooltip.create(toolTip);
}
}
+
+ public static EntryStack<FluidStack> simplifyAmount(EntryStack<FluidStack> stack) {
+ stack.getValue().setAmount(stack.getValue().getAmount().simplify());
+ return stack;
+ }
}