Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-27 08:30:10 +01:00
1.16-pre1
Dieser Commit ist enthalten in:
Ursprung
eec16eb5bb
Commit
d334a202e7
@ -224,8 +224,8 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
/**
|
/**
|
||||||
* Helper method to handle player, painting, or xp orb trackers without meta changes.
|
* Helper method to handle player, painting, or xp orb trackers without meta changes.
|
||||||
*/
|
*/
|
||||||
protected void registerExtraTracker(int packetId, EntityType entityType, Type intType) {
|
protected void registerExtraTracker(int oldId, int newId, EntityType entityType, Type intType) {
|
||||||
getProtocol().registerOutgoing(State.PLAY, packetId, packetId, new PacketRemapper() {
|
getProtocol().registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(intType); // 0 - Entity id
|
map(intType); // 0 - Entity id
|
||||||
@ -234,6 +234,14 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void registerExtraTracker(int packetId, EntityType entityType, Type intType) {
|
||||||
|
registerExtraTracker(packetId, packetId, entityType, intType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void registerExtraTracker(int oldId, int newId, EntityType entityType) {
|
||||||
|
registerExtraTracker(oldId, newId, entityType, Type.VAR_INT);
|
||||||
|
}
|
||||||
|
|
||||||
protected void registerExtraTracker(int packetId, EntityType entityType) {
|
protected void registerExtraTracker(int packetId, EntityType entityType) {
|
||||||
registerExtraTracker(packetId, entityType, Type.VAR_INT);
|
registerExtraTracker(packetId, entityType, Type.VAR_INT);
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, BackwardsMappings::init);
|
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, BackwardsMappings::init);
|
||||||
|
|
||||||
translatableRewriter = new TranslatableRewriter1_16(this);
|
translatableRewriter = new TranslatableRewriter1_16(this);
|
||||||
translatableRewriter.registerBossBar(0x0D, 0x0D);
|
translatableRewriter.registerBossBar(0x0C, 0x0D);
|
||||||
translatableRewriter.registerCombatEvent(0x33, 0x33);
|
translatableRewriter.registerCombatEvent(0x32, 0x33);
|
||||||
translatableRewriter.registerDisconnect(0x1B, 0x1B);
|
translatableRewriter.registerDisconnect(0x1A, 0x1B);
|
||||||
translatableRewriter.registerPlayerList(0x54, 0x54);
|
translatableRewriter.registerPlayerList(0x53, 0x54);
|
||||||
translatableRewriter.registerTitle(0x50, 0x50);
|
translatableRewriter.registerTitle(0x4F, 0x50);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
|
|
||||||
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
||||||
@ -42,7 +42,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
entityPackets.register();
|
entityPackets.register();
|
||||||
|
|
||||||
// Chat Message
|
// Chat Message
|
||||||
registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x0E, 0x0F, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
||||||
@ -52,7 +52,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Open Window
|
// Open Window
|
||||||
registerOutgoing(State.PLAY, 0x2F, 0x2F, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x2E, 0x2F, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Window Id
|
map(Type.VAR_INT); // Window Id
|
||||||
@ -71,10 +71,10 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
|
|
||||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||||
soundRewriter.registerSound(0x51, 0x51);
|
soundRewriter.registerSound(0x50, 0x51);
|
||||||
soundRewriter.registerSound(0x52, 0x52);
|
soundRewriter.registerSound(0x51, 0x52);
|
||||||
soundRewriter.registerNamedSound(0x1A, 0x1A);
|
soundRewriter.registerNamedSound(0x10, 0x1A);
|
||||||
soundRewriter.registerStopSound(0x53, 0x53);
|
soundRewriter.registerStopSound(0x52, 0x53);
|
||||||
|
|
||||||
// Login success
|
// Login success
|
||||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||||
@ -89,7 +89,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Advancements
|
// Advancements
|
||||||
registerOutgoing(State.PLAY, 0x58, 0x58, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x57, 0x58, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -129,18 +129,54 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> {
|
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> {
|
||||||
Integer oldId = MappingData.oldToNewItems.inverse().get(id);
|
Integer oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||||
return oldId != null ? oldId : -1;
|
return oldId != null ? oldId : -1;
|
||||||
}, entityPackets::getOldEntityId).register(0x5C, 0x5C);
|
}, entityPackets::getOldEntityId).register(0x5B, 0x5C);
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x43, 0x4E);
|
registerOutgoing(State.PLAY, 0x05, 0x06);
|
||||||
registerOutgoing(State.PLAY, 0x44, 0x43);
|
registerOutgoing(State.PLAY, 0x06, 0x07);
|
||||||
registerOutgoing(State.PLAY, 0x46, 0x45);
|
registerOutgoing(State.PLAY, 0x08, 0x09);
|
||||||
registerOutgoing(State.PLAY, 0x47, 0x46);
|
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
||||||
registerOutgoing(State.PLAY, 0x49, 0x48);
|
registerOutgoing(State.PLAY, 0x0D, 0x0E);
|
||||||
registerOutgoing(State.PLAY, 0x4A, 0x49);
|
registerOutgoing(State.PLAY, 0x11, 0x12);
|
||||||
registerOutgoing(State.PLAY, 0x4B, 0x4A);
|
registerOutgoing(State.PLAY, 0x12, 0x13);
|
||||||
registerOutgoing(State.PLAY, 0x4C, 0x4B);
|
registerOutgoing(State.PLAY, 0x13, 0x14);
|
||||||
registerOutgoing(State.PLAY, 0x4D, 0x4C);
|
registerOutgoing(State.PLAY, 0x18, 0x19);
|
||||||
registerOutgoing(State.PLAY, 0x4E, 0x4D);
|
registerOutgoing(State.PLAY, 0x19, 0x1A);
|
||||||
|
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
||||||
|
registerOutgoing(State.PLAY, 0x1C, 0x1D);
|
||||||
|
registerOutgoing(State.PLAY, 0x1D, 0x1E);
|
||||||
|
registerOutgoing(State.PLAY, 0x1E, 0x1F);
|
||||||
|
registerOutgoing(State.PLAY, 0x1F, 0x20);
|
||||||
|
registerOutgoing(State.PLAY, 0x20, 0x21);
|
||||||
|
registerOutgoing(State.PLAY, 0x24, 0x25);
|
||||||
|
registerOutgoing(State.PLAY, 0x26, 0x27);
|
||||||
|
registerOutgoing(State.PLAY, 0x28, 0x29);
|
||||||
|
registerOutgoing(State.PLAY, 0x29, 0x2A);
|
||||||
|
registerOutgoing(State.PLAY, 0x2A, 0x2B);
|
||||||
|
registerOutgoing(State.PLAY, 0x2B, 0x2C);
|
||||||
|
registerOutgoing(State.PLAY, 0x2C, 0x2D);
|
||||||
|
registerOutgoing(State.PLAY, 0x2D, 0x2E);
|
||||||
|
registerOutgoing(State.PLAY, 0x2F, 0x30);
|
||||||
|
registerOutgoing(State.PLAY, 0x30, 0x31);
|
||||||
|
registerOutgoing(State.PLAY, 0x31, 0x32);
|
||||||
|
registerOutgoing(State.PLAY, 0x33, 0x34);
|
||||||
|
registerOutgoing(State.PLAY, 0x34, 0x35);
|
||||||
|
registerOutgoing(State.PLAY, 0x35, 0x36);
|
||||||
|
registerOutgoing(State.PLAY, 0x36, 0x37);
|
||||||
|
registerOutgoing(State.PLAY, 0x38, 0x39);
|
||||||
|
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
||||||
|
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
||||||
|
registerOutgoing(State.PLAY, 0x3C, 0x3D);
|
||||||
|
registerOutgoing(State.PLAY, 0x3D, 0x3E);
|
||||||
|
registerOutgoing(State.PLAY, 0x3E, 0x3F);
|
||||||
|
registerOutgoing(State.PLAY, 0x3F, 0x40);
|
||||||
|
registerOutgoing(State.PLAY, 0x40, 0x41);
|
||||||
|
registerOutgoing(State.PLAY, 0x41, 0x42);
|
||||||
|
registerOutgoing(State.PLAY, 0x42, 0x4E);
|
||||||
|
registerOutgoing(State.PLAY, 0x4E, 0x4F);
|
||||||
|
registerOutgoing(State.PLAY, 0x54, 0x55);
|
||||||
|
registerOutgoing(State.PLAY, 0x55, 0x56);
|
||||||
|
registerOutgoing(State.PLAY, 0x56, 0x57);
|
||||||
|
registerOutgoing(State.PLAY, 0x59, 0x5A);
|
||||||
|
|
||||||
cancelIncoming(State.PLAY, 0x27); // Set jigsaw
|
cancelIncoming(State.PLAY, 0x27); // Set jigsaw
|
||||||
registerIncoming(State.PLAY, 0x10, 0x0F);
|
registerIncoming(State.PLAY, 0x10, 0x0F);
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.chat;
|
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.chat;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import us.myles.viaversion.libs.gson.JsonArray;
|
||||||
import us.myles.viaversion.libs.gson.JsonElement;
|
import us.myles.viaversion.libs.gson.JsonElement;
|
||||||
import us.myles.viaversion.libs.gson.JsonObject;
|
import us.myles.viaversion.libs.gson.JsonObject;
|
||||||
|
import us.myles.viaversion.libs.gson.JsonPrimitive;
|
||||||
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||||
|
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -28,6 +33,32 @@ public class TagSerializer {
|
|||||||
return builder.append('}').toString();
|
return builder.append('}').toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to convert a CompoundTag to a JsonObject, helpful for debugging.
|
||||||
|
*/
|
||||||
|
public static JsonObject toJson(CompoundTag tag) {
|
||||||
|
JsonObject object = new JsonObject();
|
||||||
|
for (Map.Entry<String, Tag> entry : tag.getValue().entrySet()) {
|
||||||
|
object.add(entry.getKey(), toJson(entry.getValue()));
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JsonElement toJson(Tag tag) {
|
||||||
|
if (tag instanceof CompoundTag) {
|
||||||
|
return toJson((CompoundTag) tag);
|
||||||
|
} else if (tag instanceof ListTag) {
|
||||||
|
ListTag list = (ListTag) tag;
|
||||||
|
JsonArray array = new JsonArray();
|
||||||
|
for (Tag listEntry : list) {
|
||||||
|
array.add(toJson(listEntry));
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
} else {
|
||||||
|
return new JsonPrimitive(tag.getValue().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String escape(String s) {
|
public static String escape(String s) {
|
||||||
if (PLAIN_TEXT.matcher(s).matches()) return s;
|
if (PLAIN_TEXT.matcher(s).matches()) return s;
|
||||||
|
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.api.rewriters.ItemRewriterBase;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
||||||
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.packets.State;
|
||||||
|
|
||||||
|
public class RecipeRewriter1_16 extends RecipeRewriter1_15 {
|
||||||
|
|
||||||
|
public RecipeRewriter1_16(ItemRewriterBase rewriter) {
|
||||||
|
super(rewriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register(int oldId, int newId) {
|
||||||
|
// Remove new smithing type, only in this handler
|
||||||
|
rewriter.getProtocol().registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
int size = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
int newSize = size;
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String originalType = wrapper.read(Type.STRING);
|
||||||
|
String type = originalType.replace("minecraft:", "");
|
||||||
|
if (type.equals("smithing")) {
|
||||||
|
newSize--;
|
||||||
|
|
||||||
|
wrapper.read(Type.STRING);
|
||||||
|
wrapper.read(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT);
|
||||||
|
wrapper.read(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT);
|
||||||
|
wrapper.read(Type.FLAT_VAR_INT_ITEM);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(Type.STRING, originalType);
|
||||||
|
String id = wrapper.passthrough(Type.STRING); // Recipe Identifier
|
||||||
|
handle(wrapper, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.set(Type.VAR_INT, 0, newSize);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper, String type) throws Exception {
|
||||||
|
switch (type) {
|
||||||
|
case "crafting_shapeless":
|
||||||
|
handleCraftingShapeless(wrapper);
|
||||||
|
break;
|
||||||
|
case "crafting_shaped":
|
||||||
|
handleCraftingShaped(wrapper);
|
||||||
|
break;
|
||||||
|
case "blasting":
|
||||||
|
case "smoking":
|
||||||
|
case "campfire_cooking":
|
||||||
|
case "smelting":
|
||||||
|
handleSmelting(wrapper);
|
||||||
|
break;
|
||||||
|
case "stonecutting":
|
||||||
|
handleStonecutting(wrapper);
|
||||||
|
break;
|
||||||
|
case "smithing": // new
|
||||||
|
handleSmithing(wrapper);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSmithing(PacketWrapper wrapper) throws Exception {
|
||||||
|
Item[] baseIngredients = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT);
|
||||||
|
for (Item item : baseIngredients) {
|
||||||
|
rewriter.handleItemToClient(item);
|
||||||
|
}
|
||||||
|
Item[] ingredients = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT);
|
||||||
|
for (Item item : ingredients) {
|
||||||
|
rewriter.handleItemToClient(item);
|
||||||
|
}
|
||||||
|
rewriter.handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.RecipeRewriter1_16;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
@ -43,27 +44,19 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_15_2To1_16::getNewBlockStateId, Protocol1_15_2To1_16::getNewBlockId);
|
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_15_2To1_16::getNewBlockStateId, Protocol1_15_2To1_16::getNewBlockId);
|
||||||
|
|
||||||
// Declare Recipes
|
// Declare Recipes
|
||||||
new RecipeRewriter1_15(this).registerDefaultHandler(0x5B, 0x5B);
|
new RecipeRewriter1_16(this).register(0x5A, 0x5B);
|
||||||
|
|
||||||
// Edit Book
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set cooldown
|
// Set cooldown
|
||||||
itemRewriter.registerSetCooldown(0x18, 0x18, BlockItemPackets1_16::getOldItemId);
|
itemRewriter.registerSetCooldown(0x17, 0x18, BlockItemPackets1_16::getOldItemId);
|
||||||
|
|
||||||
// Window items packet
|
// Window items packet
|
||||||
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x15, 0x15);
|
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x14, 0x15);
|
||||||
|
|
||||||
// Set slot packet
|
// Set slot packet
|
||||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x17);
|
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x16, 0x17);
|
||||||
|
|
||||||
// Trade list
|
// Trade list
|
||||||
protocol.out(State.PLAY, 0x28, 0x28, new PacketRemapper() {
|
protocol.out(State.PLAY, 0x27, 0x28, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -100,28 +93,22 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
// Entity Equipment Packet
|
||||||
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x48, 0x47);
|
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47);
|
||||||
|
|
||||||
// Click window packet
|
|
||||||
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);
|
|
||||||
|
|
||||||
// Creative Inventory Action
|
|
||||||
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x27, 0x26);
|
|
||||||
|
|
||||||
// Acknowledge player digging
|
// Acknowledge player digging
|
||||||
blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x08);
|
blockRewriter.registerAcknowledgePlayerDigging(0x07, 0x08);
|
||||||
|
|
||||||
// Block Action
|
// Block Action
|
||||||
blockRewriter.registerBlockAction(0x0B, 0x0B);
|
blockRewriter.registerBlockAction(0x0A, 0x0B);
|
||||||
|
|
||||||
// Block Change
|
// Block Change
|
||||||
blockRewriter.registerBlockChange(0x0C, 0x0C);
|
blockRewriter.registerBlockChange(0x0B, 0x0C);
|
||||||
|
|
||||||
// Multi Block Change
|
// Multi Block Change
|
||||||
blockRewriter.registerMultiBlockChange(0x10, 0x10);
|
blockRewriter.registerMultiBlockChange(0x0F, 0x10);
|
||||||
|
|
||||||
// Chunk
|
// Chunk
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x21, 0x22, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -191,14 +178,14 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Effect packet
|
// Effect packet
|
||||||
blockRewriter.registerEffect(0x23, 0x23, 1010, 2001, BlockItemPackets1_16::getOldItemId);
|
blockRewriter.registerEffect(0x22, 0x23, 1010, 2001, BlockItemPackets1_16::getOldItemId);
|
||||||
|
|
||||||
// Spawn particle
|
// Spawn particle
|
||||||
blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x24, 3, 23, 32,
|
blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x23, 0x24, 3, 23, 32,
|
||||||
BlockItemPackets1_16::getNewParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM);
|
BlockItemPackets1_16::getNewParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Window Property
|
// Window Property
|
||||||
protocol.registerOutgoing(State.PLAY, 0x16, 0x16, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x15, 0x16, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Window id
|
map(Type.UNSIGNED_BYTE); // Window id
|
||||||
@ -217,6 +204,20 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Click window packet
|
||||||
|
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);
|
||||||
|
|
||||||
|
// Creative Inventory Action
|
||||||
|
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x27, 0x26);
|
||||||
|
|
||||||
|
// Edit Book
|
||||||
|
protocol.registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewParticleId(int id) {
|
public static int getNewParticleId(int id) {
|
||||||
|
@ -47,10 +47,10 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
||||||
|
|
||||||
// Spawn mob packet
|
// Spawn mob packet
|
||||||
registerSpawnTracker(0x03, 0x03);
|
registerSpawnTracker(0x02, 0x03);
|
||||||
|
|
||||||
// Respawn
|
// Respawn
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3B, 0x3B, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x3A, 0x3B, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(dimensionTransformer); // Dimension Type
|
map(dimensionTransformer); // Dimension Type
|
||||||
@ -72,7 +72,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Join Game
|
// Join Game
|
||||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x25, 0x26, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Entity ID
|
map(Type.INT); // Entity ID
|
||||||
@ -105,23 +105,22 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
// Spawn Experience Orb
|
// Spawn Experience Orb
|
||||||
registerExtraTracker(0x01, Entity1_16Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(0x01, Entity1_16Types.EntityType.EXPERIENCE_ORB);
|
||||||
|
|
||||||
// Spawn Global Object
|
// F Spawn Global Object, it is no longer with us :(
|
||||||
registerExtraTracker(0x02, Entity1_16Types.EntityType.LIGHTNING_BOLT);
|
|
||||||
|
|
||||||
// Spawn painting
|
// Spawn painting
|
||||||
registerExtraTracker(0x04, Entity1_16Types.EntityType.PAINTING);
|
registerExtraTracker(0x03, 0x04, Entity1_16Types.EntityType.PAINTING);
|
||||||
|
|
||||||
// Spawn player packet
|
// Spawn player packet
|
||||||
registerExtraTracker(0x05, Entity1_16Types.EntityType.PLAYER);
|
registerExtraTracker(0x04, 0x05, Entity1_16Types.EntityType.PLAYER);
|
||||||
|
|
||||||
// Destroy entities
|
// Destroy entities
|
||||||
registerEntityDestroy(0x38, 0x38);
|
registerEntityDestroy(0x37, 0x38);
|
||||||
|
|
||||||
// Entity Metadata packet
|
// Entity Metadata packet
|
||||||
registerMetadataRewriter(0x45, 0x44, Types1_14.METADATA_LIST);
|
registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST);
|
||||||
|
|
||||||
// Entity Properties
|
// Entity Properties
|
||||||
protocol.out(State.PLAY, 0x59, 0x59, new PacketRemapper() {
|
protocol.out(State.PLAY, 0x58, 0x59, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren