Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
Handle new particles (untested), warn for custom world height
Dieser Commit ist enthalten in:
Ursprung
5e5e32769f
Commit
9e4718abc3
@ -53,10 +53,39 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO vibration, dust_color_transition data
|
protocol.registerOutgoing(ClientboundPackets1_17.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
itemRewriter.registerSpawnParticle(ClientboundPackets1_17.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.INT); // Particle Id
|
||||||
|
map(Type.BOOLEAN); // Long distance
|
||||||
|
map(Type.DOUBLE); // X
|
||||||
|
map(Type.DOUBLE); // Y
|
||||||
|
map(Type.DOUBLE); // Z
|
||||||
|
map(Type.FLOAT); // Offset X
|
||||||
|
map(Type.FLOAT); // Offset Y
|
||||||
|
map(Type.FLOAT); // Offset Z
|
||||||
|
map(Type.FLOAT); // Particle data
|
||||||
|
map(Type.INT); // Particle count
|
||||||
|
handler(wrapper -> {
|
||||||
|
int id = wrapper.get(Type.INT, 0);
|
||||||
|
if (id == 15) {
|
||||||
|
// Dust color transition -> Dust
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // R
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // G
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // B
|
||||||
|
wrapper.passthrough(Type.FLOAT); // Scale
|
||||||
|
|
||||||
//TODO possibly have to check: player digging, block break animation, block entity data, block action,
|
wrapper.read(Type.DOUBLE); // R
|
||||||
|
wrapper.read(Type.DOUBLE); // G
|
||||||
|
wrapper.read(Type.DOUBLE); // B
|
||||||
|
} else if (id == 36) {
|
||||||
|
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
|
||||||
|
wrapper.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
handler(itemRewriter.getSpawnParticleHandler(Type.FLAT_VAR_INT_ITEM, Type.DOUBLE));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// The Great Shrunkening
|
// The Great Shrunkening
|
||||||
// Some chunk sections will be lost ¯\_(ツ)_/¯
|
// Some chunk sections will be lost ¯\_(ツ)_/¯
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets;
|
package nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.ViaBackwards;
|
||||||
import nl.matsv.viabackwards.api.rewriters.EntityRewriter;
|
import nl.matsv.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
|
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_16_2Types;
|
import us.myles.ViaVersion.api.entities.Entity1_16_2Types;
|
||||||
@ -12,8 +13,11 @@ 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.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
|
import us.myles.ViaVersion.api.type.types.version.Types1_17;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
||||||
import us.myles.viaversion.libs.gson.JsonElement;
|
import us.myles.viaversion.libs.gson.JsonElement;
|
||||||
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import us.myles.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||||
|
|
||||||
public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||||
|
|
||||||
@ -29,7 +33,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
|
registerExtraTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
|
registerExtraTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
|
||||||
registerEntityDestroy(ClientboundPackets1_17.DESTROY_ENTITIES);
|
registerEntityDestroy(ClientboundPackets1_17.DESTROY_ENTITIES);
|
||||||
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_17.METADATA_LIST, Types1_14.METADATA_LIST);
|
||||||
protocol.registerOutgoing(ClientboundPackets1_17.JOIN_GAME, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_17.JOIN_GAME, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -48,6 +52,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
});
|
});
|
||||||
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
|
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
|
||||||
handler(getWorldDataTracker(1));
|
handler(getWorldDataTracker(1));
|
||||||
|
handler(wrapper -> warnForExtendedHeight(wrapper.get(Type.NBT, 1)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
protocol.registerOutgoing(ClientboundPackets1_17.RESPAWN, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_17.RESPAWN, new PacketRemapper() {
|
||||||
@ -55,6 +60,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.NBT); // Dimension data
|
map(Type.NBT); // Dimension data
|
||||||
handler(getWorldDataTracker(0));
|
handler(getWorldDataTracker(0));
|
||||||
|
handler(wrapper -> warnForExtendedHeight(wrapper.get(Type.NBT, 0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -64,6 +70,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
registerMetaHandler().handle(e -> {
|
registerMetaHandler().handle(e -> {
|
||||||
Metadata meta = e.getData();
|
Metadata meta = e.getData();
|
||||||
MetaType type = meta.getMetaType();
|
MetaType type = meta.getMetaType();
|
||||||
|
meta.setMetaType(MetaType1_14.byId(type.getTypeID()));
|
||||||
if (type == MetaType1_14.Slot) {
|
if (type == MetaType1_14.Slot) {
|
||||||
meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue()));
|
meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue()));
|
||||||
} else if (type == MetaType1_14.BlockID) {
|
} else if (type == MetaType1_14.BlockID) {
|
||||||
@ -74,7 +81,17 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
//protocol.getTranslatableRewriter().processText(text); //TODO
|
//protocol.getTranslatableRewriter().processText(text); //TODO
|
||||||
}
|
}
|
||||||
} else if (type == MetaType1_14.PARTICLE) {
|
} else if (type == MetaType1_14.PARTICLE) {
|
||||||
rewriteParticle((Particle) meta.getValue());
|
Particle particle = (Particle) meta.getValue();
|
||||||
|
if (particle.getId() == 15) {
|
||||||
|
// Remove target color values 4-6
|
||||||
|
particle.getArguments().subList(4, 7).clear();
|
||||||
|
} else if (particle.getId() == 36) {
|
||||||
|
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
|
||||||
|
particle.setId(0);
|
||||||
|
particle.getArguments().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
rewriteParticle(particle);
|
||||||
}
|
}
|
||||||
return meta;
|
return meta;
|
||||||
});
|
});
|
||||||
@ -92,4 +109,12 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
protected EntityType getTypeFromId(int typeId) {
|
protected EntityType getTypeFromId(int typeId) {
|
||||||
return Entity1_16_2Types.getTypeFromId(typeId);
|
return Entity1_16_2Types.getTypeFromId(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void warnForExtendedHeight(CompoundTag tag) {
|
||||||
|
IntTag minY = tag.get("min_y");
|
||||||
|
IntTag height = tag.get("min_y");
|
||||||
|
if (minY.getValue() != 0 || height.getValue() != 256) {
|
||||||
|
ViaBackwards.getPlatform().getLogger().severe("Custom worlds heights are NOT SUPPORTED for 1.16 players and older and may lead to errors!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1012,7 @@
|
|||||||
"falling_dripstone_lava": "falling_lava",
|
"falling_dripstone_lava": "falling_lava",
|
||||||
"dripping_dripstone_water": "dripping_water",
|
"dripping_dripstone_water": "dripping_water",
|
||||||
"falling_dripstone_water": "falling_water",
|
"falling_dripstone_water": "falling_water",
|
||||||
"vibration": "",
|
"dust_color_transition": "dust",
|
||||||
"dust_color_transition": ""
|
"vibration": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren