Remove some more preprocessor statements in favor of remap
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.replaymod.core;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.util.concurrent.ListenableFutureTask;
|
||||
import com.replaymod.compat.ReplayModCompat;
|
||||
import com.replaymod.core.gui.GuiBackgroundProcesses;
|
||||
import com.replaymod.core.gui.GuiReplaySettings;
|
||||
@@ -30,7 +29,6 @@ import org.apache.commons.io.FileUtils;
|
||||
|
||||
//#if MC>=11400
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.replaymod.core.versions.LangResourcePack;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
@@ -39,11 +37,12 @@ import net.minecraft.resource.DirectoryResourcePack;
|
||||
import net.minecraft.resource.ResourcePackCreator;
|
||||
import net.minecraft.resource.ResourcePackContainer;
|
||||
//#else
|
||||
//$$ import com.google.common.util.concurrent.ListenableFutureTask;
|
||||
//$$ import net.minecraft.resources.FolderPack;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$
|
||||
//#if MC>=11300
|
||||
//$$ import com.replaymod.core.versions.LangResourcePack;
|
||||
//$$ import net.minecraft.resources.FolderPack;
|
||||
//$$ import net.minecraft.resources.IPackFinder;
|
||||
//$$ import net.minecraft.resources.ResourcePackInfo;
|
||||
//$$ import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
@@ -52,7 +51,6 @@ import net.minecraft.resource.ResourcePackContainer;
|
||||
//$$ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
//$$ import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.resources.FolderResourcePack;
|
||||
//$$ import net.minecraft.client.resources.IResourcePack;
|
||||
//$$ import net.minecraftforge.common.config.Configuration;
|
||||
//#endif
|
||||
@@ -232,21 +230,11 @@ public class ReplayMod implements
|
||||
//$$ //noinspection ConstantConditions
|
||||
//$$ if (false) {
|
||||
//#endif
|
||||
@SuppressWarnings("unchecked")
|
||||
//#if MC>=11300
|
||||
DirectoryResourcePack jGuiResourcePack = new DirectoryResourcePack(new File("../jGui/src/main/resources")) {
|
||||
@Override
|
||||
protected InputStream openFile(String resourceName) throws IOException {
|
||||
try {
|
||||
return super.openFile(resourceName);
|
||||
//#else
|
||||
//$$ List<IResourcePack> defaultResourcePacks = ((MinecraftAccessor) mc).getDefaultResourcePacks();
|
||||
//$$ FolderResourcePack jGuiResourcePack = new FolderResourcePack(new File("../jGui/src/main/resources")) {
|
||||
//$$ @Override
|
||||
//$$ protected InputStream getInputStreamByName(String resourceName) throws IOException {
|
||||
//$$ try {
|
||||
//$$ return super.getInputStreamByName(resourceName);
|
||||
//#endif
|
||||
} catch (IOException e) {
|
||||
if ("pack.mcmeta".equals(resourceName)) {
|
||||
//#if MC>=11400
|
||||
@@ -269,6 +257,8 @@ public class ReplayMod implements
|
||||
}
|
||||
});
|
||||
//#else
|
||||
//$$ @SuppressWarnings("unchecked")
|
||||
//$$ List<IResourcePack> defaultResourcePacks = ((MinecraftAccessor) mc).getDefaultResourcePacks();
|
||||
//$$ defaultResourcePacks.add(jGuiResourcePack);
|
||||
//#endif
|
||||
//#if MC<=10710
|
||||
|
||||
@@ -12,25 +12,16 @@ import net.minecraft.util.registry.Registry;
|
||||
//$$ import net.minecraftforge.registries.ForgeRegistry;
|
||||
//$$ import net.minecraftforge.registries.RegistryManager;
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraftforge.fml.common.registry.GameData;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.registry.GameData;
|
||||
//#endif
|
||||
//$$ import java.util.stream.Stream;
|
||||
//#endif
|
||||
//$$
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
//$$ import net.minecraftforge.fml.ModList;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.Loader;
|
||||
//$$ import net.minecraftforge.fml.common.ModContainer;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.Loader;
|
||||
//$$ import cpw.mods.fml.common.ModContainer;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.replaymod.core.utils;
|
||||
|
||||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
//#if MC>=10904
|
||||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||
//#endif
|
||||
|
||||
//#if MC<=10710
|
||||
@@ -29,11 +27,7 @@ public class Restrictions {
|
||||
private boolean onlyFirstPerson;
|
||||
private boolean onlyRecordingPlayer;
|
||||
|
||||
//#if MC>=10904
|
||||
public String handle(CustomPayloadS2CPacket packet) {
|
||||
//#else
|
||||
//$$ public String handle(S3FPacketCustomPayload packet) {
|
||||
//#endif
|
||||
//#if MC>=10800
|
||||
PacketByteBuf buffer = packet.getData();
|
||||
//#else
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.model.Box;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -68,7 +67,6 @@ import net.minecraft.client.render.BufferBuilder;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.render.VertexFormat;
|
||||
import net.minecraft.client.render.VertexFormatElement;
|
||||
import net.minecraft.world.level.LevelGeneratorType;
|
||||
//#else
|
||||
//$$ import com.replaymod.core.mixin.ResourcePackRepositoryAccessor;
|
||||
//$$ import com.google.common.util.concurrent.Futures;
|
||||
@@ -209,11 +207,8 @@ public class MCVer {
|
||||
//#endif
|
||||
|
||||
public static String readString(PacketByteBuf buffer, int max) {
|
||||
//#if MC>=11102
|
||||
return buffer.readString(max);
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ return buffer.readStringFromBuffer(max);
|
||||
return buffer.readString(max);
|
||||
//#else
|
||||
//$$ try {
|
||||
//$$ return buffer.readStringFromBuffer(max);
|
||||
@@ -221,7 +216,6 @@ public class MCVer {
|
||||
//$$ throw new DecoderException(e);
|
||||
//$$ }
|
||||
//#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#if MC<11400
|
||||
@@ -234,15 +228,6 @@ public class MCVer {
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
public static LevelGeneratorType WorldType_DEBUG_ALL_BLOCK_STATES
|
||||
//#if MC>=11200
|
||||
= LevelGeneratorType.DEBUG_ALL_BLOCK_STATES;
|
||||
//#else
|
||||
//$$ = WorldType.DEBUG_WORLD;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
public static Entity getRenderViewEntity(MinecraftClient mc) {
|
||||
return mc.getCameraEntity();
|
||||
@@ -263,13 +248,6 @@ public class MCVer {
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
public static Identifier LOCATION_BLOCKS_TEXTURE
|
||||
//#if MC>=10904
|
||||
= SpriteAtlasTexture.BLOCK_ATLAS_TEX;
|
||||
//#else
|
||||
//$$ = TextureMap.locationBlocksTexture;
|
||||
//#endif
|
||||
|
||||
public static Entity getRiddenEntity(Entity ridden) {
|
||||
//#if MC>=10904
|
||||
return ridden.getVehicle();
|
||||
@@ -342,15 +320,8 @@ public class MCVer {
|
||||
return getMinecraft().getResourcePackDownloader().loadServerPack(file);
|
||||
//#else
|
||||
//$$ ResourcePackRepository repo = getMinecraft().getResourcePackRepository();
|
||||
//#if MC>=10809
|
||||
//#if MC>=11200
|
||||
//$$ return repo.setServerResourcePack(file);
|
||||
//#else
|
||||
//$$ return repo.setResourcePackInstance(file);
|
||||
//#endif
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ return repo.func_177319_a(file);
|
||||
//$$ return repo.setServerResourcePack(file);
|
||||
//#else
|
||||
//$$ ResourcePackRepositoryAccessor acc = (ResourcePackRepositoryAccessor) repo;
|
||||
//$$ acc.setActive(false);
|
||||
@@ -359,7 +330,6 @@ public class MCVer {
|
||||
//$$ return Futures.immediateFuture(null);
|
||||
//#endif
|
||||
//#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
public static <T> void addCallback(
|
||||
@@ -391,91 +361,70 @@ public class MCVer {
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#if MC>=10800
|
||||
public static BufferBuilder Tessellator_getBufferBuilder() {
|
||||
return Tessellator.getInstance().getBufferBuilder();
|
||||
}
|
||||
//#else
|
||||
//$$ public static Tessellator Tessellator_getBufferBuilder() {
|
||||
//$$ return Tessellator.instance;
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
public static void BufferBuilder_setTranslation(double x, double y, double z) {
|
||||
//#if MC>=10800
|
||||
Tessellator.getInstance().getBufferBuilder().setOffset(x, y, z);
|
||||
//#else
|
||||
//$$ Tessellator.instance.setTranslation(x, y, z);
|
||||
//#endif
|
||||
Tessellator_getBufferBuilder().setOffset(x, y, z);
|
||||
}
|
||||
|
||||
public static void BufferBuilder_beginPosCol(int mode) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBufferBuilder();
|
||||
//#if MC>=10809
|
||||
bufferBuilder.begin(mode, VertexFormats.POSITION_COLOR);
|
||||
//#else
|
||||
//$$ bufferBuilder.startDrawing(mode);
|
||||
//#endif
|
||||
//#else
|
||||
//$$ Tessellator.instance.startDrawing(mode);
|
||||
//#endif
|
||||
Tessellator_getBufferBuilder().begin(
|
||||
mode
|
||||
//#if MC>=10809
|
||||
, VertexFormats.POSITION_COLOR
|
||||
//#endif
|
||||
);
|
||||
}
|
||||
|
||||
public static void BufferBuilder_addPosCol(double x, double y, double z, int r, int g, int b, int a) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder worldRenderer = Tessellator.getInstance().getBufferBuilder();
|
||||
//#else
|
||||
//$$ Tessellator worldRenderer = Tessellator.instance;
|
||||
//#endif
|
||||
//#if MC>=10809
|
||||
worldRenderer.vertex(x, y, z).color(r, g, b, a).next();
|
||||
Tessellator_getBufferBuilder().vertex(x, y, z).color(r, g, b, a).next();
|
||||
//#else
|
||||
//$$ worldRenderer.setColorRGBA(r, g, b, a);
|
||||
//$$ worldRenderer.addVertex(x, y, z);
|
||||
//$$ Tessellator_getBufferBuilder().setColorRGBA(r, g, b, a);
|
||||
//$$ Tessellator_getBufferBuilder().addVertex(x, y, z);
|
||||
//#endif
|
||||
}
|
||||
|
||||
public static void BufferBuilder_beginPosTex(int mode) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBufferBuilder();
|
||||
//#if MC>=10809
|
||||
bufferBuilder.begin(mode, VertexFormats.POSITION_UV);
|
||||
//#else
|
||||
//$$ bufferBuilder.startDrawing(mode);
|
||||
//#endif
|
||||
//#else
|
||||
//$$ Tessellator.instance.startDrawing(mode);
|
||||
//#endif
|
||||
Tessellator_getBufferBuilder().begin(
|
||||
mode
|
||||
//#if MC>=10809
|
||||
, VertexFormats.POSITION_UV
|
||||
//#endif
|
||||
);
|
||||
}
|
||||
|
||||
public static void BufferBuilder_addPosTex(double x, double y, double z, double u, double v) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder worldRenderer = Tessellator.getInstance().getBufferBuilder();
|
||||
//#else
|
||||
//$$ Tessellator worldRenderer = Tessellator.instance;
|
||||
//#endif
|
||||
//#if MC>=10809
|
||||
worldRenderer.vertex(x, y, z).texture(u, v).next();
|
||||
Tessellator_getBufferBuilder().vertex(x, y, z).texture(u, v).next();
|
||||
//#else
|
||||
//$$ worldRenderer.addVertexWithUV(x, y, z, u, v);
|
||||
//$$ Tessellator_getBufferBuilder().addVertexWithUV(x, y, z, u, v);
|
||||
//#endif
|
||||
}
|
||||
|
||||
public static void BufferBuilder_beginPosTexCol(int mode) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBufferBuilder();
|
||||
//#if MC>=10809
|
||||
bufferBuilder.begin(mode, VertexFormats.POSITION_UV_COLOR);
|
||||
//#else
|
||||
//$$ bufferBuilder.startDrawing(mode);
|
||||
//#endif
|
||||
//#else
|
||||
//$$ Tessellator.instance.startDrawing(mode);
|
||||
//#endif
|
||||
Tessellator_getBufferBuilder().begin(
|
||||
mode
|
||||
//#if MC>=10809
|
||||
, VertexFormats.POSITION_UV_COLOR
|
||||
//#endif
|
||||
);
|
||||
}
|
||||
|
||||
public static void BufferBuilder_addPosTexCol(double x, double y, double z, double u, double v, int r, int g, int b, int a) {
|
||||
//#if MC>=10800
|
||||
BufferBuilder worldRenderer = Tessellator.getInstance().getBufferBuilder();
|
||||
//#else
|
||||
//$$ Tessellator worldRenderer = Tessellator.instance;
|
||||
//#endif
|
||||
//#if MC>=10809
|
||||
worldRenderer.vertex(x, y, z).texture(u, v).color(r, g, b, a).next();
|
||||
Tessellator_getBufferBuilder().vertex(x, y, z).texture(u, v).color(r, g, b, a).next();
|
||||
//#else
|
||||
//$$ worldRenderer.setColorRGBA(r, g, b, a);
|
||||
//$$ worldRenderer.addVertexWithUV(x, y, z, u, v);
|
||||
//$$ Tessellator_getBufferBuilder().setColorRGBA(r, g, b, a);
|
||||
//$$ Tessellator_getBufferBuilder().addVertexWithUV(x, y, z, u, v);
|
||||
//#endif
|
||||
}
|
||||
|
||||
@@ -640,10 +589,8 @@ public class MCVer {
|
||||
//#if MC>=11300
|
||||
public static void color(float r, float g, float b, float a) { GlStateManager.color4f(r, g, b, a); }
|
||||
public static void enableAlpha() { GlStateManager.enableAlphaTest(); }
|
||||
public static void disableAlpha() { GlStateManager.disableAlphaTest(); }
|
||||
public static void tryBlendFuncSeparate(int l, int r, int vl, int vr) { GlStateManager.blendFuncSeparate(l, r, vl, vr); }
|
||||
public static void colorLogicOp(int op) { GlStateManager.logicOp(op); }
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static abstract class Keyboard {
|
||||
public static final int KEY_LCONTROL = GLFW.GLFW_KEY_LEFT_CONTROL;
|
||||
public static final int KEY_LSHIFT = GLFW.GLFW_KEY_LEFT_SHIFT;
|
||||
|
||||
Reference in New Issue
Block a user