Make use of the source remapping feature of The Preprocessor plugin
This commit is contained in:
@@ -4,6 +4,7 @@ import com.replaymod.core.KeyBindingRegistry;
|
||||
import com.replaymod.core.Module;
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.utils.Restrictions;
|
||||
import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
import com.replaymod.recording.handler.ConnectionEventHandler;
|
||||
import com.replaymod.recording.handler.GuiHandler;
|
||||
import com.replaymod.recording.packet.PacketListener;
|
||||
@@ -12,25 +13,10 @@ import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.util.AttributeKey;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//#if MC>=11300
|
||||
import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
//#else
|
||||
//$$ import org.lwjgl.input.Keyboard;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
public class ReplayModRecording implements Module {
|
||||
|
||||
@@ -13,16 +13,7 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import net.minecraft.client.gui.GuiIngameMenu;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.getGui;
|
||||
|
||||
|
||||
@@ -8,22 +8,12 @@ import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
//$$ import static com.replaymod.core.versions.MCVer.GlStateManager.*;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.ReplayMod.TEXTURE;
|
||||
import static com.replaymod.core.ReplayMod.TEXTURE_SIZE;
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
/**
|
||||
* Renders overlay during recording.
|
||||
@@ -56,7 +46,7 @@ public class GuiRecordingOverlay {
|
||||
if (getType(event) != RenderGameOverlayEvent.ElementType.ALL) return;
|
||||
if (guiControls.isStopped()) return;
|
||||
if (settingsRegistry.get(Setting.INDICATOR)) {
|
||||
FontRenderer fontRenderer = getFontRenderer(mc);
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
String text = guiControls.isPaused() ? I18n.format("replaymod.gui.paused") : I18n.format("replaymod.gui.recording");
|
||||
fontRenderer.drawString(text.toUpperCase(), 30, 18 - (fontRenderer.FONT_HEIGHT / 2), 0xffffffff);
|
||||
bindTexture(TEXTURE);
|
||||
|
||||
@@ -3,12 +3,7 @@
|
||||
//$$
|
||||
//$$ import io.netty.channel.ChannelHandlerContext;
|
||||
//$$ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
//$$
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.network.handshake.FMLHandshakeMessage;
|
||||
//#endif
|
||||
//$$
|
||||
//$$ /**
|
||||
//$$ * Filters out all handshake packets that were sent for recording but must
|
||||
@@ -23,11 +18,7 @@
|
||||
//$$ public class FMLHandshakeFilter extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
|
||||
//$$ @Override
|
||||
//$$ protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception {
|
||||
//#if MC>=10800
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.RegistryData)) {
|
||||
//#else
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.ModIdData)) {
|
||||
//#endif
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.RegistryData)) {
|
||||
//$$ // Pass on everything but RegistryData messages
|
||||
//$$ ctx.fireChannelRead(msg);
|
||||
//$$ }
|
||||
|
||||
@@ -8,23 +8,10 @@ import de.johni0702.minecraft.gui.container.VanillaGuiScreen;
|
||||
import de.johni0702.minecraft.gui.element.GuiCheckbox;
|
||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||
import net.minecraft.client.gui.GuiMultiplayer;
|
||||
//#if MC>=10904
|
||||
import net.minecraft.client.gui.GuiWorldSelection;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.gui.GuiSelectWorld;
|
||||
//#endif
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.getGui;
|
||||
|
||||
@@ -42,13 +29,8 @@ public class GuiHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//#if MC>=10904
|
||||
if (event.getGui() instanceof GuiWorldSelection || event.getGui() instanceof GuiMultiplayer) {
|
||||
boolean sp = event.getGui() instanceof GuiWorldSelection;
|
||||
//#else
|
||||
//$$ if (event.gui instanceof GuiSelectWorld || event.gui instanceof GuiMultiplayer) {
|
||||
//$$ boolean sp = event.gui instanceof GuiSelectWorld;
|
||||
//#endif
|
||||
if (getGui(event) instanceof GuiWorldSelection || getGui(event) instanceof GuiMultiplayer) {
|
||||
boolean sp = getGui(event) instanceof GuiWorldSelection;
|
||||
SettingsRegistry settingsRegistry = mod.getSettingsRegistry();
|
||||
Setting<Boolean> setting = sp ? Setting.RECORD_SINGLEPLAYER : Setting.RECORD_SERVER;
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import net.minecraft.network.play.server.*;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
// FIXME not (yet?) 1.13 import net.minecraftforge.event.entity.minecart.MinecartInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
//#if MC>=10904
|
||||
//#if MC>=11300
|
||||
@@ -21,27 +24,12 @@ import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraft.util.BlockPos;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
//$$ import cpw.mods.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
//$$ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
//$$ import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
//$$ import net.minecraft.util.math.MathHelper;
|
||||
//#endif
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -91,11 +79,7 @@ public class RecordingEventHandler {
|
||||
|
||||
public void onPlayerJoin() {
|
||||
try {
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketSpawnPlayer(player(mc)));
|
||||
//#else
|
||||
//$$ packetListener.save(new S0CPacketSpawnPlayer(player(mc)));
|
||||
//#endif
|
||||
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||
} catch(Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
@@ -103,11 +87,7 @@ public class RecordingEventHandler {
|
||||
|
||||
public void onPlayerRespawn() {
|
||||
try {
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketSpawnPlayer(player(mc)));
|
||||
//#else
|
||||
//$$ packetListener.save(new S0CPacketSpawnPlayer(player(mc)));
|
||||
//#endif
|
||||
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||
lastX = lastY = lastZ = null;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -136,9 +116,9 @@ public class RecordingEventHandler {
|
||||
//#endif
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(PlayerTickEvent e) {
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
try {
|
||||
if(e.player != player(mc)) return;
|
||||
if(e.player != mc.player) return;
|
||||
|
||||
boolean force = false;
|
||||
if(lastX == null || lastY == null || lastZ == null) {
|
||||
@@ -164,11 +144,8 @@ public class RecordingEventHandler {
|
||||
|
||||
Packet packet;
|
||||
if (force || Math.abs(dx) > 8.0 || Math.abs(dy) > 8.0 || Math.abs(dz) > 8.0) {
|
||||
//#if MC>=10904
|
||||
packet = new SPacketEntityTeleport(e.player);
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ packet = new S18PacketEntityTeleport(e.player);
|
||||
packet = new SPacketEntityTeleport(e.player);
|
||||
//#else
|
||||
//$$ // In 1.7.10 the client player entity has its posY at eye height
|
||||
//$$ // but for all other entities it's at their feet (as it should be).
|
||||
@@ -176,20 +153,15 @@ public class RecordingEventHandler {
|
||||
//$$ // Note: this leaves the lastY value offset by the eye height but because it's only used for relative
|
||||
//$$ // movement, that doesn't matter.
|
||||
//$$ S18PacketEntityTeleport teleportPacket = new S18PacketEntityTeleport(e.player);
|
||||
//$$ teleportPacket.field_149457_c = floor(e.player.boundingBox.minY * 32);
|
||||
//$$ teleportPacket.field_149457_c = MathHelper.floor(e.player.boundingBox.minY * 32);
|
||||
//$$ packet = teleportPacket;
|
||||
//#endif
|
||||
//#endif
|
||||
} else {
|
||||
byte newYaw = (byte) ((int) (e.player.rotationYaw * 256.0F / 360.0F));
|
||||
byte newPitch = (byte) ((int) (e.player.rotationPitch * 256.0F / 360.0F));
|
||||
|
||||
//#if MC>=10904
|
||||
//#if MC>=11300
|
||||
packet = new SPacketEntity.Move(
|
||||
//#else
|
||||
//$$ packet = new SPacketEntity.S17PacketEntityLookMove(
|
||||
//#endif
|
||||
e.player.getEntityId(),
|
||||
(short) Math.round(dx * 4096), (short) Math.round(dy * 4096), (short) Math.round(dz * 4096),
|
||||
newYaw, newPitch, e.player.onGround
|
||||
@@ -211,28 +183,23 @@ public class RecordingEventHandler {
|
||||
int rotationYawHead = ((int)(e.player.rotationYawHead * 256.0F / 360.0F));
|
||||
|
||||
if(!Objects.equals(rotationYawHead, rotationYawHeadBefore)) {
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketEntityHeadLook(e.player, (byte) rotationYawHead));
|
||||
//#else
|
||||
//$$ packetListener.save(new S19PacketEntityHeadLook(e.player, (byte) rotationYawHead));
|
||||
//#endif
|
||||
rotationYawHeadBefore = rotationYawHead;
|
||||
}
|
||||
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketEntityVelocity(e.player.getEntityId(), e.player.motionX, e.player.motionY, e.player.motionZ));
|
||||
//#else
|
||||
//$$ packetListener.save(new S12PacketEntityVelocity(e.player.getEntityId(), e.player.motionX, e.player.motionY, e.player.motionZ));
|
||||
//#endif
|
||||
|
||||
//Animation Packets
|
||||
//Swing Animation
|
||||
if (e.player.isSwingInProgress && e.player.swingProgressInt == -1) {
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketAnimation(e.player, e.player.swingingHand == EnumHand.MAIN_HAND ? 0 : 3));
|
||||
//#else
|
||||
//$$ packetListener.save(new S0BPacketAnimation(e.player, 0));
|
||||
//#endif
|
||||
packetListener.save(new SPacketAnimation(
|
||||
e.player,
|
||||
//#if MC>=10904
|
||||
e.player.swingingHand == EnumHand.MAIN_HAND ? 0 : 3
|
||||
//#else
|
||||
//$$ 0
|
||||
//#endif
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -257,33 +224,33 @@ public class RecordingEventHandler {
|
||||
|
||||
//Inventory Handling
|
||||
//#if MC>=10904
|
||||
if (playerItems[0] != player(mc).getHeldItem(EnumHand.MAIN_HAND)) {
|
||||
playerItems[0] = player(mc).getHeldItem(EnumHand.MAIN_HAND);
|
||||
if (playerItems[0] != mc.player.getHeldItem(EnumHand.MAIN_HAND)) {
|
||||
playerItems[0] = mc.player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.MAINHAND, playerItems[0]));
|
||||
}
|
||||
|
||||
if (playerItems[1] != player(mc).getHeldItem(EnumHand.OFF_HAND)) {
|
||||
playerItems[1] = player(mc).getHeldItem(EnumHand.OFF_HAND);
|
||||
if (playerItems[1] != mc.player.getHeldItem(EnumHand.OFF_HAND)) {
|
||||
playerItems[1] = mc.player.getHeldItem(EnumHand.OFF_HAND);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.OFFHAND, playerItems[1]));
|
||||
}
|
||||
|
||||
if (playerItems[2] != player(mc).getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
||||
playerItems[2] = player(mc).getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
if (playerItems[2] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
||||
playerItems[2] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.FEET, playerItems[2]));
|
||||
}
|
||||
|
||||
if (playerItems[3] != player(mc).getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
||||
playerItems[3] = player(mc).getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
||||
if (playerItems[3] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
||||
playerItems[3] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.LEGS, playerItems[3]));
|
||||
}
|
||||
|
||||
if (playerItems[4] != player(mc).getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
||||
playerItems[4] = player(mc).getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
if (playerItems[4] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
||||
playerItems[4] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.CHEST, playerItems[4]));
|
||||
}
|
||||
|
||||
if (playerItems[5] != player(mc).getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
||||
playerItems[5] = player(mc).getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
if (playerItems[5] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
||||
playerItems[5] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.HEAD, playerItems[5]));
|
||||
}
|
||||
//#else
|
||||
@@ -320,41 +287,32 @@ public class RecordingEventHandler {
|
||||
|
||||
//Leaving Ride
|
||||
|
||||
//#if MC>=11300
|
||||
if((!player(mc).isPassenger() && lastRiding != -1) ||
|
||||
(player(mc).isPassenger() && lastRiding != getRidingEntity(player(mc)).getEntityId())) {
|
||||
if(!player(mc).isPassenger()) {
|
||||
//#else
|
||||
//$$ if((!player(mc).isRiding() && lastRiding != -1) ||
|
||||
//$$ (player(mc).isRiding() && lastRiding != getRidingEntity(player(mc)).getEntityId())) {
|
||||
//$$ if(!player(mc).isRiding()) {
|
||||
//#endif
|
||||
if((!mc.player.isPassenger() && lastRiding != -1) ||
|
||||
(mc.player.isPassenger() && lastRiding != getRidingEntity(mc.player).getEntityId())) {
|
||||
if(!mc.player.isPassenger()) {
|
||||
lastRiding = -1;
|
||||
} else {
|
||||
lastRiding = getRidingEntity(player(mc)).getEntityId();
|
||||
lastRiding = getRidingEntity(mc.player).getEntityId();
|
||||
}
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketEntityAttach(e.player, getRidingEntity(e.player)));
|
||||
//#else
|
||||
//$$ packetListener.save(new S1BPacketEntityAttach(0, e.player, getRidingEntity(e.player)));
|
||||
//#endif
|
||||
packetListener.save(new SPacketEntityAttach(
|
||||
//#if MC<10904
|
||||
//$$ 0,
|
||||
//#endif
|
||||
e.player, getRidingEntity(e.player)
|
||||
));
|
||||
}
|
||||
|
||||
//Sleeping
|
||||
if(!player(mc).isPlayerSleeping() && wasSleeping) {
|
||||
//#if MC>=10904
|
||||
if(!mc.player.isPlayerSleeping() && wasSleeping) {
|
||||
packetListener.save(new SPacketAnimation(e.player, 2));
|
||||
//#else
|
||||
//$$ packetListener.save(new S0BPacketAnimation(e.player, 2));
|
||||
//#endif
|
||||
wasSleeping = false;
|
||||
}
|
||||
|
||||
//#if MC>=10904
|
||||
// Active hand (e.g. eating, drinking, blocking)
|
||||
if (player(mc).isHandActive() ^ wasHandActive || player(mc).getActiveHand() != lastActiveHand) {
|
||||
wasHandActive = player(mc).isHandActive();
|
||||
lastActiveHand = player(mc).getActiveHand();
|
||||
if (mc.player.isHandActive() ^ wasHandActive || mc.player.getActiveHand() != lastActiveHand) {
|
||||
wasHandActive = mc.player.isHandActive();
|
||||
lastActiveHand = mc.player.getActiveHand();
|
||||
EntityDataManager dataManager = new EntityDataManager(null);
|
||||
int state = (wasHandActive ? 1 : 0) | (lastActiveHand == EnumHand.OFF_HAND ? 2 : 0);
|
||||
//#if MC>=11300
|
||||
@@ -362,7 +320,7 @@ public class RecordingEventHandler {
|
||||
//#else
|
||||
//$$ dataManager.register(EntityLiving.HAND_STATES, (byte) state);
|
||||
//#endif
|
||||
packetListener.save(new SPacketEntityMetadata(player(mc).getEntityId(), dataManager, true));
|
||||
packetListener.save(new SPacketEntityMetadata(mc.player.getEntityId(), dataManager, true));
|
||||
}
|
||||
//#endif
|
||||
|
||||
@@ -392,11 +350,7 @@ public class RecordingEventHandler {
|
||||
//$$ event.pickedUp.getEntityItem().getMaxStackSize()));
|
||||
//#endif
|
||||
//#else
|
||||
//#if MC>=10904
|
||||
//$$ packetListener.save(new SPacketCollectItem(event.pickedUp.getEntityId(), event.player.getEntityId()));
|
||||
//#else
|
||||
//$$ packetListener.save(new S0DPacketCollectItem(event.pickedUp.getEntityId(), event.player.getEntityId()));
|
||||
//#endif
|
||||
//#endif
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -407,13 +361,13 @@ public class RecordingEventHandler {
|
||||
public void onSleep(PlayerSleepInBedEvent event) {
|
||||
try {
|
||||
//#if MC>=10904
|
||||
if (event.getEntityPlayer() != player(mc)) {
|
||||
if (event.getEntityPlayer() != mc.player) {
|
||||
return;
|
||||
}
|
||||
|
||||
packetListener.save(new SPacketUseBed(event.getEntityPlayer(), event.getPos()));
|
||||
//#else
|
||||
//$$ if (event.entityPlayer != player(mc)) {
|
||||
//$$ if (event.entityPlayer != mc.thePlayer) {
|
||||
//$$ return;
|
||||
//$$ }
|
||||
//$$
|
||||
@@ -438,7 +392,7 @@ public class RecordingEventHandler {
|
||||
public void enterMinecart(MinecartInteractEvent event) {
|
||||
try {
|
||||
//#if MC>=10904
|
||||
if(event.getEntity() != player(mc)) {
|
||||
if(event.getEntity() != mc.player) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -446,7 +400,7 @@ public class RecordingEventHandler {
|
||||
|
||||
lastRiding = event.getMinecart().getEntityId();
|
||||
//#else
|
||||
//$$ if(event.entity != player(mc)) {
|
||||
//$$ if(event.entity != mc.thePlayer) {
|
||||
//$$ return;
|
||||
//$$ }
|
||||
//$$
|
||||
@@ -465,19 +419,15 @@ public class RecordingEventHandler {
|
||||
//#else
|
||||
//$$ public void onBlockBreakAnim(int breakerId, int x, int y, int z, int progress) {
|
||||
//#endif
|
||||
EntityPlayer thePlayer = player(mc);
|
||||
EntityPlayer thePlayer = mc.player;
|
||||
if (thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
||||
//#if MC>=10904
|
||||
packetListener.save(new SPacketBlockBreakAnim(breakerId, pos, progress));
|
||||
//#else
|
||||
//$$ packetListener.save(new S25PacketBlockBreakAnim(breakerId,
|
||||
packetListener.save(new SPacketBlockBreakAnim(breakerId,
|
||||
//#if MC>=10800
|
||||
//$$ pos,
|
||||
pos,
|
||||
//#else
|
||||
//$$ x, y, z,
|
||||
//#endif
|
||||
//$$ progress));
|
||||
//#endif
|
||||
progress));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,7 @@ import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.recording.handler.RecordingEventHandler.RecordingEventSender;
|
||||
import net.minecraft.network.login.server.SPacketCustomPayloadLogin;
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraftforge.fml.common.network.FMLNetworkEvent;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
@Mixin(NetHandlerLoginClient.class)
|
||||
|
||||
@@ -12,20 +12,12 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=10904
|
||||
import net.minecraft.network.play.server.SPacketPlayerListItem.Action;
|
||||
import net.minecraft.network.play.server.SPacketPlayerListItem.AddPlayerData;
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.S38PacketPlayerListItem.Action;
|
||||
//$$ import net.minecraft.network.play.server.S38PacketPlayerListItem.AddPlayerData;
|
||||
//#endif
|
||||
import net.minecraft.network.play.server.SPacketPlayerListItem;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
//#endif
|
||||
|
||||
@Mixin(NetHandlerPlayClient.class)
|
||||
@@ -51,20 +43,21 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
*/
|
||||
//#if MC>=10800
|
||||
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
||||
//#if MC>=10809
|
||||
//#if MC>=10904
|
||||
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
||||
//#else
|
||||
//$$ public void recordOwnJoin(S38PacketPlayerListItem packet, CallbackInfo ci) {
|
||||
//#endif
|
||||
if (player(gameController) == null) return;
|
||||
if (gameController.player == null) return;
|
||||
|
||||
RecordingEventHandler handler = getRecordingEventHandler();
|
||||
if (handler != null && packet.getAction() == Action.ADD_PLAYER) {
|
||||
for (AddPlayerData data : packet.getEntries()) {
|
||||
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
||||
//#if MC>=10809
|
||||
List<SPacketPlayerListItem.AddPlayerData> entries = packet.getEntries();
|
||||
//#else
|
||||
//$$ @SuppressWarnings("unchecked")
|
||||
//$$ List<S38PacketPlayerListItem.AddPlayerData> entries = packet.func_179767_a();
|
||||
//#endif
|
||||
for (SPacketPlayerListItem.AddPlayerData data : entries) {
|
||||
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
||||
// Only add spawn packet for our own player and only if he isn't known yet
|
||||
if (data.getProfile().getId().equals(player(gameController).getGameProfile().getId())
|
||||
if (data.getProfile().getId().equals(gameController.player.getGameProfile().getId())
|
||||
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
||||
handler.onPlayerJoin();
|
||||
}
|
||||
@@ -72,25 +65,6 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
}
|
||||
}
|
||||
//#else
|
||||
//$$ public void recordOwnJoin(S38PacketPlayerListItem packet, CallbackInfo ci) {
|
||||
//$$ if (gameController.thePlayer == null) return;
|
||||
//$$
|
||||
//$$ RecordingEventHandler handler = getRecordingEventHandler();
|
||||
//$$ if (handler != null && packet.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
|
||||
//$$ @SuppressWarnings("unchecked")
|
||||
//$$ List<S38PacketPlayerListItem.AddPlayerData> dataList = packet.func_179767_a();
|
||||
//$$ for (S38PacketPlayerListItem.AddPlayerData data : dataList) {
|
||||
//$$ if (data.func_179962_a() == null || data.func_179962_a().getId() == null) continue;
|
||||
//$$ // Only add spawn packet for our own player and only if he isn't known yet
|
||||
//$$ if (data.func_179962_a().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
||||
//$$ && !playerInfoMap.containsKey(data.func_179962_a().getId())) {
|
||||
//$$ handler.onPlayerJoin();
|
||||
//$$ }
|
||||
//$$ }
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
//#else
|
||||
//$$ @Inject(method = "handleJoinGame", at=@At("RETURN"))
|
||||
//$$ public void recordOwnJoin(S01PacketJoinGame packet, CallbackInfo ci) {
|
||||
//$$ RecordingEventHandler handler = getRecordingEventHandler();
|
||||
@@ -108,11 +82,7 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
* @param ci Callback info
|
||||
*/
|
||||
@Inject(method = "handleRespawn", at=@At("RETURN"))
|
||||
//#if MC>=10904
|
||||
public void recordOwnRespawn(SPacketRespawn packet, CallbackInfo ci) {
|
||||
//#else
|
||||
//$$ public void recordOwnRespawn(S07PacketRespawn packet, CallbackInfo ci) {
|
||||
//#endif
|
||||
RecordingEventHandler handler = getRecordingEventHandler();
|
||||
if (handler != null) {
|
||||
handler.onPlayerRespawn();
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
//$$ import com.replaymod.recording.handler.FMLHandshakeFilter;
|
||||
//$$ import io.netty.channel.ChannelPipeline;
|
||||
//$$ import io.netty.channel.embedded.EmbeddedChannel;
|
||||
//$$ import net.minecraftforge.fml.common.network.handshake.FMLHandshakeCodec;
|
||||
//$$ import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||
//$$ import net.minecraftforge.fml.relauncher.Side;
|
||||
//$$ import org.spongepowered.asm.mixin.Mixin;
|
||||
//$$ import org.spongepowered.asm.mixin.Shadow;
|
||||
//$$ import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -17,16 +20,6 @@
|
||||
//$$ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
//#endif
|
||||
//$$
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraftforge.fml.common.network.handshake.FMLHandshakeCodec;
|
||||
//$$ import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||
//$$ import net.minecraftforge.fml.relauncher.Side;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.network.handshake.FMLHandshakeCodec;
|
||||
//$$ import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
|
||||
//$$ import cpw.mods.fml.relauncher.Side;
|
||||
//#endif
|
||||
//$$
|
||||
//$$ @Mixin(value = NetworkDispatcher.class, remap = false)
|
||||
//$$ public abstract class MixinNetworkDispatcher {
|
||||
//$$
|
||||
|
||||
@@ -26,7 +26,7 @@ package com.replaymod.recording.mixin;
|
||||
//$$ @Redirect(method = "onPlayerDestroyBlock", at = @At(value = "INVOKE",
|
||||
//$$ target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
|
||||
//$$ public void replayModRecording_playEvent_fixed(World world, int type, BlockPos pos, int data) {
|
||||
//$$ world.playEvent(player(mc), type, pos, data);
|
||||
//$$ world.playEvent(mc.player, type, pos, data);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
package com.replaymod.recording.mixin;
|
||||
|
||||
import com.replaymod.recording.handler.RecordingEventHandler;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
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;
|
||||
|
||||
//#if MC>=11300
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.renderer.RenderGlobal;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10904
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraft.util.BlockPos;
|
||||
//#endif
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11300
|
||||
@Mixin(WorldRenderer.class)
|
||||
//#else
|
||||
//$$ @Mixin(RenderGlobal.class)
|
||||
//#endif
|
||||
public abstract class MixinRenderGlobal implements RecordingEventHandler.RecordingEventSender {
|
||||
|
||||
private RecordingEventHandler recordingEventHandler;
|
||||
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.world.storage.WorldSavedDataStorage;
|
||||
//$$ import net.minecraft.world.WorldProvider;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
@Mixin(WorldClient.class)
|
||||
public abstract class MixinWorldClient extends World implements RecordingEventHandler.RecordingEventSender {
|
||||
@@ -62,7 +61,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
||||
at = @At("HEAD"))
|
||||
public void replayModRecording_recordClientSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category,
|
||||
float volume, float pitch, CallbackInfo ci) {
|
||||
if (player == player(mc)) {
|
||||
if (player == mc.player) {
|
||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||
if (handler != null) {
|
||||
handler.onClientSound(sound, category, x, y, z, volume, pitch);
|
||||
@@ -74,7 +73,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
||||
// These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
||||
@Override
|
||||
public void playEvent(EntityPlayer player, int type, BlockPos pos, int data) {
|
||||
if (player == player(mc)) {
|
||||
if (player == mc.player) {
|
||||
// We caused this event, the server won't send it to us
|
||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||
if (handler != null) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.network.EnumConnectionState;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.server.*;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -30,10 +31,8 @@ import net.minecraft.network.login.server.SPacketLoginSuccess;
|
||||
|
||||
//#if MC>=10904
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
//#else
|
||||
//$$ import net.minecraft.entity.DataWatcher;
|
||||
//$$ import net.minecraft.util.ChatComponentText;
|
||||
//$$
|
||||
//$$ import java.util.List;
|
||||
//#endif
|
||||
@@ -125,21 +124,12 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
public void save(Packet packet) {
|
||||
try {
|
||||
//#if MC>=10904
|
||||
if(packet instanceof SPacketSpawnPlayer) {
|
||||
UUID uuid = ((SPacketSpawnPlayer) packet).getUniqueId();
|
||||
//#else
|
||||
//$$ if(packet instanceof S0CPacketSpawnPlayer) {
|
||||
//#if MC>=10809
|
||||
//$$ UUID uuid = ((S0CPacketSpawnPlayer) packet).getPlayer();
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ UUID uuid = ((S0CPacketSpawnPlayer) packet).func_179819_c();
|
||||
UUID uuid = ((SPacketSpawnPlayer) packet).getUniqueId();
|
||||
//#else
|
||||
//$$ UUID uuid = ((S0CPacketSpawnPlayer) packet).field_148955_b.getId();
|
||||
//#endif
|
||||
//#endif
|
||||
//#endif
|
||||
Set<String> uuids = new HashSet<>(Arrays.asList(metaData.getPlayers()));
|
||||
uuids.add(uuid.toString());
|
||||
metaData.setPlayers(uuids.toArray(new String[uuids.size()]));
|
||||
@@ -238,15 +228,15 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
//#if MC>=10904
|
||||
if(packet instanceof SPacketCollectItem) {
|
||||
if(player(mc) != null ||
|
||||
((SPacketCollectItem) packet).getEntityID() == player(mc).getEntityId()) {
|
||||
if(mc.player != null ||
|
||||
((SPacketCollectItem) packet).getEntityID() == mc.player.getEntityId()) {
|
||||
//#else
|
||||
//$$ if(packet instanceof S0DPacketCollectItem) {
|
||||
//$$ if(player(mc) != null ||
|
||||
//$$ if(mc.thePlayer != null ||
|
||||
//#if MC>=10809
|
||||
//$$ ((S0DPacketCollectItem) packet).getEntityID() == player(mc).getEntityId()) {
|
||||
//$$ ((S0DPacketCollectItem) packet).getEntityID() == mc.thePlayer.getEntityId()) {
|
||||
//#else
|
||||
//$$ ((S0DPacketCollectItem) packet).func_149353_d() == player(mc).getEntityId()) {
|
||||
//$$ ((S0DPacketCollectItem) packet).func_149353_d() == mc.thePlayer.getEntityId()) {
|
||||
//#endif
|
||||
//#endif
|
||||
super.channelRead(ctx, msg);
|
||||
@@ -254,18 +244,12 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=10904
|
||||
//#if MC>=10800
|
||||
if (packet instanceof SPacketResourcePackSend) {
|
||||
save(resourcePackRecorder.handleResourcePack((SPacketResourcePackSend) packet));
|
||||
return;
|
||||
}
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ if (packet instanceof S48PacketResourcePackSend) {
|
||||
//$$ save(resourcePackRecorder.handleResourcePack((S48PacketResourcePackSend) packet));
|
||||
//$$ return;
|
||||
//$$ }
|
||||
//#else
|
||||
//$$ if (packet instanceof S3FPacketCustomPayload) {
|
||||
//$$ S3FPacketCustomPayload p = (S3FPacketCustomPayload) packet;
|
||||
//$$ if ("MC|RPack".equals(p.func_149169_c())) {
|
||||
@@ -274,7 +258,6 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
//#if MC<11300
|
||||
//$$ if (packet instanceof FMLProxyPacket) {
|
||||
@@ -291,22 +274,10 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
save(packet);
|
||||
|
||||
//#if MC>=10904
|
||||
if (packet instanceof SPacketCustomPayload) {
|
||||
SPacketCustomPayload p = (SPacketCustomPayload) packet;
|
||||
if (Restrictions.PLUGIN_CHANNEL.equals(p.getChannelName())) {
|
||||
packet = new SPacketDisconnect(new TextComponentString("Please update to view this replay."));
|
||||
//#else
|
||||
//$$ if (packet instanceof S3FPacketCustomPayload) {
|
||||
//$$ S3FPacketCustomPayload p = (S3FPacketCustomPayload) packet;
|
||||
//#if MC>=10800
|
||||
//$$ String channelName = p.getChannelName();
|
||||
//#else
|
||||
//$$ String channelName = p.func_149169_c();
|
||||
//#endif
|
||||
//$$ if (Restrictions.PLUGIN_CHANNEL.equals(channelName)) {
|
||||
//$$ packet = new S40PacketDisconnect(new ChatComponentText("Please update to view this replay."));
|
||||
//#endif
|
||||
save(packet);
|
||||
}
|
||||
}
|
||||
@@ -395,7 +366,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
||||
writeVarInt(packetBuffer, packetId);
|
||||
packetBuffer.writeVarInt(packetId);
|
||||
packet.writePacketData(packetBuffer);
|
||||
|
||||
byteBuf.readerIndex(0);
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.multiplayer.ServerList;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -20,17 +21,10 @@ import net.minecraft.client.resources.DownloadingPackFinder;
|
||||
//$$ import net.minecraft.util.HttpUtil;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10904
|
||||
//#if MC>=10800
|
||||
import net.minecraft.network.play.client.CPacketResourcePackStatus;
|
||||
import net.minecraft.network.play.client.CPacketResourcePackStatus.Action;
|
||||
import net.minecraft.network.play.server.SPacketResourcePackSend;
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ import net.minecraft.network.play.client.C19PacketResourcePackStatus;
|
||||
//$$ import net.minecraft.network.play.client.C19PacketResourcePackStatus.Action;
|
||||
//$$ import net.minecraft.network.play.server.S48PacketResourcePackSend;
|
||||
//#else
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
@@ -106,7 +100,6 @@ public class ResourcePackRecorder {
|
||||
}
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=10904
|
||||
public CPacketResourcePackStatus makeStatusPacket(String hash, Action action) {
|
||||
//#if MC>=11002
|
||||
return new CPacketResourcePackStatus(action);
|
||||
@@ -114,32 +107,18 @@ public class ResourcePackRecorder {
|
||||
//$$ return new CPacketResourcePackStatus(hash, action);
|
||||
//#endif
|
||||
}
|
||||
//#else
|
||||
//$$ public C19PacketResourcePackStatus makeStatusPacket(String hash, Action action) {
|
||||
//$$ return new C19PacketResourcePackStatus(hash, action);
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
|
||||
//#if MC>=10904
|
||||
public synchronized SPacketResourcePackSend handleResourcePack(SPacketResourcePackSend packet) {
|
||||
//#else
|
||||
//$$ public synchronized S48PacketResourcePackSend handleResourcePack(S48PacketResourcePackSend packet) {
|
||||
//#endif
|
||||
final int requestId = nextRequestId++;
|
||||
final NetHandlerPlayClient netHandler = getConnection(mc);
|
||||
final NetHandlerPlayClient netHandler = mc.getConnection();
|
||||
final NetworkManager netManager = netHandler.getNetworkManager();
|
||||
//#if MC>=10809
|
||||
final String url = packet.getURL();
|
||||
final String hash = packet.getHash();
|
||||
//#else
|
||||
//$$ final String url = packet.func_179783_a();
|
||||
//$$ final String hash = packet.func_179784_b();
|
||||
//#endif
|
||||
|
||||
if (url.startsWith("level://")) {
|
||||
String levelName = url.substring("level://".length());
|
||||
File savesDir = new File(mcDataDir(mc), "saves");
|
||||
File savesDir = new File(mc.gameDir, "saves");
|
||||
final File levelDir = new File(savesDir, levelName);
|
||||
|
||||
if (levelDir.isFile()) {
|
||||
@@ -186,30 +165,26 @@ public class ResourcePackRecorder {
|
||||
netManager.sendPacket(makeStatusPacket(hash, Action.DECLINED));
|
||||
}
|
||||
|
||||
ServerList_saveSingleServer(serverData);
|
||||
ServerList.saveSingleServer(serverData);
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
}, I18n.format("multiplayer.texturePrompt.line1"), I18n.format("multiplayer.texturePrompt.line2"), 0)));
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=10904
|
||||
return new SPacketResourcePackSend("replay://" + requestId, "");
|
||||
//#else
|
||||
//$$ return new S48PacketResourcePackSend("replay://" + requestId, "");
|
||||
//#endif
|
||||
}
|
||||
|
||||
private void downloadResourcePackFuture(int requestId, String url, final String hash) {
|
||||
Futures.addCallback(downloadResourcePack(requestId, url, hash), new FutureCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
sendPacket(getConnection(mc), makeStatusPacket(hash, Action.SUCCESSFULLY_LOADED));
|
||||
mc.getConnection().sendPacket(makeStatusPacket(hash, Action.SUCCESSFULLY_LOADED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@Nonnull Throwable throwable) {
|
||||
sendPacket(getConnection(mc), makeStatusPacket(hash, Action.FAILED_DOWNLOAD));
|
||||
mc.getConnection().sendPacket(makeStatusPacket(hash, Action.FAILED_DOWNLOAD));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user