Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Named sound effect rewriting + Effect rewriting (thanks @Pokechu22)
Dieser Commit ist enthalten in:
Ursprung
72f5d8addc
Commit
d577088b8c
@ -203,7 +203,7 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x15, 0x16);
|
registerOutgoing(State.PLAY, 0x15, 0x16);
|
||||||
// InventoryPackets 0x16 -> 0x17
|
// InventoryPackets 0x16 -> 0x17
|
||||||
registerOutgoing(State.PLAY, 0x17, 0x18);
|
registerOutgoing(State.PLAY, 0x17, 0x18);
|
||||||
// InventoryPackets 0x18 -> 0x19
|
// WorldPackets 0x18 -> 0x19
|
||||||
registerOutgoing(State.PLAY, 0x1A, 0x1B);
|
registerOutgoing(State.PLAY, 0x1A, 0x1B);
|
||||||
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
||||||
// New packet 0x1D - NBT Query
|
// New packet 0x1D - NBT Query
|
||||||
@ -212,7 +212,29 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
||||||
registerOutgoing(State.PLAY, 0x1F, 0x21);
|
registerOutgoing(State.PLAY, 0x1F, 0x21);
|
||||||
// WorldPackets 0x20 -> 0x22
|
// WorldPackets 0x20 -> 0x22
|
||||||
registerOutgoing(State.PLAY, 0x21, 0x23);
|
|
||||||
|
// Effect packet
|
||||||
|
registerOutgoing(State.PLAY, 0x21, 0x23, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.INT); // Effect Id
|
||||||
|
map(Type.POSITION); // Location
|
||||||
|
map(Type.INT); // Data
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
int id = wrapper.get(Type.INT, 0);
|
||||||
|
int data = wrapper.get(Type.INT, 1);
|
||||||
|
if (id == 1010) { // Play record
|
||||||
|
wrapper.set(Type.INT, 1, data = MappingData.oldToNewItems.get(data << 4));
|
||||||
|
} else if (id == 2001) { // Block break + block break sound
|
||||||
|
wrapper.set(Type.INT, 1, data = WorldPackets.toNewId(data << 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// WorldPackets 0x22 -> 0x24
|
// WorldPackets 0x22 -> 0x24
|
||||||
// Join (save dimension id)
|
// Join (save dimension id)
|
||||||
registerOutgoing(State.PLAY, 0x23, 0x25, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x23, 0x25, new PacketRemapper() {
|
||||||
|
@ -0,0 +1,152 @@
|
|||||||
|
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class NamedSoundRewriter {
|
||||||
|
private static Map<String, String> oldToNew = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Extracted from Minecraft Wiki
|
||||||
|
oldToNew.put("block.cloth.break", "block.wool.break");
|
||||||
|
oldToNew.put("block.cloth.fall", "block.wool.fall");
|
||||||
|
oldToNew.put("block.cloth.hit", "block.wool.hit");
|
||||||
|
oldToNew.put("block.cloth.place", "block.wool.place");
|
||||||
|
oldToNew.put("block.cloth.step", "block.wool.step");
|
||||||
|
oldToNew.put("block.enderchest.close", "block.ender_chest.close");
|
||||||
|
oldToNew.put("block.enderchest.open", "block.ender_chest.open");
|
||||||
|
oldToNew.put("block.metal_pressureplate.click_off", "block.metal_pressure_plate.click_off");
|
||||||
|
oldToNew.put("block.metal_pressureplate.click_on", "block.metal_pressure_plate.click_on");
|
||||||
|
oldToNew.put("block.note.basedrum", "block.note_block.basedrum");
|
||||||
|
oldToNew.put("block.note.bass", "block.note_block.bass");
|
||||||
|
oldToNew.put("block.note.bell", "block.note_block.bell");
|
||||||
|
oldToNew.put("block.note.chime", "block.note_block.chime");
|
||||||
|
oldToNew.put("block.note.flute", "block.note_block.flute");
|
||||||
|
oldToNew.put("block.note.guitar", "block.note_block.guitar");
|
||||||
|
oldToNew.put("block.note.harp", "block.note_block.harp");
|
||||||
|
oldToNew.put("block.note.hat", "block.note_block.hat");
|
||||||
|
oldToNew.put("block.note.pling", "block.note_block.pling");
|
||||||
|
oldToNew.put("block.note.snare", "block.note_block.snare");
|
||||||
|
oldToNew.put("block.note.xylophone", "block.note_block.xylophone");
|
||||||
|
oldToNew.put("block.slime.break", "block.slime_block.break");
|
||||||
|
oldToNew.put("block.slime.fall", "block.slime_block.fall");
|
||||||
|
oldToNew.put("block.slime.hit", "block.slime_block.hit");
|
||||||
|
oldToNew.put("block.slime.place", "block.slime_block.place");
|
||||||
|
oldToNew.put("block.slime.step", "block.slime_block.step");
|
||||||
|
oldToNew.put("block.stone_pressureplate.click_off", "block.stone_pressure_plate.click_off");
|
||||||
|
oldToNew.put("block.stone_pressureplate.click_on", "block.stone_pressure_plate.click_on");
|
||||||
|
oldToNew.put("block.waterlily.place", "block.lily_pad.place");
|
||||||
|
oldToNew.put("block.wood_pressureplate.click_off", "block.wooden_pressure_plate.click_off");
|
||||||
|
oldToNew.put("block.wood_button.click_on", "block.wooden_button.click_on");
|
||||||
|
oldToNew.put("block.wood_button.click_off", "block.wooden_button.click_off");
|
||||||
|
oldToNew.put("block.wood_pressureplate.click_on", "block.wooden_pressure_plate.click_on");
|
||||||
|
oldToNew.put("entity.armorstand.break", "entity.armor_stand.break");
|
||||||
|
oldToNew.put("entity.armorstand.fall", "entity.armor_stand.fall");
|
||||||
|
oldToNew.put("entity.armorstand.hit", "entity.armor_stand.hit");
|
||||||
|
oldToNew.put("entity.armorstand.place", "entity.armor_stand.place");
|
||||||
|
oldToNew.put("entity.bobber.retrieve", "entity.fishing_bobber.retrieve");
|
||||||
|
oldToNew.put("entity.bobber.splash", "entity.fishing_bobber.splash");
|
||||||
|
oldToNew.put("entity.bobber.throw", "entity.fishing_bobber.throw");
|
||||||
|
oldToNew.put("entity.enderdragon.ambient", "entity.ender_dragon.ambient");
|
||||||
|
oldToNew.put("entity.enderdragon.death", "entity.ender_dragon.death");
|
||||||
|
oldToNew.put("entity.enderdragon.flap", "entity.ender_dragon.flap");
|
||||||
|
oldToNew.put("entity.enderdragon.growl", "entity.ender_dragon.growl");
|
||||||
|
oldToNew.put("entity.enderdragon.hurt", "entity.ender_dragon.hurt");
|
||||||
|
oldToNew.put("entity.enderdragon.shoot", "entity.ender_dragon.shoot");
|
||||||
|
oldToNew.put("entity.enderdragon_fireball.explode", "entity.dragon_fireball.explode");
|
||||||
|
oldToNew.put("entity.endereye.death", "entity.ender_eye.death");
|
||||||
|
oldToNew.put("entity.endereye.launch", "entity.ender_eye.launch");
|
||||||
|
oldToNew.put("entity.endermen.ambient", "entity.enderman.ambient");
|
||||||
|
oldToNew.put("entity.endermen.death", "entity.enderman.death");
|
||||||
|
oldToNew.put("entity.endermen.hurt", "entity.enderman.hurt");
|
||||||
|
oldToNew.put("entity.endermen.scream", "entity.enderman.scream");
|
||||||
|
oldToNew.put("entity.endermen.stare", "entity.enderman.stare");
|
||||||
|
oldToNew.put("entity.endermen.teleport", "entity.enderman.teleport");
|
||||||
|
oldToNew.put("entity.enderpearl.throw", "entity.ender_pearl.throw");
|
||||||
|
oldToNew.put("entity.evocation_illager.ambient", "entity.evoker.ambient");
|
||||||
|
oldToNew.put("entity.evocation_illager.cast_spell", "entity.evoker.cast_spell");
|
||||||
|
oldToNew.put("entity.evocation_illager.death", "entity.evoker.death");
|
||||||
|
oldToNew.put("entity.evocation_illager.hurt", "entity.evoker.hurt");
|
||||||
|
oldToNew.put("entity.evocation_illager.prepare_attack", "entity.evoker.prepare_attack");
|
||||||
|
oldToNew.put("entity.evocation_illager.prepare_summon", "entity.evoker.prepare_summon");
|
||||||
|
oldToNew.put("entity.evocation_illager.prepare_wololo", "entity.evoker.prepare_wololo");
|
||||||
|
oldToNew.put("entity.firework.blast", "entity.firework_rocket.blast");
|
||||||
|
oldToNew.put("entity.firework.blast_far", "entity.firework_rocket.blast_far");
|
||||||
|
oldToNew.put("entity.firework.large_blast", "entity.firework_rocket.large_blast");
|
||||||
|
oldToNew.put("entity.firework.large_blast_far", "entity.firework_rocket.large_blast_far");
|
||||||
|
oldToNew.put("entity.firework.launch", "entity.firework_rocket.launch");
|
||||||
|
oldToNew.put("entity.firework.shoot", "entity.firework_rocket.shoot");
|
||||||
|
oldToNew.put("entity.firework.twinkle", "entity.firework_rocket.twinkle");
|
||||||
|
oldToNew.put("entity.firework.twinkle_far", "entity.firework_rocket.twinkle_far");
|
||||||
|
oldToNew.put("entity.illusion_illager.ambient", "entity.illusioner.ambient");
|
||||||
|
oldToNew.put("entity.illusion_illager.cast_spell", "entity.illusioner.cast_spell");
|
||||||
|
oldToNew.put("entity.illusion_illager.death", "entity.illusioner.death");
|
||||||
|
oldToNew.put("entity.illusion_illager.hurt", "entity.illusioner.hurt");
|
||||||
|
oldToNew.put("entity.illusion_illager.mirror_move", "entity.illusioner.mirror_move");
|
||||||
|
oldToNew.put("entity.illusion_illager.prepare_blindness", "entity.illusioner.prepare_blindness");
|
||||||
|
oldToNew.put("entity.illusion_illager.prepare_mirror", "entity.illusioner.prepare_mirror");
|
||||||
|
oldToNew.put("entity.irongolem.attack", "entity.iron_golem.attack");
|
||||||
|
oldToNew.put("entity.irongolem.death", "entity.iron_golem.death");
|
||||||
|
oldToNew.put("entity.irongolem.hurt", "entity.iron_golem.hurt");
|
||||||
|
oldToNew.put("entity.irongolem.step", "entity.iron_golem.step");
|
||||||
|
oldToNew.put("entity.itemframe.add_item", "entity.item_frame.add_item");
|
||||||
|
oldToNew.put("entity.itemframe.break", "entity.item_frame.break");
|
||||||
|
oldToNew.put("entity.itemframe.place", "entity.item_frame.place");
|
||||||
|
oldToNew.put("entity.itemframe.remove_item", "entity.item_frame.remove_item");
|
||||||
|
oldToNew.put("entity.itemframe.rotate_item", "entity.item_frame.rotate_item");
|
||||||
|
oldToNew.put("entity.leashknot.break", "entity.leash_knot.break");
|
||||||
|
oldToNew.put("entity.leashknot.place", "entity.leash_knot.place");
|
||||||
|
oldToNew.put("entity.lightning.impact", "entity.lightning_bolt.impact");
|
||||||
|
oldToNew.put("entity.lightning.thunder", "entity.lightning_bolt.thunder");
|
||||||
|
oldToNew.put("entity.lingeringpotion.throw", "entity.lingering_potion.throw");
|
||||||
|
oldToNew.put("entity.magmacube.death", "entity.magma_cube.death");
|
||||||
|
oldToNew.put("entity.magmacube.hurt", "entity.magma_cube.hurt");
|
||||||
|
oldToNew.put("entity.magmacube.jump", "entity.magma_cube.jump");
|
||||||
|
oldToNew.put("entity.magmacube.squish", "entity.magma_cube.squish");
|
||||||
|
oldToNew.put("entity.parrot.imitate.enderdragon", "entity.parrot.imitate.ender_dragon");
|
||||||
|
oldToNew.put("entity.parrot.imitate.evocation_illager", "entity.parrot.imitate.evoker");
|
||||||
|
oldToNew.put("entity.parrot.imitate.illusion_illager", "entity.parrot.imitate.illusioner");
|
||||||
|
oldToNew.put("entity.parrot.imitate.magmacube", "entity.parrot.imitate.magma_cube");
|
||||||
|
oldToNew.put("entity.parrot.imitate.vindication_illager", "entity.parrot.imitate.vindicator");
|
||||||
|
oldToNew.put("entity.player.splash.highspeed", "entity.player.splash.high_speed");
|
||||||
|
oldToNew.put("entity.polar_bear.baby_ambient", "entity.polar_bear.ambient_baby");
|
||||||
|
oldToNew.put("entity.small_magmacube.death", "entity.magma_cube.death_small");
|
||||||
|
oldToNew.put("entity.small_magmacube.hurt", "entity.magma_cube.hurt_small");
|
||||||
|
oldToNew.put("entity.small_magmacube.squish", "entity.magma_cube.squish_small");
|
||||||
|
oldToNew.put("entity.small_slime.death", "entity.slime.death_small");
|
||||||
|
oldToNew.put("entity.small_slime.hurt", "entity.slime.hurt_small");
|
||||||
|
oldToNew.put("entity.small_slime.jump", "entity.slime.jump_small");
|
||||||
|
oldToNew.put("entity.small_slime.squish", "entity.slime.squish_small");
|
||||||
|
oldToNew.put("entity.snowman.ambient", "entity.snow_golem.ambient");
|
||||||
|
oldToNew.put("entity.snowman.death", "entity.snow_golem.death");
|
||||||
|
oldToNew.put("entity.snowman.hurt", "entity.snow_golem.hurt");
|
||||||
|
oldToNew.put("entity.snowman.shoot", "entity.snow_golem.shoot");
|
||||||
|
oldToNew.put("entity.vindication_illager.ambient", "entity.vindicator.ambient");
|
||||||
|
oldToNew.put("entity.vindication_illager.death", "entity.vindicator.death");
|
||||||
|
oldToNew.put("entity.vindication_illager.hurt", "entity.vindicator.hurt");
|
||||||
|
oldToNew.put("entity.zombie.attack_door_wood", "entity.zombie.attack_wooden_door");
|
||||||
|
oldToNew.put("entity.zombie.break_door_wood", "entity.zombie.break_wooden_door");
|
||||||
|
oldToNew.put("entity.zombie_pig.ambient", "entity.zombie_pigman.ambient");
|
||||||
|
oldToNew.put("entity.zombie_pig.angry", "entity.zombie_pigman.angry");
|
||||||
|
oldToNew.put("entity.zombie_pig.death", "entity.zombie_pigman.death");
|
||||||
|
oldToNew.put("entity.zombie_pig.hurt", "entity.zombie_pigman.hurt");
|
||||||
|
oldToNew.put("record.11", "music_disc.11");
|
||||||
|
oldToNew.put("record.13", "music_disc.13");
|
||||||
|
oldToNew.put("record.blocks", "music_disc.blocks");
|
||||||
|
oldToNew.put("record.cat", "music_disc.cat");
|
||||||
|
oldToNew.put("record.chirp", "music_disc.chirp");
|
||||||
|
oldToNew.put("record.far", "music_disc.far");
|
||||||
|
oldToNew.put("record.mall", "music_disc.mall");
|
||||||
|
oldToNew.put("record.mellohi", "music_disc.mellohi");
|
||||||
|
oldToNew.put("record.stal", "music_disc.stal");
|
||||||
|
oldToNew.put("record.strad", "music_disc.strad");
|
||||||
|
oldToNew.put("record.wait", "music_disc.wait");
|
||||||
|
oldToNew.put("record.ward", "music_disc.ward");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNewId(String old) {
|
||||||
|
String newId = oldToNew.get(old);
|
||||||
|
return newId != null ? newId : old;
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||||
@ -130,7 +131,19 @@ public class WorldPackets {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Named Sound Effect TODO String -> Identifier? Check if identifier is present?
|
// Named Sound Effect TODO String -> Identifier? Check if identifier is present?
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x1A);
|
protocol.registerOutgoing(State.PLAY, 0x19, 0x1A, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING);
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
String newSoundId = NamedSoundRewriter.getNewId(wrapper.get(Type.STRING, 0));
|
||||||
|
wrapper.set(Type.STRING, 0, newSoundId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Chunk Data
|
// Chunk Data
|
||||||
protocol.registerOutgoing(State.PLAY, 0x20, 0x22, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x20, 0x22, new PacketRemapper() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren