Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-09 17:50:23 +01:00
Automated particle rewriting
Dieser Commit ist enthalten in:
Ursprung
e502f2c96d
Commit
52f542774f
@ -10,6 +10,7 @@ public class MappingData {
|
|||||||
protected final String newVersion;
|
protected final String newVersion;
|
||||||
protected final boolean hasDiffFile;
|
protected final boolean hasDiffFile;
|
||||||
protected Int2IntBiMap itemMappings;
|
protected Int2IntBiMap itemMappings;
|
||||||
|
protected ParticleMappings particleMappings;
|
||||||
protected Mappings blockMappings;
|
protected Mappings blockMappings;
|
||||||
protected Mappings blockStateMappings;
|
protected Mappings blockStateMappings;
|
||||||
protected Mappings soundMappings;
|
protected Mappings soundMappings;
|
||||||
@ -36,6 +37,12 @@ public class MappingData {
|
|||||||
blockStateMappings = loadFromObject(oldMappings, newMappings, diffmapping, "blockstates");
|
blockStateMappings = loadFromObject(oldMappings, newMappings, diffmapping, "blockstates");
|
||||||
soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds");
|
soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds");
|
||||||
statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics");
|
statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics");
|
||||||
|
|
||||||
|
Mappings particles = loadFromArray(oldMappings, newMappings, diffmapping, "particles");
|
||||||
|
if (particles != null) {
|
||||||
|
particleMappings = new ParticleMappings(oldMappings.getAsJsonArray("particles"), particles);
|
||||||
|
}
|
||||||
|
|
||||||
if (loadItems && newMappings.has("items")) {
|
if (loadItems && newMappings.has("items")) {
|
||||||
itemMappings = new Int2IntBiMap();
|
itemMappings = new Int2IntBiMap();
|
||||||
itemMappings.defaultReturnValue(-1);
|
itemMappings.defaultReturnValue(-1);
|
||||||
@ -64,11 +71,20 @@ public class MappingData {
|
|||||||
return oldId != -1 ? oldId : 1;
|
return oldId != -1 ? oldId : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNewParticleId(int id) {
|
||||||
|
return checkValidity(id, particleMappings.getMappings().getNewId(id), "particles");
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Int2IntBiMap getItemMappings() {
|
public Int2IntBiMap getItemMappings() {
|
||||||
return itemMappings;
|
return itemMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public ParticleMappings getParticleMappings() {
|
||||||
|
return particleMappings;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Mappings getBlockMappings() {
|
public Mappings getBlockMappings() {
|
||||||
return blockMappings;
|
return blockMappings;
|
||||||
|
@ -111,7 +111,7 @@ public class MappingDataLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void mapIdentifiers(Int2IntBiMap output, JsonObject oldIdentifiers, JsonObject newIdentifiers, @Nullable JsonObject diffIdentifiers) {
|
public static void mapIdentifiers(Int2IntBiMap output, JsonObject oldIdentifiers, JsonObject newIdentifiers, @Nullable JsonObject diffIdentifiers) {
|
||||||
Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers);
|
Object2IntMap<String> newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers);
|
||||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||||
int value = mapIdentifierEntry(entry, newIdentifierMap, diffIdentifiers);
|
int value = mapIdentifierEntry(entry, newIdentifierMap, diffIdentifiers);
|
||||||
if (value != -1) {
|
if (value != -1) {
|
||||||
@ -159,7 +159,7 @@ public class MappingDataLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers, @Nullable JsonObject diffIdentifiers, boolean warnOnMissing) {
|
public static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers, @Nullable JsonObject diffIdentifiers, boolean warnOnMissing) {
|
||||||
Object2IntMap newIdentifierMap = MappingDataLoader.arrayToMap(newIdentifiers);
|
Object2IntMap<String> newIdentifierMap = MappingDataLoader.arrayToMap(newIdentifiers);
|
||||||
for (int i = 0; i < oldIdentifiers.size(); i++) {
|
for (int i = 0; i < oldIdentifiers.size(); i++) {
|
||||||
JsonElement oldIdentifier = oldIdentifiers.get(i);
|
JsonElement oldIdentifier = oldIdentifiers.get(i);
|
||||||
int mappedId = newIdentifierMap.getInt(oldIdentifier.getAsString());
|
int mappedId = newIdentifierMap.getInt(oldIdentifier.getAsString());
|
||||||
@ -189,8 +189,8 @@ public class MappingDataLoader {
|
|||||||
* @param object json object
|
* @param object json object
|
||||||
* @return map with indexes hashed by their id value
|
* @return map with indexes hashed by their id value
|
||||||
*/
|
*/
|
||||||
public static Object2IntMap indexedObjectToMap(JsonObject object) {
|
public static Object2IntMap<String> indexedObjectToMap(JsonObject object) {
|
||||||
Object2IntMap map = new Object2IntOpenHashMap(object.size(), 1F);
|
Object2IntMap<String> map = new Object2IntOpenHashMap<>(object.size(), 1F);
|
||||||
map.defaultReturnValue(-1);
|
map.defaultReturnValue(-1);
|
||||||
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||||
map.put(entry.getValue().getAsString(), Integer.parseInt(entry.getKey()));
|
map.put(entry.getValue().getAsString(), Integer.parseInt(entry.getKey()));
|
||||||
@ -202,8 +202,8 @@ public class MappingDataLoader {
|
|||||||
* @param array json array
|
* @param array json array
|
||||||
* @return map with indexes hashed by their id value
|
* @return map with indexes hashed by their id value
|
||||||
*/
|
*/
|
||||||
public static Object2IntMap arrayToMap(JsonArray array) {
|
public static Object2IntMap<String> arrayToMap(JsonArray array) {
|
||||||
Object2IntMap map = new Object2IntOpenHashMap(array.size(), 1F);
|
Object2IntMap<String> map = new Object2IntOpenHashMap<>(array.size(), 1F);
|
||||||
map.defaultReturnValue(-1);
|
map.defaultReturnValue(-1);
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
map.put(array.get(i).getAsString(), i);
|
map.put(array.get(i).getAsString(), i);
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package us.myles.ViaVersion.api.data;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
|
||||||
|
public class ParticleMappings {
|
||||||
|
private final Mappings mappings;
|
||||||
|
private final int blockId;
|
||||||
|
private final int fallingDustId;
|
||||||
|
private final int itemId;
|
||||||
|
|
||||||
|
public ParticleMappings(JsonArray oldMappings, Mappings mappings) {
|
||||||
|
this.mappings = mappings;
|
||||||
|
|
||||||
|
Object2IntMap<String> map = MappingDataLoader.arrayToMap(oldMappings);
|
||||||
|
blockId = map.getInt("block");
|
||||||
|
fallingDustId = map.getInt("dust");
|
||||||
|
itemId = map.getInt("item");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mappings getMappings() {
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlockId() {
|
||||||
|
return blockId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFallingDustId() {
|
||||||
|
return fallingDustId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemId() {
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
package us.myles.ViaVersion.api.rewriters;
|
package us.myles.ViaVersion.api.rewriters;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
|
||||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
@ -106,46 +104,4 @@ public class BlockRewriter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSpawnParticle(ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
|
|
||||||
ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType, Type<?> coordType) {
|
|
||||||
registerSpawnParticle(packetType, blockId, fallingDustId, itemId, null, itemRewriteFunction, itemType, coordType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerSpawnParticle(ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
|
|
||||||
@Nullable IdRewriteFunction particleRewriteFunction, ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType, Type<?> coordType) {
|
|
||||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.INT); // 0 - Particle ID
|
|
||||||
map(Type.BOOLEAN); // 1 - Long Distance
|
|
||||||
map(coordType); // 2 - X
|
|
||||||
map(coordType); // 3 - Y
|
|
||||||
map(coordType); // 4 - Z
|
|
||||||
map(Type.FLOAT); // 5 - Offset X
|
|
||||||
map(Type.FLOAT); // 6 - Offset Y
|
|
||||||
map(Type.FLOAT); // 7 - Offset Z
|
|
||||||
map(Type.FLOAT); // 8 - Particle Data
|
|
||||||
map(Type.INT); // 9 - Particle Count
|
|
||||||
handler(wrapper -> {
|
|
||||||
int id = wrapper.get(Type.INT, 0);
|
|
||||||
if (id == -1) return;
|
|
||||||
if (id == blockId || id == fallingDustId) {
|
|
||||||
int data = wrapper.passthrough(Type.VAR_INT);
|
|
||||||
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(data));
|
|
||||||
} else if (id == itemId) {
|
|
||||||
// Has to be like this, until we make *everything* object oriented inside of each protocol :(
|
|
||||||
itemRewriteFunction.rewrite(wrapper.passthrough(itemType));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (particleRewriteFunction != null) {
|
|
||||||
int newId = particleRewriteFunction.rewrite(id);
|
|
||||||
if (newId != id) {
|
|
||||||
wrapper.set(Type.INT, 0, newId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package us.myles.ViaVersion.api.rewriters;
|
package us.myles.ViaVersion.api.rewriters;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.data.ParticleMappings;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
@ -189,6 +190,42 @@ public class ItemRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not the very best place for this, but has to stay here until *everything* is abstracted
|
||||||
|
public void registerSpawnParticle(ClientboundPacketType packetType, Type<Item> itemType, Type<?> coordType) {
|
||||||
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.INT); // 0 - Particle ID
|
||||||
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
|
map(coordType); // 2 - X
|
||||||
|
map(coordType); // 3 - Y
|
||||||
|
map(coordType); // 4 - Z
|
||||||
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
|
map(Type.FLOAT); // 8 - Particle Data
|
||||||
|
map(Type.INT); // 9 - Particle Count
|
||||||
|
handler(wrapper -> {
|
||||||
|
int id = wrapper.get(Type.INT, 0);
|
||||||
|
if (id == -1) return;
|
||||||
|
|
||||||
|
ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
|
||||||
|
if (id == mappings.getBlockId() || id == mappings.getFallingDustId()) {
|
||||||
|
int data = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(data));
|
||||||
|
} else if (id == mappings.getItemId()) {
|
||||||
|
toClient.rewrite(wrapper.passthrough(itemType));
|
||||||
|
}
|
||||||
|
|
||||||
|
int newId = protocol.getMappingData().getNewParticleId(id);
|
||||||
|
if (newId != id) {
|
||||||
|
wrapper.set(Type.INT, 0, newId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Only sent to the client
|
// Only sent to the client
|
||||||
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
|
@ -75,6 +75,8 @@ public class InventoryPackets {
|
|||||||
|
|
||||||
itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM);
|
itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM);
|
||||||
itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM);
|
||||||
|
|
||||||
|
itemRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, Type.FLAT_ITEM, Type.FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
|
@ -75,7 +75,5 @@ public class WorldPackets {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27, InventoryPackets::toClient, Type.FLAT_ITEM, Type.FLOAT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public class MetadataRewriter1_14To1_13_2 extends MetadataRewriter {
|
|||||||
} else if (type.is(Entity1_14Types.EntityType.AREA_EFFECT_CLOUD)) {
|
} else if (type.is(Entity1_14Types.EntityType.AREA_EFFECT_CLOUD)) {
|
||||||
if (metadata.getId() == 10) {
|
if (metadata.getId() == 10) {
|
||||||
Particle particle = (Particle) metadata.getValue();
|
Particle particle = (Particle) metadata.getValue();
|
||||||
particle.setId(getNewParticleId(particle.getId()));
|
particle.setId(protocol.getMappingData().getNewParticleId(particle.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,23 +224,4 @@ public class MetadataRewriter1_14To1_13_2 extends MetadataRewriter {
|
|||||||
}
|
}
|
||||||
return pose;
|
return pose;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewParticleId(int id) {
|
|
||||||
if (id >= 10) {
|
|
||||||
id += 2; // new lava drips 10, 11
|
|
||||||
}
|
|
||||||
if (id >= 13) {
|
|
||||||
id += 1; // new water drip 11 -> 13
|
|
||||||
}
|
|
||||||
if (id >= 27) {
|
|
||||||
id += 1; // new 24 -> 27
|
|
||||||
}
|
|
||||||
if (id >= 29) {
|
|
||||||
id += 1; // skip new short happy villager
|
|
||||||
}
|
|
||||||
if (id >= 44) {
|
|
||||||
id += 1; // new 39 -> 44
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.RecipeRewriter1_13_2;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.RecipeRewriter1_13_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -230,6 +229,8 @@ public class InventoryPackets {
|
|||||||
});
|
});
|
||||||
|
|
||||||
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
|
itemRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
|
@ -17,7 +17,6 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.metadata.MetadataRewriter1_14To1_13_2;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||||
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;
|
||||||
@ -272,9 +271,6 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27,
|
|
||||||
MetadataRewriter1_14To1_13_2::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM, Type.FLOAT);
|
|
||||||
|
|
||||||
protocol.registerOutgoing(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
|
@ -49,6 +49,8 @@ public class InventoryPackets {
|
|||||||
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itemRewriter.registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
|
@ -91,7 +91,5 @@ public class WorldPackets {
|
|||||||
});
|
});
|
||||||
|
|
||||||
blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001);
|
blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001);
|
||||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, 3, 23, 34,
|
|
||||||
null, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
|
|||||||
import us.myles.ViaVersion.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.WorldPackets;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +37,7 @@ public class MetadataRewriter1_16To1_15_2 extends MetadataRewriter {
|
|||||||
if (type == Entity1_16Types.EntityType.AREA_EFFECT_CLOUD) {
|
if (type == Entity1_16Types.EntityType.AREA_EFFECT_CLOUD) {
|
||||||
if (metadata.getId() == 10) {
|
if (metadata.getId() == 10) {
|
||||||
Particle particle = (Particle) metadata.getValue();
|
Particle particle = (Particle) metadata.getValue();
|
||||||
particle.setId(WorldPackets.getNewParticleId(particle.getId()));
|
particle.setId(protocol.getMappingData().getNewParticleId(particle.getId()));
|
||||||
}
|
}
|
||||||
} else if (type.isOrHasParent(Entity1_16Types.EntityType.ABSTRACT_ARROW)) {
|
} else if (type.isOrHasParent(Entity1_16Types.EntityType.ABSTRACT_ARROW)) {
|
||||||
if (metadata.getId() == 8) {
|
if (metadata.getId() == 8) {
|
||||||
|
@ -116,6 +116,8 @@ public class InventoryPackets {
|
|||||||
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itemRewriter.registerSpawnParticle(ClientboundPackets1_15.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
|
@ -86,8 +86,6 @@ public class WorldPackets {
|
|||||||
});
|
});
|
||||||
|
|
||||||
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001);
|
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001);
|
||||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_15.SPAWN_PARTICLE, 3, 23, 32,
|
|
||||||
WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleBlockEntity(CompoundTag compoundTag) {
|
private static void handleBlockEntity(CompoundTag compoundTag) {
|
||||||
@ -118,11 +116,4 @@ public class WorldPackets {
|
|||||||
compoundTag.put(skullOwnerTag);
|
compoundTag.put(skullOwnerTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewParticleId(int id) {
|
|
||||||
if (id >= 27) {
|
|
||||||
id += 2; // soul flame, soul
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10715,5 +10715,57 @@
|
|||||||
"minecraft.open_chest",
|
"minecraft.open_chest",
|
||||||
"minecraft.sleep_in_bed",
|
"minecraft.sleep_in_bed",
|
||||||
"minecraft.open_shulker_box"
|
"minecraft.open_shulker_box"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"happy_villager",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -11390,5 +11390,57 @@
|
|||||||
"minecraft.open_chest",
|
"minecraft.open_chest",
|
||||||
"minecraft.sleep_in_bed",
|
"minecraft.sleep_in_bed",
|
||||||
"minecraft.open_shulker_box"
|
"minecraft.open_shulker_box"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"happy_villager",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -13696,5 +13696,65 @@
|
|||||||
"minecraft.bell_ring",
|
"minecraft.bell_ring",
|
||||||
"minecraft.raid_trigger",
|
"minecraft.raid_trigger",
|
||||||
"minecraft.raid_win"
|
"minecraft.raid_win"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"falling_lava",
|
||||||
|
"landing_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"falling_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"flash",
|
||||||
|
"happy_villager",
|
||||||
|
"composter",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"sneeze",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin",
|
||||||
|
"campfire_cosy_smoke",
|
||||||
|
"campfire_signal_smoke"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -13790,5 +13790,69 @@
|
|||||||
"minecraft.raid_win",
|
"minecraft.raid_win",
|
||||||
"minecraft.interact_with_anvil",
|
"minecraft.interact_with_anvil",
|
||||||
"minecraft.interact_with_grindstone"
|
"minecraft.interact_with_grindstone"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"falling_lava",
|
||||||
|
"landing_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"falling_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"flash",
|
||||||
|
"happy_villager",
|
||||||
|
"composter",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"sneeze",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin",
|
||||||
|
"campfire_cosy_smoke",
|
||||||
|
"campfire_signal_smoke",
|
||||||
|
"dripping_honey",
|
||||||
|
"falling_honey",
|
||||||
|
"landing_honey",
|
||||||
|
"falling_nectar"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -19849,5 +19849,79 @@
|
|||||||
"entity.zombie_villager.death",
|
"entity.zombie_villager.death",
|
||||||
"entity.zombie_villager.hurt",
|
"entity.zombie_villager.hurt",
|
||||||
"entity.zombie_villager.step"
|
"entity.zombie_villager.step"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"falling_lava",
|
||||||
|
"landing_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"falling_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"soul_fire_flame",
|
||||||
|
"soul",
|
||||||
|
"flash",
|
||||||
|
"happy_villager",
|
||||||
|
"composter",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"sneeze",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin",
|
||||||
|
"campfire_cosy_smoke",
|
||||||
|
"campfire_signal_smoke",
|
||||||
|
"dripping_honey",
|
||||||
|
"falling_honey",
|
||||||
|
"landing_honey",
|
||||||
|
"falling_nectar",
|
||||||
|
"ash",
|
||||||
|
"crimson_spore",
|
||||||
|
"warped_spore",
|
||||||
|
"dripping_obsidian_tear",
|
||||||
|
"falling_obsidian_tear",
|
||||||
|
"landing_obsidian_tear",
|
||||||
|
"reverse_portal",
|
||||||
|
"white_ash"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -19909,5 +19909,79 @@
|
|||||||
"minecraft.interact_with_grindstone",
|
"minecraft.interact_with_grindstone",
|
||||||
"minecraft.target_hit",
|
"minecraft.target_hit",
|
||||||
"minecraft.interact_with_smithing_table"
|
"minecraft.interact_with_smithing_table"
|
||||||
|
],
|
||||||
|
"particles": [
|
||||||
|
"ambient_entity_effect",
|
||||||
|
"angry_villager",
|
||||||
|
"barrier",
|
||||||
|
"block",
|
||||||
|
"bubble",
|
||||||
|
"cloud",
|
||||||
|
"crit",
|
||||||
|
"damage_indicator",
|
||||||
|
"dragon_breath",
|
||||||
|
"dripping_lava",
|
||||||
|
"falling_lava",
|
||||||
|
"landing_lava",
|
||||||
|
"dripping_water",
|
||||||
|
"falling_water",
|
||||||
|
"dust",
|
||||||
|
"effect",
|
||||||
|
"elder_guardian",
|
||||||
|
"enchanted_hit",
|
||||||
|
"enchant",
|
||||||
|
"end_rod",
|
||||||
|
"entity_effect",
|
||||||
|
"explosion_emitter",
|
||||||
|
"explosion",
|
||||||
|
"falling_dust",
|
||||||
|
"firework",
|
||||||
|
"fishing",
|
||||||
|
"flame",
|
||||||
|
"soul_fire_flame",
|
||||||
|
"soul",
|
||||||
|
"flash",
|
||||||
|
"happy_villager",
|
||||||
|
"composter",
|
||||||
|
"heart",
|
||||||
|
"instant_effect",
|
||||||
|
"item",
|
||||||
|
"item_slime",
|
||||||
|
"item_snowball",
|
||||||
|
"large_smoke",
|
||||||
|
"lava",
|
||||||
|
"mycelium",
|
||||||
|
"note",
|
||||||
|
"poof",
|
||||||
|
"portal",
|
||||||
|
"rain",
|
||||||
|
"smoke",
|
||||||
|
"sneeze",
|
||||||
|
"spit",
|
||||||
|
"squid_ink",
|
||||||
|
"sweep_attack",
|
||||||
|
"totem_of_undying",
|
||||||
|
"underwater",
|
||||||
|
"splash",
|
||||||
|
"witch",
|
||||||
|
"bubble_pop",
|
||||||
|
"current_down",
|
||||||
|
"bubble_column_up",
|
||||||
|
"nautilus",
|
||||||
|
"dolphin",
|
||||||
|
"campfire_cosy_smoke",
|
||||||
|
"campfire_signal_smoke",
|
||||||
|
"dripping_honey",
|
||||||
|
"falling_honey",
|
||||||
|
"landing_honey",
|
||||||
|
"falling_nectar",
|
||||||
|
"ash",
|
||||||
|
"crimson_spore",
|
||||||
|
"warped_spore",
|
||||||
|
"dripping_obsidian_tear",
|
||||||
|
"falling_obsidian_tear",
|
||||||
|
"landing_obsidian_tear",
|
||||||
|
"reverse_portal",
|
||||||
|
"white_ash"
|
||||||
]
|
]
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren