Get recording and replay working

This commit is contained in:
Jonas Herzig
2019-03-10 12:53:03 +01:00
parent 8705bbad9a
commit f8fc3462e8
22 changed files with 538 additions and 331 deletions

View File

@@ -25,7 +25,8 @@ import org.apache.commons.io.FileUtils;
//#if MC>=11300
import com.replaymod.core.versions.LangResourcePack;
import net.minecraft.resources.FolderPack;
import net.minecraft.resources.IResourcePack;
import net.minecraft.resources.IPackFinder;
import net.minecraft.resources.ResourcePackInfo;
import net.minecraftforge.fml.DeferredWorkQueue;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
@@ -87,6 +88,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.FutureTask;
@@ -211,7 +213,6 @@ public class ReplayMod implements Module {
static { // Note: even preInit is too late and we'd have to issue another resource reload
@SuppressWarnings("unchecked")
//#if MC>=11300
List<IResourcePack> defaultResourcePacks = new ArrayList<>(); // FIXME: probably replaced with DownloadingPackFinder
FolderPack jGuiResourcePack = new FolderPack(new File("../jGui/src/main/resources")) {
@Override
protected InputStream getInputStream(String resourceName) throws IOException {
@@ -233,7 +234,16 @@ public class ReplayMod implements Module {
}
}
};
defaultResourcePacks.add(jGuiResourcePack);
//#if MC>=11300
mc.resourcePackRepository.addPackFinder(new IPackFinder() {
@Override
public <T extends ResourcePackInfo> void addPackInfosToMap(Map<String, T> map, ResourcePackInfo.IFactory<T> factory) {
map.put("jgui", ResourcePackInfo.func_195793_a("jgui", true, () -> jGuiResourcePack, factory, ResourcePackInfo.Priority.BOTTOM));
}
});
//#else
//$$ defaultResourcePacks.add(jGuiResourcePack);
//#endif
//#if MC<=10710
//$$ FolderResourcePack mainResourcePack = new FolderResourcePack(new File("../src/main/resources")) {
//$$ @Override

View File

@@ -3,6 +3,7 @@ package com.replaymod.core.utils;
import net.minecraft.network.PacketBuffer;
//#if MC>=10904
import net.minecraft.network.play.server.SPacketCustomPayload;
import net.minecraft.util.ResourceLocation;
//#else
//$$ import net.minecraft.network.play.server.S3FPacketCustomPayload;
//#endif
@@ -18,8 +19,11 @@ import static com.replaymod.core.versions.MCVer.readString;
* @see <a href="https://gist.github.com/Johni0702/2547c463e51f65f312cb">Replay Restrictions Gist</a>
*/
public class Restrictions {
// FIXME these should be ResourceLocations now
public static final String PLUGIN_CHANNEL = "Replay|Restrict";
//#if MC>=11300
public static final ResourceLocation PLUGIN_CHANNEL = new ResourceLocation("replaymod", "restrict");
//#else
//$$ public static final String PLUGIN_CHANNEL = "Replay|Restrict";
//#endif
private boolean noXray;
private boolean noNoclip;
private boolean onlyFirstPerson;