21w05b -> 21w11a

This commit is contained in:
Sollace 2021-03-27 22:54:16 +02:00
parent 99ed7699a1
commit e5fc54c49f
11 changed files with 64 additions and 61 deletions

View file

@ -36,6 +36,7 @@ archivesBaseName = project.name
minecraft { minecraft {
refmapName = 'minelp.mixin.refmap.json' refmapName = 'minelp.mixin.refmap.json'
accessWidener 'src/main/resources/minelp.aw'
} }
repositories { repositories {

View file

@ -3,10 +3,10 @@ org.gradle.daemon=false
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=21w05b minecraft_version=21w11a
yarn_mappings=21w05b+build.5 yarn_mappings=21w11a+build.29
loader_version=0.11.1 loader_version=0.11.3
fabric_version=0.30.1+1.17 fabric_version=0.32.5+1.17
# Mod Properties # Mod Properties
group=com.minelittlepony group=com.minelittlepony
@ -18,6 +18,6 @@ org.gradle.daemon=false
# Dependencies # Dependencies
modmenu_version=1.15.+ modmenu_version=1.15.+
kirin_version=1.8-21w05b-SNAPSHOT kirin_version=1.8-21w11a-SNAPSHOT
hd_skins_version=6.4-21w05b-SNAPSHOT hd_skins_version=6.4.1-21w11a-SNAPSHOT
mson_version=1.3.2-21w05b-SNAPSHOT mson_version=1.3.2-21w11a-SNAPSHOT

View file

@ -1,27 +1,32 @@
package com.minelittlepony.client.mixin; package com.minelittlepony.client.mixin;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.ServerPlayPacketListener;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.minelittlepony.client.HorseCam; import com.minelittlepony.client.HorseCam;
@Mixin(PlayerMoveC2SPacket.Both.class) @Mixin(PlayerMoveC2SPacket.class)
abstract class MixinPlayerMoveC2SPacket extends PlayerMoveC2SPacket { abstract class MixinPlayerMoveC2SPacket implements Packet<ServerPlayPacketListener> {
@Inject(method = "<init>(DDDFFZ)V", @Shadow @Final @Mutable
protected float pitch;
@Shadow @Final
protected boolean changeLook;
@Inject(method = "<init>(DDDFFZZZ)V",
at = @At("RETURN")) at = @At("RETURN"))
private void onInit(CallbackInfo info) { private void onInit(CallbackInfo info) {
this.pitch = HorseCam.transformCameraAngle(this.pitch); if (changeLook) {
} pitch = HorseCam.transformCameraAngle(pitch);
} }
@Mixin(PlayerMoveC2SPacket.LookOnly.class)
abstract class MixinPlayerMoveC2SPacket_LookOnly extends PlayerMoveC2SPacket {
@Inject(method = "<init>(FFZ)V",
at = @At("RETURN"))
private void onInit(CallbackInfo info) {
this.pitch = HorseCam.transformCameraAngle(this.pitch);
} }
} }

View file

@ -38,7 +38,6 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
if (!skipBlend) { if (!skipBlend) {
RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_SRC_ALPHA);
} }
RenderSystem.alphaFunc(516, 0.003921569F);
} }
public static void disableModelRenderProfile() { public static void disableModelRenderProfile() {

View file

@ -5,48 +5,44 @@ import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats; import net.minecraft.client.render.VertexFormats;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import com.mojang.blaze3d.platform.GlStateManager.DstFactor;
import com.mojang.blaze3d.platform.GlStateManager.SrcFactor;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
public class MagicGlow extends RenderPhase { import java.util.function.BiFunction;
public abstract class MagicGlow extends RenderPhase {
private MagicGlow(String name, Runnable beginAction, Runnable endAction) { private MagicGlow(String name, Runnable beginAction, Runnable endAction) {
super(name, beginAction, endAction); super(name, beginAction, endAction);
} }
protected static final RenderPhase.Transparency GLOWING_TRANSPARENCY = new RenderPhase.Transparency("glowing_transparency", () -> { private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_LIGHT, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder()
RenderSystem.enableBlend(); .method_34578/*shader*/(field_29414/*EYES*/)
RenderSystem.blendFuncSeparate(
SrcFactor.CONSTANT_COLOR, DstFactor.ONE,
SrcFactor.ONE, DstFactor.ZERO);
}, () -> {
RenderSystem.disableBlend();
RenderSystem.defaultBlendFunc();
});
private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder()
.texture(NO_TEXTURE)
.writeMaskState(COLOR_MASK) .writeMaskState(COLOR_MASK)
.depthTest(LEQUAL_DEPTH_TEST)
.transparency(LIGHTNING_TRANSPARENCY) .transparency(LIGHTNING_TRANSPARENCY)
.lightmap(DISABLE_LIGHTMAP) .lightmap(DISABLE_LIGHTMAP)
.cull(DISABLE_CULLING) .cull(DISABLE_CULLING)
.build(false)); .build(false));
private static final BiFunction<Identifier, Integer, RenderLayer> TINTED_LAYER = Util.memoize((texture, color) -> {
return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, RenderLayer.MultiPhaseParameters.builder()
.method_34577/*texture*/(new Color(texture, color))
.method_34578/*shader*/(field_29414/*EYES*/)
.writeMaskState(COLOR_MASK)
.depthTest(LEQUAL_DEPTH_TEST)
.transparency(LIGHTNING_TRANSPARENCY)
.lightmap(DISABLE_LIGHTMAP)
.cull(DISABLE_CULLING)
.build(true));
});
public static RenderLayer getRenderLayer() { public static RenderLayer getRenderLayer() {
return MAGIC; return MAGIC;
} }
public static RenderLayer getTintedTexturedLayer(Identifier texture, float red, float green, float blue, float alpha) { public static RenderLayer getTintedTexturedLayer(Identifier texture, float red, float green, float blue, float alpha) {
return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, RenderLayer.MultiPhaseParameters.builder() return TINTED_LAYER.apply(texture, com.minelittlepony.common.util.Color.argbToHex(alpha, red, green, blue));
.texture(new Color(texture, red, green, blue, alpha))
.writeMaskState(COLOR_MASK)
.alpha(ONE_TENTH_ALPHA)
.transparency(GLOWING_TRANSPARENCY)
.lightmap(DISABLE_LIGHTMAP)
.overlay(DISABLE_OVERLAY_COLOR)
.cull(DISABLE_CULLING)
.build(true));
} }
private static class Color extends Texture { private static class Color extends Texture {
@ -56,24 +52,24 @@ public class MagicGlow extends RenderPhase {
private final float blue; private final float blue;
private final float alpha; private final float alpha;
public Color(Identifier texture, float red, float green, float blue, float alpha) { public Color(Identifier texture, int color) {
super(texture, false, false); super(texture, false, false);
this.red = red; this.red = com.minelittlepony.common.util.Color.r(color);
this.green = green; this.green = com.minelittlepony.common.util.Color.g(color);
this.blue = blue; this.blue = com.minelittlepony.common.util.Color.b(color);
this.alpha = alpha; this.alpha = com.minelittlepony.common.util.Color.a(color);
} }
@Override @Override
public void startDrawing() { public void startDrawing() {
RenderSystem.blendColor(red, green, blue, alpha); RenderSystem.setShaderColor(red, green, blue, alpha);
super.startDrawing(); super.startDrawing();
} }
@Override @Override
public void endDrawing() { public void endDrawing() {
super.endDrawing(); super.endDrawing();
RenderSystem.blendColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
} }
@Override @Override

View file

@ -8,7 +8,6 @@ import com.minelittlepony.client.model.entity.GuardianPonyModel;
import com.minelittlepony.client.render.entity.PonyRenderer.Proxy; import com.minelittlepony.client.render.entity.PonyRenderer.Proxy;
import com.minelittlepony.client.render.entity.feature.HeldItemFeature; import com.minelittlepony.client.render.entity.feature.HeldItemFeature;
import com.minelittlepony.client.render.entity.feature.GlowingItemFeature; import com.minelittlepony.client.render.entity.feature.GlowingItemFeature;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
@ -64,8 +63,6 @@ public class SeaponyRenderer extends GuardianEntityRenderer {
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
// The beams in RenderGuardian leave lighting disabled, so we need to change it back. #MojangPls
RenderSystem.enableLighting();
resize.setCurrentSize(origin); resize.setCurrentSize(origin);
} }

View file

@ -11,7 +11,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.api.model.BodyPart;
@ -39,7 +39,7 @@ public class PassengerFeature<T extends PlayerEntity, M extends ClientPonyModel<
}); });
} }
private Optional<Identifier> getShoulderParrot(CompoundTag tag) { private Optional<Identifier> getShoulderParrot(NbtCompound tag) {
return EntityType.get(tag.getString("id")) return EntityType.get(tag.getString("id"))
.filter(p -> p == EntityType.PARROT) .filter(p -> p == EntityType.PARROT)
.map(type -> ParrotEntityRenderer.TEXTURES[tag.getInt("Variant")]); .map(type -> ParrotEntityRenderer.TEXTURES[tag.getInt("Variant")]);

View file

@ -28,7 +28,7 @@ import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper; import net.minecraft.nbt.NbtHelper;
import net.minecraft.village.VillagerDataContainer; import net.minecraft.village.VillagerDataContainer;
@ -91,7 +91,7 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
GameProfile profile = null; GameProfile profile = null;
if (itemstack.hasTag()) { if (itemstack.hasTag()) {
CompoundTag nbt = itemstack.getTag(); NbtCompound nbt = itemstack.getTag();
assert nbt != null; assert nbt != null;
@ -99,7 +99,7 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
profile = NbtHelper.toGameProfile(nbt.getCompound("SkullOwner")); profile = NbtHelper.toGameProfile(nbt.getCompound("SkullOwner"));
} else if (nbt.contains("SkullOwner", 8)) { } else if (nbt.contains("SkullOwner", 8)) {
profile = SkullBlockEntity.loadProperties(new GameProfile(null, nbt.getString("SkullOwner"))); profile = SkullBlockEntity.loadProperties(new GameProfile(null, nbt.getString("SkullOwner")));
nbt.put("SkullOwner", NbtHelper.fromGameProfile(new CompoundTag(), profile)); nbt.put("SkullOwner", NbtHelper.writeGameProfile(new NbtCompound(), profile));
} }
} }

View file

@ -5,6 +5,8 @@ import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.TextureManager; import net.minecraft.client.texture.TextureManager;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.mojang.blaze3d.systems.RenderSystem;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@ -93,7 +95,7 @@ public class NativeUtil {
MinecraftClient mc = MinecraftClient.getInstance(); MinecraftClient mc = MinecraftClient.getInstance();
TextureManager textures = mc.getTextureManager(); TextureManager textures = mc.getTextureManager();
if (!mc.isOnThread()) { if (!RenderSystem.isOnRenderThread()) {
throw new IllegalStateException("This can only be called from the main thread."); throw new IllegalStateException("This can only be called from the main thread.");
} }
@ -119,5 +121,4 @@ public class NativeUtil {
return consumer.apply(image); return consumer.apply(image);
} }
} }
} }

View file

@ -14,6 +14,7 @@
}, },
"license": "MIT", "license": "MIT",
"icon": "minelp_logo.png", "icon": "minelp_logo.png",
"accessWidener": "minelp.aw",
"environment": "client", "environment": "client",
"entrypoints": { "entrypoints": {
"client": [ "client": [

View file

@ -0,0 +1,3 @@
accessWidener v1 named
accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;ILnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;
accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;IZZLnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;