Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 21:32:52 +02:00
Some improvements đź‘€ (#126)
* fix particle remaps
fix use bed packets
fix npe in piston handler
* remove todo
* Revert "fix plugin channel remap"
This reverts commit 960197c0
* reformat code
* Comments added
Dieser Commit ist enthalten in:
Ursprung
5a7a8eb334
Commit
b7bd93cfb6
@ -1,5 +1,6 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.block_entity_handlers;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBlockEntityProvider;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
@ -68,6 +69,11 @@ public class PistonHandler implements BackwardsBlockEntityProvider.BackwardsBloc
|
||||
String dataFromTag = getDataFromTag(blockState);
|
||||
if (dataFromTag == null) return tag;
|
||||
|
||||
if (!pistonIds.containsKey(dataFromTag)) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Unmapped piston id: " + dataFromTag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
int id = pistonIds.get(dataFromTag);
|
||||
tag.put(new IntTag("blockId", id >> 4));
|
||||
tag.put(new IntTag("blockData", id & 15));
|
||||
|
@ -84,7 +84,7 @@ public class ParticleMapping {
|
||||
rewrite(39), // (36->39) minecraft:rain -> droplet
|
||||
rewrite(11), // (37->11) minecraft:smoke -> smoke
|
||||
rewrite(48), // (38->48) minecraft:spit -> spit
|
||||
rewrite(-1), // (39->-1) minecraft:squid_ink -> squid_ink TODO NEW?
|
||||
rewrite(12), // (39->-1) minecraft:squid_ink -> squid_ink -> large_smoke
|
||||
rewrite(45), // (40->45) minecraft:sweep_attack -> sweepAttack‌
|
||||
rewrite(47), // (41->47) minecraft:totem_of_undying -> totem
|
||||
rewrite(7), // (42->7) minecraft:underwater -> suspended‌
|
||||
@ -93,7 +93,7 @@ public class ParticleMapping {
|
||||
rewrite(4), // (45->4) minecraft:bubble_pop -> bubble
|
||||
rewrite(4), // (46->4) minecraft:current_down -> bubble
|
||||
rewrite(4), // (47->4) minecraft:bubble_column_up -> bubble
|
||||
rewrite(-1), // (48->-1) minecraft:nautilus -> nautilus TODO NEW?
|
||||
rewrite(18), // (48->-1) minecraft:nautilus -> nautilus -> dripWater
|
||||
rewrite(18), // (49->18) minecraft:dolphin -> dripWater
|
||||
};
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets.BlockItemPack
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.EntityTypeMapping;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
import us.myles.ViaVersion.api.minecraft.VillagerData;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||
@ -463,11 +464,33 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
return meta;
|
||||
});
|
||||
|
||||
// Remove bed location - todo send sleep packet
|
||||
// Remove bed location
|
||||
registerMetaHandler().filter(EntityType1_14.EntityType.LIVINGENTITY, true).handle(e -> {
|
||||
Metadata meta = e.getData();
|
||||
int index = e.getIndex();
|
||||
if (index == 12) {
|
||||
Position position = (Position) meta.getValue();
|
||||
if (position != null) {
|
||||
try {
|
||||
//Use bed
|
||||
PacketWrapper wrapper = new PacketWrapper(0x33, null, e.getUser());
|
||||
wrapper.write(Type.VAR_INT, e.getEntity().getEntityId());
|
||||
wrapper.write(Type.POSITION, position);
|
||||
wrapper.send(Protocol1_13_2To1_14.class);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
//Animation leave bed
|
||||
PacketWrapper wrapper = new PacketWrapper(0x6, null, e.getUser());
|
||||
wrapper.write(Type.VAR_INT, e.getEntity().getEntityId());
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) 2);
|
||||
wrapper.send(Protocol1_13_2To1_14.class);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw new RemovedValueException();
|
||||
} else if (index > 12) {
|
||||
meta.setId(index - 1);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren