Update EMI

This commit is contained in:
Sollace 2023-09-02 22:18:49 +01:00
parent 27f33fe9c4
commit 3c62db0268
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 11 additions and 16 deletions

View file

@ -29,5 +29,5 @@ org.gradle.daemon=false
terraformer_api_version=7.0.0-beta.1
# TMI Testing
tmi_type=none
emi_version=1.0.0+1.19.3
tmi_type=emi
emi_version=1.0.19+1.20.1

View file

@ -10,8 +10,9 @@ import dev.emi.emi.EmiRenderHelper;
import dev.emi.emi.api.stack.EmiIngredient;
import dev.emi.emi.api.stack.EmiStack;
import dev.emi.emi.api.stack.ListEmiIngredient;
import dev.emi.emi.runtime.EmiDrawContext;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.ItemStack;
public class SpellDuplicatingEmiRecipe extends SpellbookEmiRecipe {
@ -42,10 +43,10 @@ public class SpellDuplicatingEmiRecipe extends SpellbookEmiRecipe {
}
@Override
public void render(MatrixStack matrices, int x, int y, float delta, int flags) {
public void render(DrawContext context, int x, int y, float delta, int flags) {
if (maxCount < 2 || MinecraftClient.getInstance().player == null) {
super.render(matrices, x, y, delta, flags);
super.render(context, x, y, delta, flags);
} else {
int tick = (MinecraftClient.getInstance().player.age / 12) % maxCount;
if ((flags & RENDER_AMOUNT) != 0) {
@ -53,9 +54,9 @@ public class SpellDuplicatingEmiRecipe extends SpellbookEmiRecipe {
if (getAmount() != 1) {
count += getAmount();
}
EmiRenderHelper.renderAmount(matrices, x, y, EmiPort.literal(count));
EmiRenderHelper.renderAmount(EmiDrawContext.wrap(context), x, y, EmiPort.literal(count));
}
ingredients.get(tick).render(matrices, x, y, delta, flags & ~RENDER_AMOUNT);
ingredients.get(tick).render(context, x, y, delta, flags & ~RENDER_AMOUNT);
}
}
}

View file

@ -16,7 +16,6 @@ import dev.emi.emi.api.stack.EmiStack;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
@ -79,7 +78,7 @@ public class TraitEmiStack extends EmiStack {
return trait.getName();
}
//@Override
@Override
public void render(DrawContext context, int x, int y, float delta, int flags) {
if ((flags & RENDER_ICON) != 0) {
List<Item> knownItems = trait.getItems();
@ -88,21 +87,16 @@ public class TraitEmiStack extends EmiStack {
} else {
int tick = (MinecraftClient.getInstance().player.age / 12) % knownItems.size();
ItemStack stack = knownItems.get(tick).getDefaultStack();
EmiStack.of(stack).render(context.getMatrices(), x, y, delta, flags);
EmiStack.of(stack).render(context, x, y, delta, flags);
ItemTraitsTooltipRenderer.renderStackTraits(traits, context, x, y, 1, delta, 0, true);
}
}
if ((flags & RENDER_REMAINDER) != 0) {
EmiRender.renderRemainderIcon(this, context.getMatrices(), x, y);
EmiRender.renderRemainderIcon(this, context, x, y);
}
}
//@Override
public void render(MatrixStack matrices, int x, int y, float delta, int flags) {
}
@Override
public EmiStack copy() {
return new TraitEmiStack(trait, amount);