Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ org.gradle.caching=true
# Dependencies
cyclopscore_version=1.29.1-1018
integrateddynamics_version=1.33.2-1845
integratedterminals_version=1.6.28-736
integratedterminals_version=1.8.0-917
commoncapabilities_version=2.11.4-329
curios_version=7.3.4+1.20.4
jei_version=1.21-neoforge:19.5.0.31
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import org.cyclops.cyclopscore.network.PacketCodec;
import org.cyclops.integratedterminalscompat.Reference;
import org.cyclops.integratedterminalscompat.client.gui.toast.CraftingJobToast;
import org.cyclops.integratedterminals.client.gui.toast.CraftingJobToast;

import java.util.List;

Expand Down Expand Up @@ -93,13 +94,13 @@ private static MutableComponent joinIngredients(List<String> names) {
@Override
@OnlyIn(Dist.CLIENT)
public void actionClient(Level world, Player player) {
CraftingJobToast.Type toastType;
ToastType toastType;
ItemStack icon;
Component title;
Component subtitle;

if (failedIngredientNames.isEmpty()) {
toastType = CraftingJobToast.Type.SUCCESS;
toastType = ToastType.SUCCESS;
icon = new ItemStack(Items.CRAFTING_TABLE);
title = Component.translatable(
"gui.integratedterminalscompat.terminal_storage.crafting_job.summary.title.started_only")
Expand All @@ -108,7 +109,7 @@ public void actionClient(Level world, Player player) {
"gui.integratedterminalscompat.terminal_storage.crafting_job.summary.started_only",
joinIngredients(startedIngredientNames));
} else if (startedIngredientNames.isEmpty()) {
toastType = CraftingJobToast.Type.FAILURE;
toastType = ToastType.FAILURE;
icon = new ItemStack(Items.BARRIER);
title = Component.translatable(
"gui.integratedterminalscompat.terminal_storage.crafting_job.summary.title.failed_only")
Expand All @@ -117,7 +118,7 @@ public void actionClient(Level world, Player player) {
"gui.integratedterminalscompat.terminal_storage.crafting_job.summary.failed_only",
joinIngredients(failedIngredientNames));
} else {
toastType = CraftingJobToast.Type.MIXED;
toastType = ToastType.MIXED;
icon = new ItemStack(Items.BELL);
title = Component.translatable(
"gui.integratedterminalscompat.terminal_storage.crafting_job.summary.title.mixed")
Expand All @@ -130,11 +131,13 @@ public void actionClient(Level world, Player player) {

// Update an existing visible toast of the same type, or add a new one
var toastManager = Minecraft.getInstance().getToasts();
CraftingJobToast existing = toastManager.getToast(CraftingJobToast.class, toastType);
CraftingJobToast<ItemStack, Integer> existing = (CraftingJobToast<ItemStack, Integer>)
toastManager.getToast(CraftingJobToast.class, toastType);
if (existing != null) {
existing.reset(title, subtitle);
existing.reset(icon, title, subtitle);
} else {
toastManager.addToast(new CraftingJobToast(toastType, icon, title, subtitle));
toastManager.addToast(new CraftingJobToast<>(toastType, IngredientComponent.ITEMSTACK, icon,
title, subtitle));
}
}

Expand All @@ -143,4 +146,11 @@ public void actionServer(Level world, ServerPlayer player) {
// Server-to-client only packet
}

/**
* The toast slot that a summary is shown in, so that summaries of the same kind replace each other.
*/
private enum ToastType {
SUCCESS, FAILURE, MIXED
}

}
Binary file not shown.

This file was deleted.

Loading