Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-25 15:50:12 +01:00
Ursprung
8087b42c40
Commit
99884107fc
@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
|
||||
@ -24,7 +25,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
super(protocol, displayType, 2);
|
||||
}
|
||||
|
||||
public void registerSpawnTrackerWithData(int oldPacketId, int newPacketId, EntityType fallingBlockType, ItemRewriter itemRewriter) {
|
||||
public void registerSpawnTrackerWithData(int oldPacketId, int newPacketId, EntityType fallingBlockType, IdRewriteFunction blockStateRewriter) {
|
||||
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -41,7 +42,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
EntityType entityType = setOldEntityId(wrapper);
|
||||
if (entityType == fallingBlockType) {
|
||||
int blockState = wrapper.get(Type.INT, 0);
|
||||
wrapper.set(Type.INT, 0, itemRewriter.toClientRewriter.rewrite(blockState));
|
||||
wrapper.set(Type.INT, 0, blockStateRewriter.rewrite(blockState));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.EntityTypeMapping;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ImmediateRespawn;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_15Types;
|
||||
import us.myles.ViaVersion.api.entities.EntityType;
|
||||
@ -62,7 +63,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
});
|
||||
|
||||
// Spawn Object
|
||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_15Types.EntityType.FALLING_BLOCK, protocol.getBlockItemPackets());
|
||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_15Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
||||
|
||||
// Spawn mob packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
||||
|
@ -22,7 +22,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
// Spawn Object
|
||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, protocol.getBlockItemPackets());
|
||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
||||
|
||||
// Spawn mob packet
|
||||
registerSpawnTracker(0x03, 0x03);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren