Port to 1.21
This commit is contained in:
@@ -30,21 +30,21 @@ import java.util.function.BiFunction;
|
||||
public abstract class CustomModelBakerPatch {
|
||||
|
||||
@Shadow
|
||||
protected abstract void addModel(ModelIdentifier modelId);
|
||||
protected abstract void loadItemModel(ModelIdentifier id);
|
||||
|
||||
@Shadow
|
||||
abstract UnbakedModel getOrLoadModel(Identifier id);
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Identifier, UnbakedModel> modelsToBake;
|
||||
|
||||
@Shadow
|
||||
public abstract UnbakedModel getOrLoadModel(Identifier id);
|
||||
private Map<ModelIdentifier, UnbakedModel> modelsToBake;
|
||||
|
||||
@Inject(method = "bake", at = @At("HEAD"))
|
||||
public void onBake(BiFunction<Identifier, SpriteIdentifier, Sprite> spriteLoader, CallbackInfo ci) {
|
||||
BakeExtraModelsEvent.Companion.publish(new BakeExtraModelsEvent(this::addModel));
|
||||
public void onBake(ModelLoader.SpriteGetter spliteGetter, CallbackInfo ci) {
|
||||
BakeExtraModelsEvent.Companion.publish(new BakeExtraModelsEvent(this::loadItemModel));
|
||||
modelsToBake.values().forEach(model -> model.setParents(this::getOrLoadModel));
|
||||
modelsToBake.keySet().stream()
|
||||
.filter(it -> !it.getNamespace().equals("minecraft"))
|
||||
.forEach(it -> System.out.println("Non minecraft texture is being loaded: " + it));
|
||||
// modelsToBake.keySet().stream()
|
||||
// .filter(it -> !it.id().getNamespace().equals("minecraft"))
|
||||
// .forEach(it -> System.out.println("Non minecraft texture is being loaded: " + it));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import moe.nea.firmament.events.HotbarItemRenderEvent;
|
||||
import moe.nea.firmament.events.HudRenderEvent;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -21,13 +22,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(InGameHud.class)
|
||||
public class HudRenderEventsPatch {
|
||||
@Inject(method = "renderSleepOverlay", at = @At(value = "HEAD"))
|
||||
public void renderCallBack(DrawContext context, float tickDelta, CallbackInfo ci) {
|
||||
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickDelta));
|
||||
public void renderCallBack(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
|
||||
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickCounter));
|
||||
}
|
||||
|
||||
@Inject(method = "renderHotbarItem", at = @At("HEAD"))
|
||||
public void onRenderHotbarItem(DrawContext context, int x, int y, float tickDelta, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
|
||||
public void onRenderHotbarItem(DrawContext context, int x, int y, RenderTickCounter tickCounter, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
|
||||
if (stack != null && !stack.isEmpty())
|
||||
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickDelta));
|
||||
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickCounter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.llamalad7.mixinextras.sugar.Local;
|
||||
import moe.nea.firmament.events.WorldRenderLastEvent;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.world.tick.TickManager;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -26,10 +27,13 @@ public class WorldRenderLastEventPatch {
|
||||
private BufferBuilderStorage bufferBuilders;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.BEFORE))
|
||||
public void onWorldRenderLast(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci
|
||||
, @Local MatrixStack matrixStack) {
|
||||
public void onWorldRenderLast(
|
||||
RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer,
|
||||
LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2,
|
||||
CallbackInfo ci, @Local MatrixStack matrixStack
|
||||
) {
|
||||
var event = new WorldRenderLastEvent(
|
||||
matrixStack, tickDelta, renderBlockOutline,
|
||||
matrixStack, tickCounter, renderBlockOutline,
|
||||
camera, gameRenderer, lightmapTextureManager,
|
||||
this.bufferBuilders.getEntityVertexConsumers()
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
package moe.nea.firmament.mixins.accessor;
|
||||
|
||||
import kotlin.Deprecated;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
Reference in New Issue
Block a user