Port to MC 1.19.3

Building against 1.19.3-rc3 for now because 1.19.3 has yet to release.
ReplayStudio/ViaVersion is already targeting the release version though.
This commit is contained in:
Jonas Herzig
2022-12-06 17:58:52 +01:00
parent e8ea70aabc
commit d571e8fed5
19 changed files with 440 additions and 58 deletions

View File

@@ -251,6 +251,7 @@ dependencies {
11900: '1.19',
11901: '1.19.1',
11902: '1.19.2',
11903: '1.19.3-rc3',
][mcVersion]
mappings 'net.fabricmc:yarn:' + [
11404: '1.14.4+build.16',
@@ -266,6 +267,7 @@ dependencies {
11900: '1.19+build.2:v2',
11901: '1.19.1+build.5:v2',
11902: '1.19.2+build.28:v2',
11903: '1.19.3-rc3+build.1:v2',
][mcVersion]
modImplementation 'net.fabricmc:fabric-loader:0.14.11'
def fabricApiVersion = [
@@ -282,6 +284,7 @@ dependencies {
11900: '0.55.3+1.19',
11901: '0.58.5+1.19.1',
11902: '0.68.0+1.19.2',
11903: '0.68.1+1.19.3',
][mcVersion]
def fabricApiModules = [
"api-base",
@@ -354,7 +357,7 @@ dependencies {
shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8'
shadow "com.github.ReplayMod:ReplayStudio:b2c999d", shadeExclusions
shadow "com.github.ReplayMod:ReplayStudio:21ef505", shadeExclusions
// FIXME this should be pulled in by ReplayStudio, and IntelliJ sees it, but javac for some reason does not
implementation 'com.github.viaversion:opennbt:0a02214' // 2.0-SNAPSHOT (ViaVersion Edition)
@@ -365,7 +368,9 @@ dependencies {
shadow 'com.github.ReplayMod:lwjgl-utils:27dcd66'
if (FABRIC) {
if (mcVersion >= 11901) {
if (mcVersion >= 11903) {
modImplementation 'com.terraformersmc:modmenu:5.0.0-alpha.4'
} else if (mcVersion >= 11901) {
modImplementation 'com.terraformersmc:modmenu:4.0.5'
} else if (mcVersion >= 11900) {
modImplementation 'com.terraformersmc:modmenu:4.0.4'

2
jGui

Submodule jGui updated: 360b2541d2...7a80b50c2e

View File

@@ -193,6 +193,7 @@ val doRelease by tasks.registering {
defaultTasks("bundleJar")
preprocess {
val mc11903 = createNode("1.19.3", 11903, "yarn")
val mc11902 = createNode("1.19.2", 11902, "yarn")
val mc11901 = createNode("1.19.1", 11901, "yarn")
val mc11900 = createNode("1.19", 11900, "yarn")
@@ -216,6 +217,7 @@ preprocess {
val mc10800 = createNode("1.8", 10800, "srg")
val mc10710 = createNode("1.7.10", 10710, "srg")
mc11903.link(mc11902, file("versions/mapping-fabric-1.19.3-1.19.2.txt"))
mc11902.link(mc11901)
mc11901.link(mc11900)
mc11900.link(mc11802, file("versions/mapping-fabric-1.19-1.18.2.txt"))

View File

@@ -36,6 +36,7 @@ val jGuiVersions = listOf(
"1.19",
"1.19.1",
"1.19.2",
"1.19.3",
)
val replayModVersions = listOf(
// "1.7.10",
@@ -60,6 +61,7 @@ val replayModVersions = listOf(
"1.19",
"1.19.1",
"1.19.2",
"1.19.3",
)
rootProject.buildFileName = "root.gradle.kts"

View File

@@ -120,7 +120,11 @@ public class ReplayMod implements Module, Scheduler {
return null;
}
}
//#if MC>=11903
//$$ return new DirectoryResourcePack(JGUI_RESOURCE_PACK_NAME, folder.toPath(), true) {
//#else
return new DirectoryResourcePack(folder) {
//#endif
@Override
//#if MC>=11400
public String getName() {
@@ -130,22 +134,36 @@ public class ReplayMod implements Module, Scheduler {
return JGUI_RESOURCE_PACK_NAME;
}
//#if MC>=11903
//$$ @Override
//$$ public net.minecraft.resource.InputSupplier<InputStream> openRoot(String... segments) {
//$$ if (segments.length == 1 && segments[0].equals("pack.mcmeta")) {
//$$ return () -> new ByteArrayInputStream(generatePackMeta());
//$$ }
//$$ return super.openRoot(segments);
//$$ }
//#else
@Override
protected InputStream openFile(String resourceName) throws IOException {
try {
return super.openFile(resourceName);
} catch (IOException e) {
if ("pack.mcmeta".equals(resourceName)) {
return new ByteArrayInputStream(generatePackMeta());
}
throw e;
}
}
//#endif
private byte[] generatePackMeta() {
//#if MC>=11400
int version = 4;
//#else
//$$ int version = 1;
//#endif
return new ByteArrayInputStream(("{\"pack\": {\"description\": \"dummy pack for jGui resources in dev-env\", \"pack_format\": "
+ version + "}}").getBytes(StandardCharsets.UTF_8));
}
throw e;
}
return ("{\"pack\": {\"description\": \"dummy pack for jGui resources in dev-env\", \"pack_format\": "
+ version + "}}").getBytes(StandardCharsets.UTF_8);
}
};
}

View File

@@ -4,7 +4,6 @@ package com.replaymod.core.versions;
import com.google.gson.Gson;
import com.replaymod.core.ReplayMod;
import net.minecraft.resource.AbstractFileResourcePack;
import net.minecraft.resource.ResourceNotFoundException;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import org.apache.commons.io.IOUtils;
@@ -16,16 +15,18 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
//#if FABRIC>=1
import net.fabricmc.loader.api.FabricLoader;
@@ -33,6 +34,11 @@ import net.fabricmc.loader.api.ModContainer;
//#else
//#endif
//#if MC>=11903
//$$ import java.util.Objects;
//$$ import net.minecraft.resource.InputSupplier;
//#endif
//#if MC>=11400
//#else
//$$ import net.minecraft.resources.IPackFinder;
@@ -58,7 +64,11 @@ public class LangResourcePack extends AbstractFileResourcePack {
private final Path basePath;
public LangResourcePack() {
//#if MC>=11903
//$$ super(NAME, true);
//#else
super(new File(NAME));
//#endif
//#if FABRIC>=1
ModContainer container = FabricLoader.getInstance().getModContainer(ReplayMod.MOD_ID).orElseThrow(IllegalAccessError::new);
@@ -110,14 +120,45 @@ public class LangResourcePack extends AbstractFileResourcePack {
return value;
}
//#if MC>=11903
//$$ @Override
//$$ public InputSupplier<InputStream> openRoot(String... segments) {
//$$ byte[] bytes;
//$$ try {
//$$ bytes = readFile(String.join("/", segments));
//$$ } catch (IOException e) {
//$$ throw new RuntimeException(e);
//$$ }
//$$ if (bytes == null) {
//$$ return null;
//$$ }
//$$ return () -> new ByteArrayInputStream(bytes);
//$$ }
//#endif
//#if MC>=11903
//$$ @Override
//$$ public InputSupplier<InputStream> open(ResourceType type, Identifier id) {
//$$ return openRoot(type.getDirectory(), id.getNamespace(), id.getPath());
//$$ }
//#else
@Override
protected InputStream openFile(String path) throws IOException {
byte[] bytes = readFile(path);
if (bytes == null) {
throw new net.minecraft.resource.ResourceNotFoundException(this.base, path);
}
return new ByteArrayInputStream(bytes);
}
//#endif
private byte[] readFile(String path) throws IOException {
if ("pack.mcmeta".equals(path)) {
return new ByteArrayInputStream("{\"pack\": {\"description\": \"ReplayMod language files\", \"pack_format\": 4}}".getBytes(StandardCharsets.UTF_8));
return "{\"pack\": {\"description\": \"ReplayMod language files\", \"pack_format\": 4}}".getBytes(StandardCharsets.UTF_8);
}
Path langPath = langPath(path);
if (langPath == null) throw new ResourceNotFoundException(this.base, path);
if (langPath == null) return null;
List<String> langFile;
try (InputStream in = Files.newInputStream(langPath)) {
@@ -141,16 +182,25 @@ public class LangResourcePack extends AbstractFileResourcePack {
properties.put(key, value);
}
return new ByteArrayInputStream(GSON.toJson(properties).getBytes(StandardCharsets.UTF_8));
return GSON.toJson(properties).getBytes(StandardCharsets.UTF_8);
}
//#if MC>=11903
//#else
@Override
protected boolean containsFile(String path) {
Path langPath = langPath(path);
return langPath != null && Files.exists(langPath);
}
//#endif
//#if MC>=11903
//$$ @Override
//$$ public void findResources(ResourceType type, String namespace, String prefix, ResultConsumer consumer) {
//$$ findResources(type, prefix, id -> consumer.accept(id, () -> new ByteArrayInputStream(Objects.requireNonNull(readFile(id.getPath())))));
//$$ }
//#else
@Override
public Collection<Identifier> findResources(
ResourceType resourcePackType,
@@ -162,36 +212,42 @@ public class LangResourcePack extends AbstractFileResourcePack {
//$$ Predicate<Identifier> filter
//#else
int maxDepth,
Predicate<String> filter
Predicate<String> pathFilter
//#endif
) {
if (resourcePackType == ResourceType.CLIENT_RESOURCES && "lang".equals(path)) {
//#if MC<11900
Predicate<Identifier> filter = id -> pathFilter.test(id.getPath());
//#endif
List<Identifier> result = new ArrayList<>();
findResources(resourcePackType, path, id -> {
if (filter.test(id)) {
result.add(id);
}
});
return result;
}
//#endif
private void findResources(ResourceType type, String path, Consumer<Identifier> consumer) {
if (type != ResourceType.CLIENT_RESOURCES) return;
if (!"lang".equals(path)) return;
Path base = baseLangPath();
//#if MC<11400
//$$ if (base == null) return Collections.emptyList();
//$$ if (base == null) return;
//#endif
try {
return Files.walk(base, 1)
try (Stream<Path> stream = Files.walk(base, 1)) {
stream
.skip(1)
.filter(Files::isRegularFile)
.map(Path::getFileName).map(Path::toString)
.map(LANG_FILE_NAME_PATTERN::matcher)
.filter(Matcher::matches)
.map(matcher -> String.format("%s_%s.json", matcher.group(1), matcher.group(1)))
//#if MC<11900
.filter(filter)
//#endif
.map(name -> new Identifier(ReplayMod.MOD_ID, "lang/" + name))
//#if MC>=11900
//$$ .filter(filter)
//#endif
.collect(Collectors.toList());
.forEach(consumer);
} catch (IOException e) {
e.printStackTrace();
return Collections.emptyList();
}
} else {
return Collections.emptyList();
}
}

View File

@@ -15,6 +15,10 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.math.Vec3d;
//#if MC>=11700
//$$ import net.minecraft.util.math.Matrix4f;
//#endif
//#if MC>=11604
//#else
//$$ import net.minecraft.entity.Entity;
@@ -27,6 +31,8 @@ import net.minecraft.resource.ResourcePackSource;
//#if MC>=11400
import com.replaymod.render.mixin.MainWindowAccessor;
import net.minecraft.SharedConstants;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.ParentElement;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.util.Window;
@@ -219,13 +225,23 @@ public class MCVer {
}
//#if MC>=11400
public static Optional<AbstractButtonWidget> findButton(Iterable<AbstractButtonWidget> buttonList, @SuppressWarnings("unused") String text, @SuppressWarnings("unused") int id) {
public static Optional<AbstractButtonWidget> findButton(Iterable<? extends Element> buttonList, @SuppressWarnings("unused") String text, @SuppressWarnings("unused") int id) {
//#if MC>=11600
final Text message = new TranslatableText(text);
//#else
//$$ final String message = I18n.translate(text);
//#endif
for (AbstractButtonWidget b : buttonList) {
for (Element e : buttonList) {
if (e instanceof ParentElement) {
Optional<AbstractButtonWidget> button = findButton(((ParentElement) e).children(), text, id);
if (button.isPresent()) {
return button;
}
}
if (!(e instanceof AbstractButtonWidget)) {
continue;
}
AbstractButtonWidget b = (AbstractButtonWidget) e;
if (message.equals(b.getMessage())) {
return Optional.of(b);
}
@@ -361,6 +377,24 @@ public class MCVer {
//#endif
}
//#if MC>=11700
//$$ public static net.minecraft.util.math.Quaternion quaternion(float angle, net.minecraft.util.math.Vec3f axis) {
//#if MC>=11903
//$$ return new org.joml.Quaternionf().fromAxisAngleDeg(axis.x, axis.y, axis.z, angle);
//#else
//$$ return new net.minecraft.util.math.Quaternion(axis, angle, true);
//#endif
//$$ }
//$$
//$$ public static Matrix4f ortho(float left, float right, float top, float bottom, float zNear, float zFar) {
//#if MC>=11903
//$$ return new Matrix4f().ortho(left, right, bottom, top, zNear, zFar);
//#else
//$$ return Matrix4f.projectionMatrix(left, right, top, bottom, zNear, zFar);
//#endif
//$$ }
//#endif
public static void emitLine(BufferBuilder buffer, Vector2f p1, Vector2f p2, int color) {
emitLine(buffer, new Vector3f(p1.x, p1.y, 0), new Vector3f(p2.x, p2.y, 0), color);
}

View File

@@ -18,6 +18,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourceManager;
import net.minecraft.sound.SoundCategory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
@@ -39,13 +40,16 @@ import org.lwjgl.opengl.GL11;
//#if MC>=11600
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Quaternion;
//#else
//#endif
//#if MC>=11400
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.util.Window;
import net.minecraft.util.registry.Registry;
//#else
//$$ import net.minecraft.client.gui.GuiButton;
//#endif
@@ -165,6 +169,42 @@ class Patterns {
//#endif
}
@Pattern
private static int getX(AbstractButtonWidget button) {
//#if MC>=11903
//$$ return button.getX();
//#else
return button.x;
//#endif
}
@Pattern
private static int getY(AbstractButtonWidget button) {
//#if MC>=11903
//$$ return button.getY();
//#else
return button.y;
//#endif
}
@Pattern
private static void setX(AbstractButtonWidget button, int value) {
//#if MC>=11903
//$$ button.setX(value);
//#else
button.x = value;
//#endif
}
@Pattern
private static void setY(AbstractButtonWidget button, int value) {
//#if MC>=11903
//$$ button.setY(value);
//#else
button.y = value;
//#endif
}
//#if MC>=11400
@Pattern
private static void setWidth(AbstractButtonWidget button, int value) {
@@ -529,7 +569,7 @@ class Patterns {
@Pattern
private static void GL11_glRotatef(float angle, float x, float y, float z) {
//#if MC>=11700
//$$ { float $angle = angle; com.mojang.blaze3d.systems.RenderSystem.getModelViewStack().multiply(new net.minecraft.util.math.Quaternion(new net.minecraft.util.math.Vec3f(x, y, z), $angle, true)); }
//$$ com.mojang.blaze3d.systems.RenderSystem.getModelViewStack().multiply(com.replaymod.core.versions.MCVer.quaternion(angle, new net.minecraft.util.math.Vec3f(x, y, z)));
//#else
GL11.glRotatef(angle, x, y, z);
//#endif
@@ -683,4 +723,178 @@ class Patterns {
//$$ return java.util.Arrays.asList(new ItemStack[size]);
//#endif
}
@Pattern
private static void setSoundVolume(GameOptions options, SoundCategory category, float value) {
//#if MC>=11903
//$$ options.getSoundVolumeOption(category).setValue((double) value);
//#else
options.setSoundVolume(category, value);
//#endif
}
//#if MC>=10900
@Pattern
private static SoundEvent SoundEvent_of(Identifier identifier) {
//#if MC>=11903
//$$ return SoundEvent.of(identifier);
//#else
return new SoundEvent(identifier);
//#endif
}
//#else
//$$ @Pattern private static void SoundEvent_of() {}
//#endif
//#if MC>=11600
@Pattern
private static Vector3f POSITIVE_X() {
//#if MC>=11903
//$$ return new org.joml.Vector3f(1, 0, 0);
//#else
return Vector3f.POSITIVE_X;
//#endif
}
@Pattern
private static Vector3f POSITIVE_Y() {
//#if MC>=11903
//$$ return new org.joml.Vector3f(0, 1, 0);
//#else
return Vector3f.POSITIVE_Y;
//#endif
}
@Pattern
private static Vector3f POSITIVE_Z() {
//#if MC>=11903
//$$ return new org.joml.Vector3f(0, 0, 1);
//#else
return Vector3f.POSITIVE_Z;
//#endif
}
@Pattern
private static Quaternion getDegreesQuaternion(Vector3f axis, float angle) {
//#if MC>=11903
//$$ return new org.joml.Quaternionf().fromAxisAngleDeg(axis, angle);
//#else
return axis.getDegreesQuaternion(angle);
//#endif
}
@Pattern
private static void Quaternion_mul(Quaternion left, Quaternion right) {
//#if MC>=11903
//$$ left.mul(right);
//#else
left.hamiltonProduct(right);
//#endif
}
@Pattern
private static float Quaternion_getX(Quaternion q) {
//#if MC>=11903
//$$ return q.x;
//#else
return q.getX();
//#endif
}
@Pattern
private static float Quaternion_getY(Quaternion q) {
//#if MC>=11903
//$$ return q.y;
//#else
return q.getY();
//#endif
}
@Pattern
private static float Quaternion_getZ(Quaternion q) {
//#if MC>=11903
//$$ return q.z;
//#else
return q.getZ();
//#endif
}
@Pattern
private static float Quaternion_getW(Quaternion q) {
//#if MC>=11903
//$$ return q.w;
//#else
return q.getW();
//#endif
}
@Pattern
private static Quaternion Quaternion_copy(Quaternion source) {
//#if MC>=11903
//$$ return new org.joml.Quaternionf(source);
//#else
return source.copy();
//#endif
}
//#else
//$$ @Pattern private static void POSITIVE_X() {}
//$$ @Pattern private static void POSITIVE_Y() {}
//$$ @Pattern private static void POSITIVE_Z() {}
//$$ @Pattern private static void getDegreesQuaternion() {}
//$$ @Pattern private static void Quaternion_mul() {}
//$$ @Pattern private static void Quaternion_getX() {}
//$$ @Pattern private static void Quaternion_getY() {}
//$$ @Pattern private static void Quaternion_getZ() {}
//$$ @Pattern private static void Quaternion_getW() {}
//$$ @Pattern private static void Quaternion_copy() {}
//#endif
//#if MC>=11600
@Pattern
private static void Matrix4f_multiply(Matrix4f left, Matrix4f right) {
//#if MC>=11903
//$$ left.mul(right);
//#else
left.multiply(right);
//#endif
}
@Pattern
private static Matrix4f Matrix4f_translate(float x, float y, float z) {
//#if MC>=11903
//$$ return new Matrix4f().translation(x, y, z);
//#else
return Matrix4f.translate(x, y, z);
//#endif
}
//#else
//$$ @Pattern private static void Matrix4f_multiply() {}
//$$ @Pattern private static void Matrix4f_translate() {}
//#endif
//#if MC>=11700
//$$ @Pattern
//$$ private static Matrix4f Matrix4f_perspectiveMatrix(float left, float right, float top, float bottom, float zNear, float zFar) {
//#if MC>=11903
//$$ return com.replaymod.core.versions.MCVer.ortho(left, right, top, bottom, zNear, zFar);
//#else
//$$ return Matrix4f.projectionMatrix(left, right, top, bottom, zNear, zFar);
//#endif
//$$ }
//#else
@Pattern private static void Matrix4f_perspectiveMatrix() {}
//#endif
//#if MC>=11400
@Pattern
private static Registry<? extends Registry<?>> REGISTRIES() {
//#if MC>=11903
//$$ return net.minecraft.registry.Registries.REGISTRIES;
//#else
return Registry.REGISTRIES;
//#endif
}
//#else
//$$ @Pattern private static void REGISTRIES() {}
//#endif
}

View File

@@ -32,7 +32,6 @@ import net.minecraft.server.integrated.IntegratedServer;
//#if MC>=11600
import com.mojang.datafixers.util.Pair;
import java.util.Collections;
//#endif
//#if MC>=11400
@@ -57,6 +56,7 @@ import net.minecraft.util.math.BlockPos;
//$$ import net.minecraft.util.MathHelper;
//#endif
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -104,7 +104,9 @@ public class RecordingEventHandler extends EventRegistrations {
ClientPlayerEntity player = mc.player;
assert player != null;
packetListener.save(new PlayerSpawnS2CPacket(player));
//#if MC>=11500
//#if MC>=11903
//$$ packetListener.save(new EntityTrackerUpdateS2CPacket(player.getId(), player.getDataTracker().getChangedEntries()));
//#elseif MC>=11500
packetListener.save(new EntityTrackerUpdateS2CPacket(player.getEntityId(), player.getDataTracker(), true));
//#endif
lastX = lastY = lastZ = null;

View File

@@ -61,7 +61,11 @@ public abstract class MixinNetHandlerPlayClient {
if (mcStatic.player == null) return;
RecordingEventHandler handler = getRecordingEventHandler();
//#if MC>=11903
//$$ if (handler != null && packet.getActions().contains(PlayerListS2CPacket.Action.ADD_PLAYER)) {
//#else
if (handler != null && packet.getAction() == PlayerListS2CPacket.Action.ADD_PLAYER) {
//#endif
// We cannot reference SPacketPlayerListItem.AddPlayerData directly for complicated (and yet to be
// resolved) reasons (see https://github.com/MinecraftForge/ForgeGradle/issues/472), so we use ReplayStudio
// to parse it instead.

View File

@@ -111,7 +111,10 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
// but are instead played directly by the client. The server only sends these sounds to
// other clients so we have to record them manually.
// E.g. Block place sounds
//#if MC>=11900
//#if MC>=11903
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;FFJ)V",
//$$ at = @At("HEAD"))
//#elseif MC>=11900
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFJ)V",
//$$ at = @At("HEAD"))
//#elseif MC>=11400
@@ -127,7 +130,13 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
//$$ at = @At("HEAD"))
//#endif
public void replayModRecording_recordClientSound(
PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category,
PlayerEntity player, double x, double y, double z,
//#if MC>=11903
//$$ RegistryEntry<SoundEvent> sound,
//#else
SoundEvent sound,
//#endif
SoundCategory category,
float volume, float pitch,
//#if MC>=11900
//$$ long seed,

View File

@@ -10,12 +10,22 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(GameRenderer.class)
public abstract class Mixin_Omnidirectional_Camera implements EntityRendererHandler.IEntityRenderer {
private static final String METHOD = "getBasicProjectionMatrix";
//#if MC>=11903
//$$ private static final String TARGET = "Lorg/joml/Matrix4f;setPerspective(FFFF)Lorg/joml/Matrix4f;";
//$$ private static final boolean TARGET_REMAP = false;
//$$ private static final float OMNIDIRECTIONAL_FOV = (float) Math.PI / 2;
//#else
private static final String TARGET = "Lnet/minecraft/util/math/Matrix4f;viewboxMatrix(DFFF)Lnet/minecraft/util/math/Matrix4f;";
private static final boolean TARGET_REMAP = true;
private static final float OMNIDIRECTIONAL_FOV = 90;
//#endif
@ModifyArg(method = METHOD, at = @At(value = "INVOKE", target = TARGET, remap = TARGET_REMAP), index = 0)
//#if MC>=11903
//$$ private float replayModRender_perspective_fov(float fovY) {
//#else
private double replayModRender_perspective_fov(double fovY) {
//#endif
return isOmnidirectional() ? OMNIDIRECTIONAL_FOV : fovY;
}

View File

@@ -57,7 +57,11 @@ import net.minecraft.util.math.Vec3d;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
//#if MC>=11901
//#if MC>=11903
//$$ import net.minecraft.network.packet.s2c.play.ProfilelessChatMessageS2CPacket;
//#endif
//#if MC==11901 || MC==11902
//$$ import net.minecraft.network.packet.s2c.play.MessageHeaderS2CPacket;
//#endif
@@ -755,7 +759,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
GameMode.SPECTATOR,
respawn.isDebugWorld(),
respawn.isFlatWorld(),
respawn.isWritingErrorSkippable()
//#if MC>=11903
//$$ (byte) 0
//#else
false
//#endif
//#else
//$$ respawn.getGeneratorType(),
//$$ GameMode.SPECTATOR
@@ -868,7 +876,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
}
}
//#if MC>=11901
//#if MC>=11903
//$$ if (p instanceof GameMessageS2CPacket || p instanceof ChatMessageS2CPacket || p instanceof ProfilelessChatMessageS2CPacket) {
//#elseif MC==11901 || MC==11902
//$$ if (p instanceof GameMessageS2CPacket || p instanceof ChatMessageS2CPacket || p instanceof MessageHeaderS2CPacket) {
//#elseif MC>=11900
//$$ if (p instanceof GameMessageS2CPacket || p instanceof ChatMessageS2CPacket) {

View File

@@ -295,6 +295,11 @@ public class ReplayHandler {
networkManager,
mc,
null
//#if MC>=11903
//$$ , null
//$$ , false
//$$ , null
//#endif
//#if MC>=11400
, it -> {}
//#endif

View File

@@ -195,7 +195,8 @@ public class GuiHandler extends EventRegistrations {
buttons.stream()
.filter(button -> button.x <= xEnd && button.x + button.getWidth() >= xStart)
.filter(button -> button.y <= yEnd && button.y + button.getHeight() >= yStart)
.forEach(button -> button.y += moveBy);
// FIXME remap bug: needs the {} to recognize the setter (it also doesn't understand +=)
.forEach(button -> { button.y = button.y + moveBy; });
}
{ on(InitScreenCallback.EVENT, (screen, buttons) -> ensureReplayStopped(screen)); }
@@ -417,6 +418,9 @@ public class GuiHandler extends EventRegistrations {
//#if MC>=11400
, self -> onClick.accept((InjectedButton) self)
//#endif
//#if MC>=11903
//$$ , DEFAULT_NARRATION_SUPPLIER
//#endif
);
this.guiScreen = guiScreen;
this.id = buttonId;

View File

@@ -11,11 +11,13 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(TitleScreen.class)
public abstract class Mixin_MoveRealmsButton {
@ModifyArg(
method = "init",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;init(Lnet/minecraft/client/MinecraftClient;II)V"),
index = 2
)
//#if MC>=11901
//$$ private static final String REALMS_INIT = "Lnet/minecraft/client/realms/gui/screen/RealmsNotificationsScreen;init(Lnet/minecraft/client/MinecraftClient;II)V";
//#else
private static final String REALMS_INIT = "Lnet/minecraft/client/gui/screen/Screen;init(Lnet/minecraft/client/MinecraftClient;II)V";
//#endif
@ModifyArg(method = "init", at = @At(value = "INVOKE", target = REALMS_INIT), index = 2)
private int adjustRealmsButton(int height) {
String setting = ReplayMod.instance.getSettingsRegistry().get(Setting.MAIN_MENU_BUTTON);
if (MainMenuButtonPosition.valueOf(setting) == MainMenuButtonPosition.BIG) {

0
versions/1.19.3/.gitkeep Normal file
View File

View File

@@ -17,6 +17,7 @@ net.minecraft.util.math.BlockPos net.minecraft.util.BlockPos
net.minecraft.client.gui.GuiWorldSelection net.minecraft.client.gui.GuiSelectWorld
net.minecraft.util.math.AxisAlignedBB net.minecraft.util.AxisAlignedBB
net.minecraft.util.math.RayTraceResult net.minecraft.util.MovingObjectPosition
net.minecraft.client.renderer.Matrix4f net.minecraft.util.Matrix4f
net.minecraft.client.renderer.RenderItem net.minecraft.client.renderer.entity.RenderItem
net.minecraft.network.play.server.SPacketSpawnMob dataManager field_149043_l
net.minecraft.network.play.server.SPacketSpawnMob getDataManagerEntries() func_149027_c()

View File

@@ -0,0 +1,4 @@
org.joml.Matrix3 net.minecraft.util.math.Matrix3f
org.joml.Matrix4f net.minecraft.util.math.Matrix4f
org.joml.Quaternionf net.minecraft.util.math.Quaternion
org.joml.Vector3f net.minecraft.util.math.Vec3f