fix more problems

This commit is contained in:
Marco 2019-05-19 20:47:05 +02:00
parent 3706b72855
commit 2c66e21268
3 changed files with 45 additions and 7 deletions

View File

@ -39,6 +39,8 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
registerOutgoing(State.PLAY, 0x17, 0x18);
registerOutgoing(State.PLAY, 0x18, 0x19);
registerOutgoing(State.PLAY, 0x19, 0x1A);
registerOutgoing(State.PLAY, 0x1A, 0x1B);
registerOutgoing(State.PLAY, 0x1B, 0x1C);
@ -90,6 +92,31 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
registerOutgoing(State.PLAY, 0x55, 0x4F); // c
registerOutgoing(State.PLAY, 0x56, 0x50); // c
//Update View Position
registerOutgoing(State.PLAY, 0x40, -1, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper packetWrapper) throws Exception {
packetWrapper.cancel();
}
});
}
});
//Update View Distance
registerOutgoing(State.PLAY, 0x41, -1, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper packetWrapper) throws Exception {
packetWrapper.cancel();
}
});
}
});
registerOutgoing(State.PLAY, 0x57, 0x51, new PacketRemapper() { // c
@Override
public void registerMap() {

View File

@ -26,11 +26,18 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.StringTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
import java.util.Arrays;
import java.util.Set;
public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14> {
private static String NBT_TAG_NAME = "ViaBackwards|" + Protocol1_13_2To1_14.class.getSimpleName();
private static byte[] fullLight = new byte[2048];
static {
Arrays.fill(fullLight, (byte) 0xFF);
}
@Override
protected void registerPackets(Protocol1_13_2To1_14 protocol) {
// Open window
@ -415,9 +422,10 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
for (ChunkSection section : chunk.getSections()) {
if (section == null) continue;
section.setBlockLight(new byte[2048]);
section.setBlockLight(fullLight);
if (clientWorld.getEnvironment() == Environment.NORMAL) {
section.setSkyLight(new byte[2048]);
section.setSkyLight(fullLight);
}
for (int i = 0; i < section.getPaletteSize(); i++) {
int old = section.getPaletteEntry(i);

View File

@ -2,6 +2,7 @@ package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.packets;
import nl.matsv.viabackwards.ViaBackwards;
import nl.matsv.viabackwards.api.entities.storage.EntityData;
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
import nl.matsv.viabackwards.api.entities.types.AbstractEntityType;
import nl.matsv.viabackwards.api.entities.types.EntityType1_13;
@ -25,7 +26,6 @@ import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import java.util.LinkedList;
@ -228,7 +228,7 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0))
wrapper.user().get(EntityTracker.class).removeEntity(entity);
wrapper.user().get(EntityTracker.class).get(protocol).removeEntity(entity);
}
});
}
@ -280,6 +280,8 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
wrapper.write(Type.UNSIGNED_BYTE, (short) 0);
wrapper.passthrough(Type.UNSIGNED_BYTE); // Max Players
wrapper.passthrough(Type.STRING); // Level Type
wrapper.read(Type.VAR_INT); //Read View Distance
}
});
@ -313,9 +315,10 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
if (e.getIndex() > 6) e.getData().setId(e.getIndex() - 1);
return e.getData();
});
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 13).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 14).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 15).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 17).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 18).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 19).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 20).removed();
// Villager data -> var int
registerMetaHandler().handle(e -> {
if (e.getData().getValue() instanceof VillagerData) {