This commit is contained in:
KennyTV 2020-03-25 21:03:09 +01:00
parent 432977614f
commit 1d48bf5086
5 changed files with 68 additions and 10 deletions

View File

@ -33,8 +33,9 @@ public class EntityData {
return this;
}
public void spawnMetadata(MetaCreator handler) {
public EntityData spawnMetadata(MetaCreator handler) {
this.defaultMeta = handler;
return this;
}
public boolean hasBaseMeta() {

View File

@ -8,6 +8,7 @@ import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets.BlockItemPackets1_16;
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets.EntityPackets1_16;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
@ -125,6 +126,14 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
}
});
// Set Jigsaw
registerIncoming(State.PLAY, 0x27, 0x27, new PacketRemapper() {
@Override
public void registerMap() {
handler(PacketWrapper::cancel);
}
});
registerOutgoing(State.PLAY, 0x43, 0x4E);
registerOutgoing(State.PLAY, 0x44, 0x43);

View File

@ -219,9 +219,9 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
CompoundTag tag = item.getTag();
CompoundTag ownerTag = tag.get("SkullOwner");
if (ownerTag != null) {
IntArrayTag idTag = ownerTag.remove("Id");
if (idTag != null) {
UUID ownerUuid = UUIDIntArrayType.uuidFromIntArray((idTag).getValue());
Tag idTag = ownerTag.get("Id");
if (idTag instanceof IntArrayTag) {
UUID ownerUuid = UUIDIntArrayType.uuidFromIntArray((int[]) idTag.getValue());
ownerTag.put(new StringTag("Id", ownerUuid.toString()));
}
}
@ -240,9 +240,9 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
CompoundTag tag = item.getTag();
CompoundTag ownerTag = tag.get("SkullOwner");
if (ownerTag != null) {
StringTag idTag = ownerTag.remove("Id");
if (idTag != null) {
UUID ownerUuid = UUID.fromString(idTag.getValue());
Tag idTag = ownerTag.get("Id");
if (idTag instanceof StringTag) {
UUID ownerUuid = UUID.fromString((String) idTag.getValue());
ownerTag.put(new IntArrayTag("Id", UUIDIntArrayType.uuidToIntArray(ownerUuid)));
}
}

View File

@ -70,12 +70,19 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
mapEntity(Entity1_16Types.EntityType.HOGLIN, Entity1_16Types.EntityType.COW).jsonName("Hoglin");
mapEntity(Entity1_16Types.EntityType.PIGLIN, Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN).jsonName("Piglin");
mapEntity(Entity1_16Types.EntityType.STRIDER, Entity1_16Types.EntityType.MAGMA_CUBE)
.spawnMetadata(storage -> storage.add(new Metadata(15, MetaType1_14.VarInt, 3))).jsonName("Strider");
registerMetaHandler().filter(Entity1_16Types.EntityType.PIGLIN, 16).removed(); // charging crossbow
registerMetaHandler().filter(Entity1_16Types.EntityType.PIGLIN, 17).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.ABSTRACT_ARROW, true, 8).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 16).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 17).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.STRIDER, 18).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.FISHING_BOBBER, 8).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.ABSTRACT_ARROW, true, 8).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.ABSTRACT_ARROW, true).handle(meta -> {
if (meta.getIndex() >= 8) {
meta.getData().setId(meta.getIndex() + 1);
@ -95,6 +102,8 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
return Entity1_15Types.EntityType.COW.getId();
} else if (newId == Entity1_16Types.EntityType.PIGLIN.getId()) {
return Entity1_15Types.EntityType.ZOMBIE_PIGMAN.getId();
} else if (newId == Entity1_16Types.EntityType.STRIDER.getId()) {
return Entity1_15Types.EntityType.MAGMA_CUBE.getId();
}
return newId;
}

View File

@ -5356,7 +5356,20 @@
"minecraft:respawn_anchor[charges=1]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=2]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=3]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=4]": "minecraft:obsidian"
"minecraft:respawn_anchor[charges=4]": "minecraft:obsidian",
"minecraft:jigsaw[orientation=down_east]": "minecraft:jigsaw[facing=down]",
"minecraft:jigsaw[orientation=down_north]": "minecraft:jigsaw[facing=down]",
"minecraft:jigsaw[orientation=down_south]": "minecraft:jigsaw[facing=down]",
"minecraft:jigsaw[orientation=down_west]": "minecraft:jigsaw[facing=down]",
"minecraft:jigsaw[orientation=up_east]": "minecraft:jigsaw[facing=up]",
"minecraft:jigsaw[orientation=up_north]": "minecraft:jigsaw[facing=up]",
"minecraft:jigsaw[orientation=up_south]": "minecraft:jigsaw[facing=up]",
"minecraft:jigsaw[orientation=up_west]": "minecraft:jigsaw[facing=up]",
"minecraft:jigsaw[orientation=west_up]": "minecraft:jigsaw[facing=west]",
"minecraft:jigsaw[orientation=east_up]": "minecraft:jigsaw[facing=east]",
"minecraft:jigsaw[orientation=north_up]": "minecraft:jigsaw[facing=north]",
"minecraft:jigsaw[orientation=south_up]": "minecraft:jigsaw[facing=south]",
"minecraft:lodestone": "minecraft:chiseled_quartz_block"
},
"items": {
"minecraft:crimson_nylium": {
@ -5511,6 +5524,10 @@
"id": "minecraft:zombie_pigman_spawn_egg",
"name": "1.16 Piglin Spawn Egg"
},
"minecraft:strider_spawn_egg": {
"id": "minecraft:salmon_spawn_egg",
"name": "1.16 Strider Spawn Egg"
},
"minecraft:soul_fire_lantern": {
"id": "minecraft:lantern",
"name": "1.16 Soul Fire Lantern"
@ -5614,6 +5631,14 @@
"minecraft:polished_basalt": {
"id": "minecraft:gray_glazed_terracotta",
"name": "1.16 Polished Basalt"
},
"minecraft:lodestone": {
"id": "minecraft:chiseled_quartz_block",
"name": "1.16 Lodestone"
},
"minecraft:warped_fungus_on_a_stick": {
"id": "minecraft:carrot_on_a_stick",
"name": "1.16 Warped Fungus on a Stick"
}
},
"sounds": {
@ -5743,6 +5768,20 @@
"block.respawn_anchor.ambient": "block.beacon.ambient",
"block.respawn_anchor.charge": "block.beacon.activate",
"block.respawn_anchor.deplete": "block.beacon.deactivate",
"block.respawn_anchor.set_spawn": "block.beacon.power_select"
"block.respawn_anchor.set_spawn": "block.beacon.power_select",
"block.lodestone.break": "block.stone.break",
"block.lodestone.step": "block.stone.step",
"block.lodestone.place": "block.stone.place",
"block.lodestone.hit": "block.stone.hit",
"block.lodestone.fall": "block.stone.fall",
"item.lodestone_compass.lock": "item.trident.return",
"entity.strider.ambient": "entity.drowned.ambient",
"entity.strider.happy": "",
"entity.strider.retreat": "",
"entity.strider.death": "entity.drowned.death",
"entity.strider.hurt": "entity.drowned.hurt",
"entity.strider.step": "entity.drowned.step",
"entity.strider.step_lava": "entity.drowned.step",
"entity.strider.eat": "entity.horse.eat"
}
}