fix AltioraLayer addLayer by removing mixin.

This commit is contained in:
Talia-12 2023-07-10 21:40:34 +10:00
parent 77aa0e7380
commit c8004cc7a4
6 changed files with 25 additions and 40 deletions

View file

@ -56,11 +56,14 @@ public record MsgOpenSpellGuiS2C(InteractionHand hand, List<ResolvedPattern> pat
} }
public static void handle(MsgOpenSpellGuiS2C msg) { public static void handle(MsgOpenSpellGuiS2C msg) {
Minecraft.getInstance().execute(() -> { Minecraft.getInstance().execute(new Runnable() {
@Override
public void run() {
var mc = Minecraft.getInstance(); var mc = Minecraft.getInstance();
mc.setScreen( mc.setScreen(
new GuiSpellcasting(msg.hand(), msg.patterns(), msg.stack, msg.ravenmind, new GuiSpellcasting(msg.hand(), msg.patterns(), msg.stack, msg.ravenmind,
msg.parenCount)); msg.parenCount));
}
}); });
} }
} }

View file

@ -1,31 +0,0 @@
package at.petrak.hexcasting.mixin.client;
import at.petrak.hexcasting.client.model.AltioraLayer;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// Mixin is the approach Ears uses
// granted, Ears isn't exactly the paragon of "how to make your average minecraft mod" but still
// IDK another way to do it
@Mixin(PlayerRenderer.class)
public abstract class MixinPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer,
PlayerModel<AbstractClientPlayer>> {
public MixinPlayerRenderer(EntityRendererProvider.Context $$0, PlayerModel<AbstractClientPlayer> $$1, float $$2) {
super($$0, $$1, $$2);
}
@Inject(
method = "<init>",
at = @At("TAIL")
)
private void hex$init(EntityRendererProvider.Context erp, boolean slimModel, CallbackInfo ci) {
this.addLayer(new AltioraLayer<>(this, erp.getModelSet()));
}
}

View file

@ -26,7 +26,6 @@
"accessor.client.AccessorMouseHandler", "accessor.client.AccessorMouseHandler",
"accessor.client.AccessorRenderStateShard", "accessor.client.AccessorRenderStateShard",
"accessor.client.AccessorRenderType", "accessor.client.AccessorRenderType",
"client.MixinClientLevel", "client.MixinClientLevel"
"client.MixinPlayerRenderer"
] ]
} }

View file

@ -32,10 +32,10 @@ public class HexFabricDataGenerators implements DataGeneratorEntrypoint {
HexAPI.LOGGER.info("Starting Fabric-specific datagen"); HexAPI.LOGGER.info("Starting Fabric-specific datagen");
var pack = gen.createPack(); var pack = gen.createPack();
var xtags = IXplatAbstractions.INSTANCE.tags();
pack.addProvider((FabricDataGenerator.Pack.Factory<HexplatRecipes>) x -> new HexplatRecipes(x, INGREDIENTS, HexFabricConditionsBuilder::new)); pack.addProvider((FabricDataGenerator.Pack.Factory<HexplatRecipes>) x -> new HexplatRecipes(x, INGREDIENTS, HexFabricConditionsBuilder::new));
var xtags = IXplatAbstractions.INSTANCE.tags();
var btagProviderWrapper = new BlockTagProviderWrapper(); // CURSED var btagProviderWrapper = new BlockTagProviderWrapper(); // CURSED
pack.addProvider((output, lookup) -> { pack.addProvider((output, lookup) -> {
btagProviderWrapper.provider = new HexBlockTagProvider(output, lookup, xtags); btagProviderWrapper.provider = new HexBlockTagProvider(output, lookup, xtags);

View file

@ -1,4 +1,4 @@
forgeVersion=47.0.1 forgeVersion=47.0.3
kotlinForForgeVersion=4.3.0 kotlinForForgeVersion=4.3.0

View file

@ -4,6 +4,7 @@ import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.client.RegisterClientStuff; import at.petrak.hexcasting.client.RegisterClientStuff;
import at.petrak.hexcasting.client.ShiftScrollListener; import at.petrak.hexcasting.client.ShiftScrollListener;
import at.petrak.hexcasting.client.gui.PatternTooltipComponent; import at.petrak.hexcasting.client.gui.PatternTooltipComponent;
import at.petrak.hexcasting.client.model.AltioraLayer;
import at.petrak.hexcasting.client.model.HexModelLayers; import at.petrak.hexcasting.client.model.HexModelLayers;
import at.petrak.hexcasting.client.render.HexAdditionalRenderers; import at.petrak.hexcasting.client.render.HexAdditionalRenderers;
import at.petrak.hexcasting.client.render.shader.HexShaders; import at.petrak.hexcasting.client.render.shader.HexShaders;
@ -14,8 +15,12 @@ import at.petrak.hexcasting.interop.HexInterop;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.color.item.ItemColors;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.*;
@ -122,4 +127,13 @@ public class ForgeHexClientInitializer {
public static void registerEntityLayers(EntityRenderersEvent.RegisterLayerDefinitions evt) { public static void registerEntityLayers(EntityRenderersEvent.RegisterLayerDefinitions evt) {
HexModelLayers.init(evt::registerLayerDefinition); HexModelLayers.init(evt::registerLayerDefinition);
} }
@SubscribeEvent
public static void addPlayerLayers(EntityRenderersEvent.AddLayers evt) {
evt.getSkins().forEach(skinName -> {
var skin = (LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>>) evt.getSkin(skinName);
skin.addLayer(new AltioraLayer<>(skin, evt.getEntityModels()));
});
}
} }