mirror of
https://github.com/ViaVersion/ViaAprilFools.git
synced 2025-01-08 19:17:40 +01:00
Updated Via*
This commit is contained in:
parent
9c50a36b67
commit
e98bfb8aa5
@ -20,8 +20,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly "com.viaversion:viaversion:4.6.0-23w04a-SNAPSHOT"
|
compileOnly "com.viaversion:viaversion:4.6.0-23w06a-SNAPSHOT"
|
||||||
compileOnly("com.viaversion:viabackwards-common:4.6.0-23w03a-SNAPSHOT") {
|
compileOnly("com.viaversion:viabackwards-common:4.6.0-23w06a-SNAPSHOT") {
|
||||||
exclude group: "com.viaversion", module: "viaversion"
|
exclude group: "com.viaversion", module: "viaversion"
|
||||||
}
|
}
|
||||||
compileOnly "org.yaml:snakeyaml:1.33"
|
compileOnly "org.yaml:snakeyaml:1.33"
|
||||||
|
@ -6,4 +6,4 @@ org.gradle.configureondemand=true
|
|||||||
# Project properties
|
# Project properties
|
||||||
maven_name=ViaAprilFools
|
maven_name=ViaAprilFools
|
||||||
maven_group=net.raphimc
|
maven_group=net.raphimc
|
||||||
maven_version=2.0.1
|
maven_version=2.0.2
|
||||||
|
@ -23,7 +23,6 @@ import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
|||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
@ -53,7 +52,7 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol<ClientboundPac
|
|||||||
blockItemPackets = new BlockItemPackets3D_Shareware(this);
|
blockItemPackets = new BlockItemPackets3D_Shareware(this);
|
||||||
blockItemPackets.register();
|
blockItemPackets.register();
|
||||||
new EntityPackets3D_Shareware(this).registerPackets();
|
new EntityPackets3D_Shareware(this).registerPackets();
|
||||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
final SoundRewriter<ClientboundPackets3D_Shareware> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.registerSound(ClientboundPackets3D_Shareware.SOUND);
|
soundRewriter.registerSound(ClientboundPackets3D_Shareware.SOUND);
|
||||||
soundRewriter.registerSound(ClientboundPackets3D_Shareware.ENTITY_SOUND);
|
soundRewriter.registerSound(ClientboundPackets3D_Shareware.ENTITY_SOUND);
|
||||||
soundRewriter.registerNamedSound(ClientboundPackets3D_Shareware.NAMED_SOUND);
|
soundRewriter.registerNamedSound(ClientboundPackets3D_Shareware.NAMED_SOUND);
|
||||||
@ -62,21 +61,18 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol<ClientboundPac
|
|||||||
this.registerClientbound(ClientboundPackets3D_Shareware.CHUNK_DATA, new PacketRemapper() {
|
this.registerClientbound(ClientboundPackets3D_Shareware.CHUNK_DATA, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
final Chunk chunk = wrapper.passthrough(new Chunk1_14Type());
|
||||||
public void handle(PacketWrapper packetWrapper) throws Exception {
|
ChunkCenterTracker3D_Shareware entityTracker = wrapper.user().get(ChunkCenterTracker3D_Shareware.class);
|
||||||
final Chunk chunk = packetWrapper.passthrough(new Chunk1_14Type());
|
final int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX());
|
||||||
ChunkCenterTracker3D_Shareware entityTracker = packetWrapper.user().get(ChunkCenterTracker3D_Shareware.class);
|
final int diffZ = Math.abs(entityTracker.getChunkCenterZ() - chunk.getZ());
|
||||||
final int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX());
|
if (entityTracker.isForceSendCenterChunk() || diffX >= SERVERSIDE_VIEW_DISTANCE || diffZ >= SERVERSIDE_VIEW_DISTANCE) {
|
||||||
final int diffZ = Math.abs(entityTracker.getChunkCenterZ() - chunk.getZ());
|
final PacketWrapper fakePosLook = wrapper.create(ClientboundPackets1_14.UPDATE_VIEW_POSITION); // Set center chunk
|
||||||
if (entityTracker.isForceSendCenterChunk() || diffX >= SERVERSIDE_VIEW_DISTANCE || diffZ >= SERVERSIDE_VIEW_DISTANCE) {
|
fakePosLook.write(Type.VAR_INT, chunk.getX());
|
||||||
final PacketWrapper fakePosLook = packetWrapper.create(ClientboundPackets1_14.UPDATE_VIEW_POSITION); // Set center chunk
|
fakePosLook.write(Type.VAR_INT, chunk.getZ());
|
||||||
fakePosLook.write(Type.VAR_INT, chunk.getX());
|
fakePosLook.send(Protocol1_14to3D_Shareware.class);
|
||||||
fakePosLook.write(Type.VAR_INT, chunk.getZ());
|
entityTracker.setChunkCenterX(chunk.getX());
|
||||||
fakePosLook.send(Protocol1_14to3D_Shareware.class);
|
entityTracker.setChunkCenterZ(chunk.getZ());
|
||||||
entityTracker.setChunkCenterX(chunk.getX());
|
|
||||||
entityTracker.setChunkCenterZ(chunk.getZ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -84,13 +80,10 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol<ClientboundPac
|
|||||||
this.registerClientbound(ClientboundPackets3D_Shareware.RESPAWN, new PacketRemapper() {
|
this.registerClientbound(ClientboundPackets3D_Shareware.RESPAWN, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
ChunkCenterTracker3D_Shareware entityTracker = wrapper.user().get(ChunkCenterTracker3D_Shareware.class);
|
||||||
public void handle(PacketWrapper packetWrapper) throws Exception {
|
// The client may reset the center chunk if dimension is changed
|
||||||
ChunkCenterTracker3D_Shareware entityTracker = packetWrapper.user().get(ChunkCenterTracker3D_Shareware.class);
|
entityTracker.setForceSendCenterChunk(true);
|
||||||
// The client may reset the center chunk if dimension is changed
|
|
||||||
entityTracker.setForceSendCenterChunk(true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPacke
|
|||||||
import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ClientboundPackets3D_Shareware;
|
import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ClientboundPackets3D_Shareware;
|
||||||
import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.Protocol1_14to3D_Shareware;
|
import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.Protocol1_14to3D_Shareware;
|
||||||
|
|
||||||
public class BlockItemPackets3D_Shareware extends ItemRewriter<Protocol1_14to3D_Shareware> {
|
public class BlockItemPackets3D_Shareware extends ItemRewriter<ClientboundPackets3D_Shareware, ServerboundPackets1_14, Protocol1_14to3D_Shareware> {
|
||||||
|
|
||||||
public BlockItemPackets3D_Shareware(Protocol1_14to3D_Shareware protocol) {
|
public BlockItemPackets3D_Shareware(Protocol1_14to3D_Shareware protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
|
@ -45,7 +45,7 @@ public class Protocol1_16to20w14infinite extends BackwardsProtocol<ClientboundPa
|
|||||||
private static final UUID ZERO_UUID = new UUID(0, 0);
|
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||||
|
|
||||||
private BlockItemPackets20w14infinite blockItemPackets;
|
private BlockItemPackets20w14infinite blockItemPackets;
|
||||||
private TagRewriter tagRewriter;
|
private TagRewriter<ClientboundPackets20w14infinite> tagRewriter;
|
||||||
private MetadataRewriter1_16to20w14infinite metadataRewriter;
|
private MetadataRewriter1_16to20w14infinite metadataRewriter;
|
||||||
|
|
||||||
public Protocol1_16to20w14infinite() {
|
public Protocol1_16to20w14infinite() {
|
||||||
@ -56,7 +56,7 @@ public class Protocol1_16to20w14infinite extends BackwardsProtocol<ClientboundPa
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
this.metadataRewriter = new MetadataRewriter1_16to20w14infinite(this);
|
this.metadataRewriter = new MetadataRewriter1_16to20w14infinite(this);
|
||||||
metadataRewriter.register();
|
metadataRewriter.register();
|
||||||
tagRewriter = new TagRewriter(this);
|
tagRewriter = new TagRewriter<>(this);
|
||||||
|
|
||||||
this.executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, () -> {
|
this.executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, () -> {
|
||||||
MAPPINGS.load();
|
MAPPINGS.load();
|
||||||
@ -64,16 +64,16 @@ public class Protocol1_16to20w14infinite extends BackwardsProtocol<ClientboundPa
|
|||||||
});
|
});
|
||||||
|
|
||||||
tagRewriter.register(ClientboundPackets20w14infinite.TAGS, RegistryType.ENTITY);
|
tagRewriter.register(ClientboundPackets20w14infinite.TAGS, RegistryType.ENTITY);
|
||||||
new StatisticsRewriter(this).register(ClientboundPackets20w14infinite.STATISTICS);
|
new StatisticsRewriter<>(this).register(ClientboundPackets20w14infinite.STATISTICS);
|
||||||
this.blockItemPackets = new BlockItemPackets20w14infinite(this);
|
this.blockItemPackets = new BlockItemPackets20w14infinite(this);
|
||||||
this.blockItemPackets.register();
|
this.blockItemPackets.register();
|
||||||
EntityPackets20w14infinite.register(this);
|
EntityPackets20w14infinite.register(this);
|
||||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
final SoundRewriter<ClientboundPackets20w14infinite> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.registerSound(ClientboundPackets20w14infinite.SOUND);
|
soundRewriter.registerSound(ClientboundPackets20w14infinite.SOUND);
|
||||||
soundRewriter.registerSound(ClientboundPackets20w14infinite.ENTITY_SOUND);
|
soundRewriter.registerSound(ClientboundPackets20w14infinite.ENTITY_SOUND);
|
||||||
soundRewriter.registerNamedSound(ClientboundPackets20w14infinite.NAMED_SOUND);
|
soundRewriter.registerNamedSound(ClientboundPackets20w14infinite.NAMED_SOUND);
|
||||||
soundRewriter.registerStopSound(ClientboundPackets20w14infinite.STOP_SOUND);
|
soundRewriter.registerStopSound(ClientboundPackets20w14infinite.STOP_SOUND);
|
||||||
new RecipeRewriter1_14(this).registerDefaultHandler(ClientboundPackets20w14infinite.DECLARE_RECIPES);
|
new RecipeRewriter1_14<>(this).registerDefaultHandler(ClientboundPackets20w14infinite.DECLARE_RECIPES);
|
||||||
|
|
||||||
this.registerClientbound(ClientboundPackets20w14infinite.CHAT_MESSAGE, new PacketRemapper() {
|
this.registerClientbound(ClientboundPackets20w14infinite.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,11 +24,12 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
|||||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||||
import com.viaversion.viaversion.api.type.types.Particle;
|
import com.viaversion.viaversion.api.type.types.Particle;
|
||||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||||
|
import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.ClientboundPackets20w14infinite;
|
||||||
import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
|
import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MetadataRewriter1_16to20w14infinite extends EntityRewriter<Protocol1_16to20w14infinite> {
|
public class MetadataRewriter1_16to20w14infinite extends EntityRewriter<ClientboundPackets20w14infinite, Protocol1_16to20w14infinite> {
|
||||||
|
|
||||||
public MetadataRewriter1_16to20w14infinite(Protocol1_16to20w14infinite protocol) {
|
public MetadataRewriter1_16to20w14infinite(Protocol1_16to20w14infinite protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
|
@ -20,6 +20,8 @@ package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets;
|
|||||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
@ -36,7 +38,7 @@ import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.data.Biom
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BlockItemPackets20w14infinite extends ItemRewriter<Protocol1_16to20w14infinite> {
|
public class BlockItemPackets20w14infinite extends ItemRewriter<ClientboundPackets20w14infinite, ServerboundPackets1_16, Protocol1_16to20w14infinite> {
|
||||||
|
|
||||||
public BlockItemPackets20w14infinite(Protocol1_16to20w14infinite protocol) {
|
public BlockItemPackets20w14infinite(Protocol1_16to20w14infinite protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
@ -52,7 +54,7 @@ public class BlockItemPackets20w14infinite extends ItemRewriter<Protocol1_16to20
|
|||||||
this.registerSpawnParticle(ClientboundPackets20w14infinite.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
this.registerSpawnParticle(ClientboundPackets20w14infinite.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||||
this.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
this.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
this.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
this.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
final BlockRewriter blockRewriter = new BlockRewriter(this.protocol, Type.POSITION1_14);
|
final BlockRewriter<ClientboundPackets20w14infinite> blockRewriter = new BlockRewriter<>(this.protocol, Type.POSITION1_14);
|
||||||
blockRewriter.registerBlockAction(ClientboundPackets20w14infinite.BLOCK_ACTION);
|
blockRewriter.registerBlockAction(ClientboundPackets20w14infinite.BLOCK_ACTION);
|
||||||
blockRewriter.registerBlockChange(ClientboundPackets20w14infinite.BLOCK_CHANGE);
|
blockRewriter.registerBlockChange(ClientboundPackets20w14infinite.BLOCK_CHANGE);
|
||||||
blockRewriter.registerMultiBlockChange(ClientboundPackets20w14infinite.MULTI_BLOCK_CHANGE);
|
blockRewriter.registerMultiBlockChange(ClientboundPackets20w14infinite.MULTI_BLOCK_CHANGE);
|
||||||
@ -79,9 +81,10 @@ public class BlockItemPackets20w14infinite extends ItemRewriter<Protocol1_16to20
|
|||||||
for (int s = 0; s < chunk.getSections().length; s++) {
|
for (int s = 0; s < chunk.getSections().length; s++) {
|
||||||
ChunkSection section = chunk.getSections()[s];
|
ChunkSection section = chunk.getSections()[s];
|
||||||
if (section == null) continue;
|
if (section == null) continue;
|
||||||
for (int i = 0; i < section.getPaletteSize(); i++) {
|
final DataPalette blockPalette = section.palette(PaletteType.BLOCKS);
|
||||||
int old = section.getPaletteEntry(i);
|
for (int i = 0; i < blockPalette.size(); i++) {
|
||||||
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
|
int old = blockPalette.idByIndex(i);
|
||||||
|
blockPalette.setIdByIndex(i, protocol.getMappingData().getNewBlockStateId(old));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user