Update to 1.8.9
This commit is contained in:
@@ -12,7 +12,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -41,14 +40,12 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
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;
|
||||
if (handler != null && packet.getAction() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
|
||||
for (S38PacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
||||
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.func_179962_a().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
||||
&& !playerInfoMap.containsKey(data.func_179962_a().getId())) {
|
||||
if (data.getProfile().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
||||
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
||||
handler.onPlayerJoin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
public void save(Packet packet) {
|
||||
try {
|
||||
if(packet instanceof S0CPacketSpawnPlayer) {
|
||||
UUID uuid = ((S0CPacketSpawnPlayer) packet).func_179819_c();
|
||||
UUID uuid = ((S0CPacketSpawnPlayer) packet).getPlayer();
|
||||
Set<String> uuids = new HashSet<>(Arrays.asList(metaData.getPlayers()));
|
||||
uuids.add(uuid.toString());
|
||||
metaData.setPlayers(uuids.toArray(new String[uuids.size()]));
|
||||
@@ -153,7 +153,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
if(packet instanceof S0DPacketCollectItem) {
|
||||
if(mc.thePlayer != null ||
|
||||
((S0DPacketCollectItem) packet).func_149353_d() == mc.thePlayer.getEntityId()) {
|
||||
((S0DPacketCollectItem) packet).getEntityID() == mc.thePlayer.getEntityId()) {
|
||||
super.channelRead(ctx, msg);
|
||||
return;
|
||||
}
|
||||
@@ -205,11 +205,11 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
|
||||
if(packet instanceof S0CPacketSpawnPlayer) {
|
||||
S0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet;
|
||||
if (p.field_148960_i == null) {
|
||||
p.field_148960_i = new DataWatcher(null);
|
||||
if (p.watcher == null) {
|
||||
p.watcher = new DataWatcher(null);
|
||||
if(p.func_148944_c() != null) {
|
||||
for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>) p.func_148944_c()) {
|
||||
p.field_148960_i.addObject(wo.getDataValueId(), wo.getObject());
|
||||
for(DataWatcher.WatchableObject wo : p.func_148944_c()) {
|
||||
p.watcher.addObject(wo.getDataValueId(), wo.getObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ public class ResourcePackRecorder {
|
||||
final int requestId = nextRequestId++;
|
||||
final NetHandlerPlayClient netHandler = mc.getNetHandler();
|
||||
final NetworkManager netManager = netHandler.getNetworkManager();
|
||||
final String url = packet.func_179783_a();
|
||||
final String hash = packet.func_179784_b();
|
||||
final String url = packet.getURL();
|
||||
final String hash = packet.getHash();
|
||||
|
||||
if (url.startsWith("level://")) {
|
||||
String levelName = url.substring("level://".length());
|
||||
@@ -84,7 +84,7 @@ public class ResourcePackRecorder {
|
||||
|
||||
if (levelDir.isFile()) {
|
||||
netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.ACCEPTED));
|
||||
Futures.addCallback(mc.getResourcePackRepository().func_177319_a(levelDir), new FutureCallback() {
|
||||
Futures.addCallback(mc.getResourcePackRepository().setResourcePackInstance(levelDir), new FutureCallback<Object>() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
recordResourcePack(levelDir, requestId);
|
||||
@@ -161,16 +161,16 @@ public class ResourcePackRecorder {
|
||||
}
|
||||
|
||||
final File file = new File(repo.dirServerResourcepacks, fileName);
|
||||
repo.field_177321_h.lock();
|
||||
repo.lock.lock();
|
||||
try {
|
||||
repo.func_148529_f();
|
||||
repo.clearResourcePack();
|
||||
|
||||
if (file.exists() && hash.length() == 40) {
|
||||
try {
|
||||
String fileHash = Hashing.sha1().hashBytes(Files.toByteArray(file)).toString();
|
||||
if (fileHash.equals(hash)) {
|
||||
recordResourcePack(file, requestId);
|
||||
return repo.func_177319_a(file);
|
||||
return repo.setResourcePackInstance(file);
|
||||
}
|
||||
|
||||
logger.warn("File " + file + " had wrong hash (expected " + hash + ", found " + fileHash + "). Deleting it.");
|
||||
@@ -186,13 +186,13 @@ public class ResourcePackRecorder {
|
||||
|
||||
Futures.getUnchecked(mc.addScheduledTask(() -> mc.displayGuiScreen(guiScreen)));
|
||||
|
||||
Map sessionInfo = Minecraft.getSessionInfo();
|
||||
repo.field_177322_i = HttpUtil.func_180192_a(file, url, sessionInfo, 50 * 1024 * 1024, guiScreen, mc.getProxy());
|
||||
Futures.addCallback(repo.field_177322_i, new FutureCallback() {
|
||||
Map<String, String> sessionInfo = Minecraft.getSessionInfo();
|
||||
repo.downloadingPacks = HttpUtil.downloadResourcePack(file, url, sessionInfo, 50 * 1024 * 1024, guiScreen, mc.getProxy());
|
||||
Futures.addCallback(repo.downloadingPacks, new FutureCallback<Object>() {
|
||||
@Override
|
||||
public void onSuccess(Object value) {
|
||||
recordResourcePack(file, requestId);
|
||||
repo.func_177319_a(file);
|
||||
repo.setResourcePackInstance(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,9 +200,9 @@ public class ResourcePackRecorder {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
return repo.field_177322_i;
|
||||
return repo.downloadingPacks;
|
||||
} finally {
|
||||
repo.field_177321_h.unlock();
|
||||
repo.lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user