diff --git a/build.gradle b/build.gradle
index 084d4d5..5c21cea 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ plugins {
}
base {
- java.toolchain.languageVersion = JavaLanguageVersion.of(8)
+ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
group = project.maven_group ?: rootProject.maven_group
@@ -23,8 +23,8 @@ repositories {
}
dependencies {
- compileOnly "com.viaversion:viaversion-common:4.10.1"
- compileOnly "com.viaversion:viabackwards-common:4.10.1"
+ compileOnly "com.viaversion:viaversion-common:5.0.0-SNAPSHOT"
+ compileOnly "com.viaversion:viabackwards-common:5.0.0-SNAPSHOT"
compileOnly "org.yaml:snakeyaml:2.2"
compileOnly "com.google.guava:guava:33.2.0-jre"
compileOnly "io.netty:netty-handler:4.1.109.Final"
@@ -41,7 +41,6 @@ sourceSets {
java {
withSourcesJar()
- withJavadocJar()
}
jar {
diff --git a/gradle.properties b/gradle.properties
index 422e24c..fb1bc8a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,4 +4,4 @@ org.gradle.configureondemand=true
maven_group=net.raphimc
maven_name=ViaAprilFools
-maven_version=2.0.13-SNAPSHOT
+maven_version=3.0.0-SNAPSHOT
diff --git a/src/main/java/net/raphimc/viaaprilfools/ViaAprilFoolsConfig.java b/src/main/java/net/raphimc/viaaprilfools/ViaAprilFoolsConfig.java
index 105729d..cc28077 100644
--- a/src/main/java/net/raphimc/viaaprilfools/ViaAprilFoolsConfig.java
+++ b/src/main/java/net/raphimc/viaaprilfools/ViaAprilFoolsConfig.java
@@ -24,11 +24,12 @@ import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
public class ViaAprilFoolsConfig extends Config implements net.raphimc.viaaprilfools.platform.ViaAprilFoolsConfig {
- public ViaAprilFoolsConfig(final File configFile) {
- super(configFile);
+ public ViaAprilFoolsConfig(final File configFile, final Logger logger) {
+ super(configFile, logger);
}
@Override
diff --git a/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingData.java
similarity index 75%
rename from src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java
rename to src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingData.java
index ee51400..6f17198 100644
--- a/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java
+++ b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingData.java
@@ -17,28 +17,28 @@
*/
package net.raphimc.viaaprilfools.api.data;
-import com.viaversion.viabackwards.api.data.BackwardsMappings;
+import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viaversion.api.protocol.Protocol;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
+import com.viaversion.nbt.tag.CompoundTag;
import net.raphimc.viaaprilfools.ViaAprilFools;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.logging.Logger;
-public class AprilFoolsMappings extends BackwardsMappings {
+public class AprilFoolsMappingData extends BackwardsMappingData {
- public AprilFoolsMappings(String unmappedVersion, String mappedVersion, @Nullable Class extends Protocol, ?, ?, ?>> vvProtocolClass) {
+ public AprilFoolsMappingData(String unmappedVersion, String mappedVersion, @Nullable Class extends Protocol, ?, ?, ?>> vvProtocolClass) {
super(unmappedVersion, mappedVersion, vvProtocolClass);
}
@Override
protected @Nullable CompoundTag readMappingsFile(String name) {
- return VAFMappingDataLoader.INSTANCE.loadNBTFromDir(name);
+ return AprilFoolsMappingDataLoader.INSTANCE.loadNBTFromDir(name);
}
@Override
protected @Nullable CompoundTag readUnmappedIdentifiersFile(String name) {
- return VAFMappingDataLoader.INSTANCE.loadNBT(name, true);
+ return AprilFoolsMappingDataLoader.INSTANCE.loadNBT(name, true);
}
@Override
diff --git a/src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingDataLoader.java
similarity index 80%
rename from src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java
rename to src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingDataLoader.java
index a8c81e7..1d58876 100644
--- a/src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java
+++ b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappingDataLoader.java
@@ -23,12 +23,12 @@ import net.raphimc.viaaprilfools.ViaAprilFools;
import java.io.File;
import java.util.logging.Logger;
-public class VAFMappingDataLoader extends BackwardsMappingDataLoader {
+public class AprilFoolsMappingDataLoader extends BackwardsMappingDataLoader {
- public static final VAFMappingDataLoader INSTANCE = new VAFMappingDataLoader();
+ public static final AprilFoolsMappingDataLoader INSTANCE = new AprilFoolsMappingDataLoader();
- public VAFMappingDataLoader() {
- super(VAFMappingDataLoader.class, "assets/viaaprilfools/data/");
+ public AprilFoolsMappingDataLoader() {
+ super(AprilFoolsMappingDataLoader.class, "assets/viaaprilfools/data/");
}
@Override
diff --git a/src/main/java/net/raphimc/viaaprilfools/platform/ViaAprilFoolsPlatform.java b/src/main/java/net/raphimc/viaaprilfools/platform/ViaAprilFoolsPlatform.java
index 014f1d5..a278c65 100644
--- a/src/main/java/net/raphimc/viaaprilfools/platform/ViaAprilFoolsPlatform.java
+++ b/src/main/java/net/raphimc/viaaprilfools/platform/ViaAprilFoolsPlatform.java
@@ -23,10 +23,10 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.raphimc.viaaprilfools.ViaAprilFools;
import net.raphimc.viaaprilfools.ViaAprilFoolsConfig;
import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.Protocol1_14to3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_16_2toCombatTest8c.Protocol1_16_2toCombatTest8c;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol3D_Sharewareto1_14.Protocol3D_Sharewareto1_14;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.Protocol1_14to3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.scombattest8ctov1_16_2.Protocol1_16_2toCombatTest8c;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.Protocol20w14infiniteTo1_16;
+import net.raphimc.viaaprilfools.protocol.v1_14tos3d_shareware.Protocol3D_Sharewareto1_14;
import java.io.File;
import java.util.logging.Logger;
@@ -34,7 +34,7 @@ import java.util.logging.Logger;
public interface ViaAprilFoolsPlatform {
default void init(final File configFile) {
- final ViaAprilFoolsConfig config = new ViaAprilFoolsConfig(configFile);
+ final ViaAprilFoolsConfig config = new ViaAprilFoolsConfig(configFile, getLogger());
config.reload();
ViaAprilFools.init(this, config);
Via.getManager().getConfigurationProvider().register(config);
@@ -43,7 +43,7 @@ public interface ViaAprilFoolsPlatform {
final ProtocolManager protocolManager = Via.getManager().getProtocolManager();
protocolManager.registerProtocol(new Protocol1_14to3D_Shareware(), ProtocolVersion.v1_14, AprilFoolsProtocolVersion.s3d_shareware);
protocolManager.registerProtocol(new Protocol3D_Sharewareto1_14(), AprilFoolsProtocolVersion.s3d_shareware, ProtocolVersion.v1_14);
- protocolManager.registerProtocol(new Protocol1_16to20w14infinite(), ProtocolVersion.v1_16, AprilFoolsProtocolVersion.s20w14infinite);
+ protocolManager.registerProtocol(new Protocol20w14infiniteTo1_16(), ProtocolVersion.v1_16, AprilFoolsProtocolVersion.s20w14infinite);
protocolManager.registerProtocol(new Protocol1_16_2toCombatTest8c(), ProtocolVersion.v1_16_2, AprilFoolsProtocolVersion.sCombatTest8c);
}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/Protocol20w14infiniteTo1_16.java
similarity index 71%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/Protocol20w14infiniteTo1_16.java
index eb40a3d..3ab5af5 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/Protocol20w14infiniteTo1_16.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite;
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16;
import com.viaversion.viabackwards.api.BackwardsProtocol;
-import com.viaversion.viabackwards.api.data.BackwardsMappings;
+import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@@ -26,32 +26,33 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import com.viaversion.viaversion.api.type.Type;
+import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.Protocol1_15_2To1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ClientboundPackets1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ServerboundPackets1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.provider.PlayerAbilitiesProvider;
import com.viaversion.viaversion.rewriter.RecipeRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
-import net.raphimc.viaaprilfools.api.data.AprilFoolsMappings;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.metadata.MetadataRewriter1_16to20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets.BlockItemPackets20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets.EntityPackets20w14infinite;
+import net.raphimc.viaaprilfools.api.data.AprilFoolsMappingData;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter.EntityPacketRewriter20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ClientboundPackets20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ServerboundPackets20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter.BlockItemPacketRewriter20w14infinite;
import java.util.UUID;
-public class Protocol1_16to20w14infinite extends BackwardsProtocol {
+public class Protocol20w14infiniteTo1_16 extends BackwardsProtocol {
- public static final BackwardsMappings MAPPINGS = new AprilFoolsMappings("20w14infinite", "1.16", Protocol1_16To1_15_2.class);
+ public static final BackwardsMappingData MAPPINGS = new AprilFoolsMappingData("20w14infinite", "1.16", Protocol1_15_2To1_16.class);
private static final UUID ZERO_UUID = new UUID(0, 0);
- private final BlockItemPackets20w14infinite blockItemPackets = new BlockItemPackets20w14infinite(this);
- private final MetadataRewriter1_16to20w14infinite metadataRewriter = new MetadataRewriter1_16to20w14infinite(this);
+ private final BlockItemPacketRewriter20w14infinite itemRewriter = new BlockItemPacketRewriter20w14infinite(this);
+ private final EntityPacketRewriter20w14infinite entityRewriter = new EntityPacketRewriter20w14infinite(this);
private final TagRewriter tagRewriter = new TagRewriter<>(this);
- public Protocol1_16to20w14infinite() {
+ public Protocol20w14infiniteTo1_16() {
super(ClientboundPackets20w14infinite.class, ClientboundPackets1_16.class, ServerboundPackets20w14infinite.class, ServerboundPackets1_16.class);
}
@@ -59,58 +60,57 @@ public class Protocol1_16to20w14infinite extends BackwardsProtocol(this).register(ClientboundPackets20w14infinite.STATISTICS);
- EntityPackets20w14infinite.register(this);
+ tagRewriter.register(ClientboundPackets20w14infinite.UPDATE_TAGS, RegistryType.ENTITY);
+ new StatisticsRewriter<>(this).register(ClientboundPackets20w14infinite.AWARD_STATS);
final SoundRewriter soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerSound(ClientboundPackets20w14infinite.SOUND);
- soundRewriter.registerSound(ClientboundPackets20w14infinite.ENTITY_SOUND);
- soundRewriter.registerNamedSound(ClientboundPackets20w14infinite.NAMED_SOUND);
+ soundRewriter.registerSound(ClientboundPackets20w14infinite.SOUND_ENTITY);
+ soundRewriter.registerNamedSound(ClientboundPackets20w14infinite.CUSTOM_SOUND);
soundRewriter.registerStopSound(ClientboundPackets20w14infinite.STOP_SOUND);
- new RecipeRewriter<>(this).register(ClientboundPackets20w14infinite.DECLARE_RECIPES);
+ new RecipeRewriter<>(this).register(ClientboundPackets20w14infinite.UPDATE_RECIPES);
- this.registerClientbound(ClientboundPackets20w14infinite.CHAT_MESSAGE, new PacketHandlers() {
+ this.registerClientbound(ClientboundPackets20w14infinite.CHAT, new PacketHandlers() {
@Override
public void register() {
- map(Type.COMPONENT);
- map(Type.BYTE);
+ map(Types.COMPONENT);
+ map(Types.BYTE);
handler(wrapper -> {
- wrapper.write(Type.UUID, ZERO_UUID); // Sender uuid - always send as 'system'
+ wrapper.write(Types.UUID, ZERO_UUID); // Sender uuid - always send as 'system'
});
}
});
- this.cancelServerbound(ServerboundPackets1_16.GENERATE_JIGSAW);
- this.registerServerbound(ServerboundPackets1_16.INTERACT_ENTITY, new PacketHandlers() {
+ this.cancelServerbound(ServerboundPackets1_16.JIGSAW_GENERATE);
+ this.registerServerbound(ServerboundPackets1_16.INTERACT, new PacketHandlers() {
@Override
public void register() {
handler(wrapper -> {
- wrapper.passthrough(Type.VAR_INT); // Entity Id
- int action = wrapper.passthrough(Type.VAR_INT);
+ wrapper.passthrough(Types.VAR_INT); // Entity Id
+ int action = wrapper.passthrough(Types.VAR_INT);
if (action == 0 || action == 2) {
if (action == 2) {
// Location
- wrapper.passthrough(Type.FLOAT);
- wrapper.passthrough(Type.FLOAT);
- wrapper.passthrough(Type.FLOAT);
+ wrapper.passthrough(Types.FLOAT);
+ wrapper.passthrough(Types.FLOAT);
+ wrapper.passthrough(Types.FLOAT);
}
- wrapper.passthrough(Type.VAR_INT); // Hand
+ wrapper.passthrough(Types.VAR_INT); // Hand
}
// New boolean: Whether the client is sneaking/pressing shift
- wrapper.read(Type.BOOLEAN);
+ wrapper.read(Types.BOOLEAN);
});
}
});
this.registerServerbound(ServerboundPackets1_16.PLAYER_ABILITIES, new PacketHandlers() {
@Override
public void register() {
- map(Type.BYTE); // Flags
+ map(Types.BYTE); // Flags
handler(wrapper -> {
final PlayerAbilitiesProvider playerAbilities = Via.getManager().getProviders().get(PlayerAbilitiesProvider.class);
- wrapper.write(Type.FLOAT, playerAbilities.getFlyingSpeed(wrapper.user()));
- wrapper.write(Type.FLOAT, playerAbilities.getWalkingSpeed(wrapper.user()));
+ wrapper.write(Types.FLOAT, playerAbilities.getFlyingSpeed(wrapper.user()));
+ wrapper.write(Types.FLOAT, playerAbilities.getWalkingSpeed(wrapper.user()));
});
}
});
@@ -160,6 +160,7 @@ public class Protocol1_16to20w14infinite extends BackwardsProtocol.
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.data;
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.data;
import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList;
import com.viaversion.viaversion.libs.fastutil.ints.IntList;
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ClientboundPackets20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ClientboundPackets20w14infinite.java
new file mode 100644
index 0000000..969e5b3
--- /dev/null
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ClientboundPackets20w14infinite.java
@@ -0,0 +1,128 @@
+/*
+ * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
+ * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet;
+
+import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
+
+public enum ClientboundPackets20w14infinite implements ClientboundPacketType {
+
+ ADD_ENTITY, // 0x00
+ ADD_EXPERIENCE_ORB, // 0x01
+ ADD_GLOBAL_ENTITY, // 0x02
+ ADD_MOB, // 0x03
+ ADD_PAINTING, // 0x04
+ ADD_PLAYER, // 0x05
+ ANIMATE, // 0x09
+ AWARD_STATS, // 0x07
+ BLOCK_BREAK_ACK, // 0x08
+ BLOCK_DESTRUCTION, // 0x09
+ BLOCK_ENTITY_DATA, // 0x0A
+ BLOCK_EVENT, // 0x0B
+ BLOCK_UPDATE, // 0x0C
+ BOSS_EVENT, // 0x0D
+ CHANGE_DIFFICULTY, // 0x0E
+ CHAT, // 0x0F
+ CHUNK_BLOCKS_UPDATE, // 0x10
+ COMMAND_SUGGESTIONS, // 0x11
+ COMMANDS, // 0x12
+ CONTAINER_ACK, // 0x13
+ CONTAINER_CLOSE, // 0x14
+ CONTAINER_SET_CONTENT, // 0x15
+ CONTAINER_SET_DATA, // 0x16
+ CONTAINER_SET_SLOT, // 0x17
+ COOLDOWN, // 0x18
+ CUSTOM_PAYLOAD, // 0x19
+ CUSTOM_SOUND, // 0x1A
+ DISCONNECT, // 0x1B
+ ENTITY_EVENT, // 0x1C
+ EXPLODE, // 0x1D
+ FORGET_LEVEL_CHUNK, // 0x1E
+ GAME_EVENT, // 0x1F
+ HORSE_SCREEN_OPEN, // 0x20
+ KEEP_ALIVE, // 0x21
+ LEVEL_CHUNK, // 0x22
+ LEVEL_EVENT, // 0x22
+ LEVEL_PARTICLES, // 0x24
+ LIGHT_UPDATE, // 0x25
+ LOGIN, // 0x26
+ MAP_ITEM_DATA, // 0x27
+ MERCHANT_OFFERS, // 0x28
+ MOVE_ENTITY_POS, // 0x29
+ MOVE_ENTITY_POS_ROT, // 0x2A
+ MOVE_ENTITY_ROT, // 0x2B
+ MOVE_ENTITY, // 0x2C
+ MOVE_VEHICLE, // 0x2D
+ OPEN_BOOK, // 0x2E
+ OPEN_SCREEN, // 0x2F
+ OPEN_SIGN_EDITOR, // 0x30
+ PLACE_GHOST_RECIPE, // 0x31
+ PLAYER_ABILITIES, // 0x32
+ PLAYER_COMBAT, // 0x33
+ PLAYER_INFO, // 0x34
+ PLAYER_LOOK_AT, // 0x35
+ PLAYER_POSITION, // 0x36
+ RECIPE, // 0x37
+ REMOVE_ENTITIES, // 0x38
+ REMOVE_MOB_EFFECT, // 0x39
+ RESOURCE_PACK, // 0x3A
+ RESPAWN, // 0x3B
+ ROTATE_HEAD, // 0x3C
+ SELECT_ADVANCEMENTS_TAB, // 0x3D
+ SET_BORDER, // 0x3E
+ SET_CAMERA, // 0x3F
+ SET_CARRIED_ITEM, // 0x40
+ SET_CHUNK_CACHE_CENTER, // 0x41
+ SET_CHUNK_CACHE_RADIUS, // 0x42
+ SET_DEFAULT_SPAWN_POSITION, // 0x43
+ SET_DISPLAY_OBJECTIVE, // 0x44
+ SET_ENTITY_DATA, // 0x45
+ SET_ENTITY_LINK, // 0x46
+ SET_ENTITY_MOTION, // 0x47
+ SET_EQUIPMENT, // 0x48
+ SET_EXPERIENCE, // 0x49
+ SET_HEALTH, // 0x4A
+ SET_OBJECTIVE, // 0x4B
+ SET_PASSENGERS, // 0x4C
+ SET_PLAYER_TEAM, // 0x4D
+ SET_SCORE, // 0x4E
+ SET_TIME, // 0x4F
+ SET_TITLES, // 0x50
+ SOUND_ENTITY, // 0x51
+ SOUND, // 0x52
+ STOP_SOUND, // 0x53
+ TAB_LIST, // 0x54
+ TAG_QUERY, // 0x55
+ TAKE_ITEM_ENTITY, // 0x56
+ TELEPORT_ENTITY, // 0x57
+ UPDATE_ADVANCEMENTS, // 0x58
+ UPDATE_ATTRIBUTES, // 0x59
+ UPDATE_MOB_EFFECT, // 0x5A
+ UPDATE_RECIPES, // 0x5B
+ UPDATE_TAGS; // 0x5C
+
+ @Override
+ public int getId() {
+ return this.ordinal();
+ }
+
+ @Override
+ public String getName() {
+ return this.name();
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ServerboundPackets20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ServerboundPackets20w14infinite.java
similarity index 51%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ServerboundPackets20w14infinite.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ServerboundPackets20w14infinite.java
index 7b5e23f..d07f8f6 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ServerboundPackets20w14infinite.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/packet/ServerboundPackets20w14infinite.java
@@ -15,57 +15,57 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite;
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
public enum ServerboundPackets20w14infinite implements ServerboundPacketType {
- TELEPORT_CONFIRM, // 0x00
- QUERY_BLOCK_NBT, // 0x01
- SET_DIFFICULTY, // 0x02
- CHAT_MESSAGE, // 0x03
- CLIENT_STATUS, // 0x04
- CLIENT_SETTINGS, // 0x05
- TAB_COMPLETE, // 0x06
- WINDOW_CONFIRMATION, // 0x07
- CLICK_WINDOW_BUTTON, // 0x08
- CLICK_WINDOW, // 0x09
- CLOSE_WINDOW, // 0x0A
- PLUGIN_MESSAGE, // 0x0B
+ ACCEPT_TELEPORTATION, // 0x00
+ BLOCK_ENTITY_TAG_QUERY, // 0x01
+ CHANGE_DIFFICULTY, // 0x02
+ CHAT, // 0x03
+ CLIENT_COMMAND, // 0x04
+ CLIENT_INFORMATION, // 0x05
+ COMMAND_SUGGESTION, // 0x06
+ CONTAINER_ACK, // 0x07
+ CONTAINER_BUTTON_CLICK, // 0x08
+ CONTAINER_CLICK, // 0x09
+ CONTAINER_CLOSE, // 0x0A
+ CUSTOM_PAYLOAD, // 0x0B
EDIT_BOOK, // 0x0C
- ENTITY_NBT_REQUEST, // 0x0D
- INTERACT_ENTITY, // 0x0E
+ ENTITY_TAG_QUERY, // 0x0D
+ INTERACT, // 0x0E
KEEP_ALIVE, // 0x0F
LOCK_DIFFICULTY, // 0x10
- PLAYER_POSITION, // 0x11
- PLAYER_POSITION_AND_ROTATION, // 0x12
- PLAYER_ROTATION, // 0x13
- PLAYER_MOVEMENT, // 0x14
- VEHICLE_MOVE, // 0x15
- STEER_BOAT, // 0x16
+ MOVE_PLAYER_POS, // 0x11
+ MOVE_PLAYER_POS_ROT, // 0x12
+ MOVE_PLAYER_ROT, // 0x13
+ MOVE_PLAYER_STATUS_ONLY, // 0x14
+ MOVE_VEHICLE, // 0x15
+ PADDLE_BOAT, // 0x16
PICK_ITEM, // 0x17
- CRAFT_RECIPE_REQUEST, // 0x18
+ PLACE_RECIPE, // 0x18
PLAYER_ABILITIES, // 0x19
- PLAYER_DIGGING, // 0x1A
- ENTITY_ACTION, // 0x1B
- STEER_VEHICLE, // 0x1C
- RECIPE_BOOK_DATA, // 0x1D
+ PLAYER_ACTION, // 0x1A
+ PLAYER_COMMAND, // 0x1B
+ PLAYER_INPUT, // 0x1C
+ RECIPE_BOOK_UPDATE, // 0x1D
RENAME_ITEM, // 0x1E
- RESOURCE_PACK_STATUS, // 0x1F
- ADVANCEMENT_TAB, // 0x20
+ RESOURCE_PACK, // 0x1F
+ SEEN_ADVANCEMENTS, // 0x20
SELECT_TRADE, // 0x21
- SET_BEACON_EFFECT, // 0x22
- HELD_ITEM_CHANGE, // 0x23
- UPDATE_COMMAND_BLOCK, // 0x24
- UPDATE_COMMAND_BLOCK_MINECART, // 0x25
- CREATIVE_INVENTORY_ACTION, // 0x26
- UPDATE_JIGSAW_BLOCK, // 0x27
- UPDATE_STRUCTURE_BLOCK, // 0x28
- UPDATE_SIGN, // 0x29
- ANIMATION, // 0x2A
- SPECTATE, // 0x2B
- PLAYER_BLOCK_PLACEMENT, // 0x2C
+ SET_BEACON, // 0x22
+ SET_CARRIED_ITEM, // 0x23
+ SET_COMMAND_BLOCK, // 0x24
+ SET_COMMAND_MINECART, // 0x25
+ SET_CREATIVE_MODE_SLOT, // 0x26
+ SET_JIGSAW_BLOCK, // 0x27
+ SET_STRUCTURE_BLOCK, // 0x28
+ SIGN_UPDATE, // 0x29
+ SWING, // 0x2A
+ TELEPORT_TO_ENTITY, // 0x2B
+ USE_ITEM_ON, // 0x2C
USE_ITEM; // 0x2D
@Override
@@ -78,4 +78,4 @@ public enum ServerboundPackets20w14infinite implements ServerboundPacketType {
return this.name();
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/BlockItemPackets20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/BlockItemPacketRewriter20w14infinite.java
similarity index 61%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/BlockItemPackets20w14infinite.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/BlockItemPacketRewriter20w14infinite.java
index 38cfa4e..f10815e 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/BlockItemPackets20w14infinite.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/BlockItemPacketRewriter20w14infinite.java
@@ -15,61 +15,61 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets;
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
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.PacketHandlers;
-import com.viaversion.viaversion.api.type.Type;
+import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_15;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.LongArrayTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ServerboundPackets1_16;
+import com.viaversion.nbt.tag.CompoundTag;
+import com.viaversion.nbt.tag.LongArrayTag;
+import com.viaversion.nbt.tag.Tag;
import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.ItemRewriter;
import com.viaversion.viaversion.util.CompactArrayUtil;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.ClientboundPackets20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.data.BiomeData20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ClientboundPackets20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.Protocol20w14infiniteTo1_16;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.data.BiomeData20w14infinite;
import java.util.Map;
-public class BlockItemPackets20w14infinite extends ItemRewriter {
+public class BlockItemPacketRewriter20w14infinite extends ItemRewriter {
- public BlockItemPackets20w14infinite(Protocol1_16to20w14infinite protocol) {
- super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY);
+ public BlockItemPacketRewriter20w14infinite(Protocol20w14infiniteTo1_16 protocol) {
+ super(protocol, Types.ITEM1_13_2, Types.ITEM1_13_2_SHORT_ARRAY);
}
@Override
protected void registerPackets() {
- this.registerSetCooldown(ClientboundPackets20w14infinite.COOLDOWN);
- this.registerWindowItems(ClientboundPackets20w14infinite.WINDOW_ITEMS);
- this.registerSetSlot(ClientboundPackets20w14infinite.SET_SLOT);
- this.registerTradeList(ClientboundPackets20w14infinite.TRADE_LIST);
- this.registerAdvancements(ClientboundPackets20w14infinite.ADVANCEMENTS);
- this.registerSpawnParticle(ClientboundPackets20w14infinite.SPAWN_PARTICLE, Type.DOUBLE);
- this.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW);
- this.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION);
- final BlockRewriter blockRewriter = new BlockRewriter<>(this.protocol, Type.POSITION1_14);
- blockRewriter.registerBlockAction(ClientboundPackets20w14infinite.BLOCK_ACTION);
- blockRewriter.registerBlockChange(ClientboundPackets20w14infinite.BLOCK_CHANGE);
- blockRewriter.registerMultiBlockChange(ClientboundPackets20w14infinite.MULTI_BLOCK_CHANGE);
- blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets20w14infinite.ACKNOWLEDGE_PLAYER_DIGGING);
- blockRewriter.registerEffect(ClientboundPackets20w14infinite.EFFECT, 1010, 2001);
+ this.registerCooldown(ClientboundPackets20w14infinite.COOLDOWN);
+ this.registerSetContent(ClientboundPackets20w14infinite.CONTAINER_SET_CONTENT);
+ this.registerSetSlot(ClientboundPackets20w14infinite.CONTAINER_SET_SLOT);
+ this.registerMerchantOffers(ClientboundPackets20w14infinite.MERCHANT_OFFERS);
+ this.registerAdvancements(ClientboundPackets20w14infinite.UPDATE_ADVANCEMENTS);
+ this.registerLevelParticles(ClientboundPackets20w14infinite.LEVEL_PARTICLES, Types.DOUBLE);
+ this.registerContainerClick(ServerboundPackets1_16.CONTAINER_CLICK);
+ this.registerSetCreativeModeSlot(ServerboundPackets1_16.SET_CREATIVE_MODE_SLOT);
+ final BlockRewriter blockRewriter = BlockRewriter.for1_14(this.protocol);
+ blockRewriter.registerBlockEvent(ClientboundPackets20w14infinite.BLOCK_EVENT);
+ blockRewriter.registerBlockUpdate(ClientboundPackets20w14infinite.BLOCK_UPDATE);
+ blockRewriter.registerChunkBlocksUpdate(ClientboundPackets20w14infinite.CHUNK_BLOCKS_UPDATE);
+ blockRewriter.registerBlockBreakAck(ClientboundPackets20w14infinite.BLOCK_BREAK_ACK);
+ blockRewriter.registerLevelEvent(ClientboundPackets20w14infinite.LEVEL_EVENT, 1010, 2001);
- protocol.registerClientbound(ClientboundPackets20w14infinite.UPDATE_LIGHT, new PacketHandlers() {
+ protocol.registerClientbound(ClientboundPackets20w14infinite.LIGHT_UPDATE, new PacketHandlers() {
@Override
public void register() {
- map(Type.VAR_INT); // x
- map(Type.VAR_INT); // y
- handler(wrapper -> wrapper.write(Type.BOOLEAN, true)); // Take neighbour's light into account as well
+ map(Types.VAR_INT); // x
+ map(Types.VAR_INT); // y
+ handler(wrapper -> wrapper.write(Types.BOOLEAN, true)); // Take neighbour's light into account as well
}
});
- protocol.registerClientbound(ClientboundPackets20w14infinite.CHUNK_DATA, new PacketHandlers() {
+ protocol.registerClientbound(ClientboundPackets20w14infinite.LEVEL_CHUNK, new PacketHandlers() {
@Override
public void register() {
handler(wrapper -> {
@@ -106,15 +106,15 @@ public class BlockItemPackets20w14infinite extends ItemRewriter {
- int slot = wrapper.read(Type.VAR_INT);
- wrapper.write(Type.BYTE, (byte) slot);
- handleItemToClient(wrapper.user(), wrapper.passthrough(Type.ITEM1_13_2));
+ int slot = wrapper.read(Types.VAR_INT);
+ wrapper.write(Types.BYTE, (byte) slot);
+ handleItemToClient(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2));
});
}
});
@@ -122,7 +122,7 @@ public class BlockItemPackets20w14infinite extends ItemRewriter handleItemToServer(wrapper.user(), wrapper.passthrough(Type.ITEM1_13_2)));
+ handler(wrapper -> handleItemToServer(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2)));
}
});
}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/EntityPacketRewriter20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/EntityPacketRewriter20w14infinite.java
new file mode 100644
index 0000000..ab06da2
--- /dev/null
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s20w14infinitetov1_16/rewriter/EntityPacketRewriter20w14infinite.java
@@ -0,0 +1,195 @@
+/*
+ * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
+ * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter;
+
+import com.viaversion.viaversion.api.Via;
+import com.viaversion.viaversion.api.minecraft.entities.EntityType;
+import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
+import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
+import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
+import com.viaversion.viaversion.api.type.Types;
+import com.viaversion.viaversion.api.type.types.version.Types1_14;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.data.AttributeMappings1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.data.DimensionRegistries1_16;
+import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ClientboundPackets1_16;
+import com.viaversion.viaversion.rewriter.EntityRewriter;
+import com.viaversion.viaversion.util.Key;
+import net.raphimc.viaaprilfools.ViaAprilFools;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ClientboundPackets20w14infinite;
+import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.Protocol20w14infiniteTo1_16;
+
+import java.util.UUID;
+
+public class EntityPacketRewriter20w14infinite extends EntityRewriter {
+
+ private final PacketHandler DIMENSION_HANDLER = wrapper -> {
+ int dimension = wrapper.read(Types.INT);
+ String dimensionType;
+ String dimensionName = switch (dimension) {
+ case -1 -> dimensionType = "minecraft:the_nether";
+ case 0 -> dimensionType = "minecraft:overworld";
+ case 1 -> dimensionType = "minecraft:the_end";
+ default -> {
+ dimensionType = "minecraft:overworld";
+ yield dimensionType + dimension;
+ }
+ };
+
+ wrapper.write(Types.STRING, dimensionType); // dimension type
+ wrapper.write(Types.STRING, dimensionName); // dimension
+ };
+
+ public EntityPacketRewriter20w14infinite(Protocol20w14infiniteTo1_16 protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected void registerPackets() {
+ registerTrackerWithData(ClientboundPackets20w14infinite.ADD_ENTITY, EntityTypes1_16.FALLING_BLOCK);
+ registerTracker(ClientboundPackets20w14infinite.ADD_MOB);
+ registerTracker(ClientboundPackets20w14infinite.ADD_PLAYER, EntityTypes1_16.PLAYER);
+ registerSetEntityData(ClientboundPackets20w14infinite.SET_ENTITY_DATA, Types1_14.ENTITY_DATA_LIST);
+ registerRemoveEntities(ClientboundPackets20w14infinite.REMOVE_ENTITIES);
+
+ protocol.registerClientbound(ClientboundPackets20w14infinite.ADD_GLOBAL_ENTITY, ClientboundPackets1_16.ADD_ENTITY, wrapper -> {
+ final int entityId = wrapper.passthrough(Types.VAR_INT); // entity id
+ wrapper.user().getEntityTracker(Protocol20w14infiniteTo1_16.class).addEntity(entityId, EntityTypes1_16.LIGHTNING_BOLT);
+
+ wrapper.write(Types.UUID, UUID.randomUUID()); // uuid
+ wrapper.write(Types.VAR_INT, EntityTypes1_16.LIGHTNING_BOLT.getId()); // entity type
+
+ wrapper.read(Types.BYTE); // remove type
+
+ wrapper.passthrough(Types.DOUBLE); // x
+ wrapper.passthrough(Types.DOUBLE); // y
+ wrapper.passthrough(Types.DOUBLE); // z
+ wrapper.write(Types.BYTE, (byte) 0); // yaw
+ wrapper.write(Types.BYTE, (byte) 0); // pitch
+ wrapper.write(Types.INT, 0); // data
+ wrapper.write(Types.SHORT, (short) 0); // velocity
+ wrapper.write(Types.SHORT, (short) 0); // velocity
+ wrapper.write(Types.SHORT, (short) 0); // velocity
+ });
+ protocol.registerClientbound(ClientboundPackets20w14infinite.RESPAWN, new PacketHandlers() {
+ @Override
+ public void register() {
+ handler(DIMENSION_HANDLER);
+ map(Types.LONG); // Seed
+ map(Types.UNSIGNED_BYTE); // Gamemode
+ handler(wrapper -> {
+ wrapper.write(Types.BYTE, (byte) -1); // Previous gamemode, set to none
+
+ final String levelType = wrapper.read(Types.STRING);
+ wrapper.write(Types.BOOLEAN, false); // debug
+ wrapper.write(Types.BOOLEAN, levelType.equals("flat"));
+ wrapper.write(Types.BOOLEAN, true); // keep all playerdata
+ });
+ }
+ });
+ protocol.registerClientbound(ClientboundPackets20w14infinite.LOGIN, new PacketHandlers() {
+ @Override
+ public void register() {
+ map(Types.INT); // Entity ID
+ map(Types.UNSIGNED_BYTE); // Gamemode
+ handler(wrapper -> {
+ wrapper.write(Types.BYTE, (byte) -1); // Previous gamemode, set to none
+ wrapper.write(Types.STRING_ARRAY, DimensionRegistries1_16.getWorldNames()); // World list - only used for command completion
+ wrapper.write(Types.NAMED_COMPOUND_TAG, DimensionRegistries1_16.getDimensionsTag()); // Dimension registry
+ });
+ handler(DIMENSION_HANDLER); // Dimension
+ map(Types.LONG); // Seed
+ map(Types.UNSIGNED_BYTE); // Max players
+ handler(wrapper -> {
+ wrapper.user().getEntityTracker(Protocol20w14infiniteTo1_16.class).addEntity(wrapper.get(Types.INT, 0), EntityTypes1_16.PLAYER);
+
+ final String type = wrapper.read(Types.STRING);// level type
+ wrapper.passthrough(Types.VAR_INT); // View distance
+ wrapper.passthrough(Types.BOOLEAN); // Reduced debug info
+ wrapper.passthrough(Types.BOOLEAN); // Show death screen
+
+ wrapper.write(Types.BOOLEAN, false); // Debug
+ wrapper.write(Types.BOOLEAN, type.equals("flat"));
+ });
+ }
+ });
+ protocol.registerClientbound(ClientboundPackets20w14infinite.UPDATE_ATTRIBUTES, wrapper -> {
+ wrapper.passthrough(Types.VAR_INT);
+ int size = wrapper.passthrough(Types.INT);
+ int actualSize = size;
+ for (int i = 0; i < size; i++) {
+ // Attributes have been renamed and are now namespaced identifiers
+ String key = wrapper.read(Types.STRING);
+ String attributeIdentifier = AttributeMappings1_16.attributeIdentifierMappings().get(key);
+ if (attributeIdentifier == null) {
+ attributeIdentifier = "minecraft:" + key;
+ if (!Key.isValid(attributeIdentifier)) {
+ if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
+ ViaAprilFools.getPlatform().getLogger().warning("Invalid attribute: " + key);
+ }
+ actualSize--;
+ wrapper.read(Types.DOUBLE);
+ int modifierSize = wrapper.read(Types.VAR_INT);
+ for (int j = 0; j < modifierSize; j++) {
+ wrapper.read(Types.UUID);
+ wrapper.read(Types.DOUBLE);
+ wrapper.read(Types.BYTE);
+ }
+ continue;
+ }
+ }
+
+ wrapper.write(Types.STRING, attributeIdentifier);
+
+ wrapper.passthrough(Types.DOUBLE);
+ int modifierSize = wrapper.passthrough(Types.VAR_INT);
+ for (int j = 0; j < modifierSize; j++) {
+ wrapper.passthrough(Types.UUID);
+ wrapper.passthrough(Types.DOUBLE);
+ wrapper.passthrough(Types.BYTE);
+ }
+ }
+ if (size != actualSize) {
+ wrapper.set(Types.INT, 0, actualSize);
+ }
+ });
+ }
+
+ @Override
+ protected void registerRewrites() {
+ registerEntityDataTypeHandler(Types1_14.ENTITY_DATA_TYPES.itemType, Types1_14.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_14.ENTITY_DATA_TYPES.particleType);
+
+ filter().type(EntityTypes1_16.ABSTRACT_MINECART).index(10).handler((event, meta) -> {
+ // Convert to new block id
+ int data = (int) meta.getValue();
+ meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
+ });
+
+ filter().type(EntityTypes1_16.ABSTRACT_ARROW).removeIndex(8);
+ }
+
+ @Override
+ public void onMappingDataLoaded() {
+ mapTypes();
+ }
+
+ @Override
+ public EntityType typeFromId(int type) {
+ return EntityTypes1_16.getTypeFromId(type);
+ }
+
+}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/Protocol1_14to3D_Shareware.java
similarity index 67%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/Protocol1_14to3D_Shareware.java
index cead5c2..729a7ae 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/Protocol1_14to3D_Shareware.java
@@ -15,30 +15,32 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware;
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14;
import com.viaversion.viabackwards.api.BackwardsProtocol;
-import com.viaversion.viabackwards.api.data.BackwardsMappings;
+import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
-import com.viaversion.viaversion.api.type.Type;
+import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
-import net.raphimc.viaaprilfools.api.data.AprilFoolsMappings;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets.BlockItemPackets3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets.EntityPackets3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.storage.ChunkCenterTracker3D_Shareware;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.Protocol1_13_2To1_14;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPackets1_14;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14;
+import net.raphimc.viaaprilfools.api.data.AprilFoolsMappingData;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ClientboundPackets3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ServerboundPackets3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter.BlockItemPacketRewriter3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter.EntityPacketRewriter3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.storage.ChunkCenterTracker3D_Shareware;
public class Protocol1_14to3D_Shareware extends BackwardsProtocol {
- public static final BackwardsMappings MAPPINGS = new AprilFoolsMappings("3D_Shareware", "1.14", Protocol1_14To1_13_2.class);
+ public static final BackwardsMappingData MAPPINGS = new AprilFoolsMappingData("3D_Shareware", "1.14", Protocol1_13_2To1_14.class);
private static final int SERVERSIDE_VIEW_DISTANCE = 64;
- private final BlockItemPackets3D_Shareware blockItemPackets = new BlockItemPackets3D_Shareware(this);
+ private final BlockItemPacketRewriter3D_Shareware blockItemPackets = new BlockItemPacketRewriter3D_Shareware(this);
public Protocol1_14to3D_Shareware() {
super(ClientboundPackets3D_Shareware.class, ClientboundPackets1_14.class, ServerboundPackets3D_Shareware.class, ServerboundPackets1_14.class);
@@ -48,14 +50,14 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerSound(ClientboundPackets3D_Shareware.SOUND);
- soundRewriter.registerSound(ClientboundPackets3D_Shareware.ENTITY_SOUND);
- soundRewriter.registerNamedSound(ClientboundPackets3D_Shareware.NAMED_SOUND);
+ soundRewriter.registerSound(ClientboundPackets3D_Shareware.SOUND_ENTITY);
+ soundRewriter.registerNamedSound(ClientboundPackets3D_Shareware.CUSTOM_SOUND);
soundRewriter.registerStopSound(ClientboundPackets3D_Shareware.STOP_SOUND);
- this.registerClientbound(ClientboundPackets3D_Shareware.CHUNK_DATA, wrapper -> {
+ this.registerClientbound(ClientboundPackets3D_Shareware.LEVEL_CHUNK, wrapper -> {
final ChunkCenterTracker3D_Shareware entityTracker = wrapper.user().get(ChunkCenterTracker3D_Shareware.class);
final Chunk chunk = wrapper.passthrough(ChunkType1_14.TYPE);
@@ -63,9 +65,9 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol= SERVERSIDE_VIEW_DISTANCE || diffZ >= SERVERSIDE_VIEW_DISTANCE) {
- final PacketWrapper fakePosLook = wrapper.create(ClientboundPackets1_14.UPDATE_VIEW_POSITION); // Set center chunk
- fakePosLook.write(Type.VAR_INT, chunk.getX());
- fakePosLook.write(Type.VAR_INT, chunk.getZ());
+ final PacketWrapper fakePosLook = wrapper.create(ClientboundPackets1_14.SET_CHUNK_CACHE_CENTER); // Set center chunk
+ fakePosLook.write(Types.VAR_INT, chunk.getX());
+ fakePosLook.write(Types.VAR_INT, chunk.getZ());
fakePosLook.send(Protocol1_14to3D_Shareware.class);
entityTracker.setChunkCenterX(chunk.getX());
entityTracker.setChunkCenterZ(chunk.getZ());
@@ -83,12 +85,12 @@ public class Protocol1_14to3D_Shareware extends BackwardsProtocol.
+ */
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet;
+
+import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
+
+public enum ClientboundPackets3D_Shareware implements ClientboundPacketType {
+
+ ADD_ENTITY, // 0x00
+ ADD_EXPERIENCE_ORB, // 0x01
+ ADD_GLOBAL_ENTITY, // 0x02
+ ADD_MOB, // 0x03
+ ADD_PAINTING, // 0x04
+ ADD_PLAYER, // 0x05
+ ANIMATE, // 0x06
+ AWARD_STATS, // 0x07
+ BLOCK_DESTRUCTION, // 0x08
+ BLOCK_ENTITY_DATA, // 0x09
+ BLOCK_EVENT, // 0x0A
+ BLOCK_UPDATE, // 0x0B
+ BOSS_EVENT, // 0x0C
+ CHANGE_DIFFICULTY, // 0x0D
+ CHAT, // 0x0E
+ CHUNK_BLOCKS_UPDATE, // 0x0F
+ COMMAND_SUGGESTIONS, // 0x10
+ COMMANDS, // 0x11
+ CONTAINER_ACK, // 0x12
+ CONTAINER_CLOSE, // 0x13
+ HORSE_SCREEN_OPEN, // 0x14
+ CONTAINER_SET_CONTENT, // 0x15
+ CONTAINER_SET_DATA, // 0x16
+ CONTAINER_SET_SLOT, // 0x17
+ COOLDOWN, // 0x18
+ CUSTOM_PAYLOAD, // 0x19
+ CUSTOM_SOUND, // 0x1A
+ DISCONNECT, // 0x1B
+ ENTITY_EVENT, // 0x1C
+ TAG_QUERY, // 0x1D
+ EXPLODE, // 0x1E
+ FORGET_LEVEL_CHUNK, // 0x1F
+ GAME_EVENT, // 0x20
+ KEEP_ALIVE, // 0x21
+ LEVEL_CHUNK, // 0x22
+ LEVEL_EVENT, // 0x23
+ LEVEL_PARTICLES, // 0x24
+ LOGIN, // 0x25
+ MAP_ITEM_DATA, // 0x26
+ MOVE_ENTITY, // 0x27
+ MOVE_ENTITY_POS, // 0x28
+ MOVE_ENTITY_POS_ROT, // 0x29
+ MOVE_ENTITY_ROT, // 0x2A
+ MOVE_VEHICLE, // 0x2B
+ OPEN_BOOK, // 0x2C
+ OPEN_SIGN_EDITOR, // 0x2D
+ PLACE_GHOST_RECIPE, // 0x2E
+ PLAYER_ABILITIES, // 0x2F
+ PLAYER_COMBAT, // 0x30
+ PLAYER_INFO, // 0x31
+ PLAYER_LOOK_AT, // 0x32
+ PLAYER_POSITION, // 0x33
+ RECIPE, // 0x34
+ REMOVE_ENTITIES, // 0x35
+ REMOVE_MOB_EFFECT, // 0x36
+ RESOURCE_PACK, // 0x37
+ RESPAWN, // 0x38
+ ROTATE_HEAD, // 0x39
+ SELECT_ADVANCEMENTS_TAB, // 0x3A
+ SET_BORDER, // 0x3B
+ SET_CAMERA, // 0x3C
+ SET_CARRIED_ITEM, // 0x3D
+ SET_DISPLAY_OBJECTIVE, // 0x3E
+ SET_ENTITY_DATA, // 0x3F
+ SET_ENTITY_LINK, // 0x40
+ SET_ENTITY_MOTION, // 0x41
+ SET_EQUIPPED_ITEM, // 0x42
+ SET_EXPERIENCE, // 0x43
+ SET_HEALTH, // 0x44
+ SET_OBJECTIVE, // 0x45
+ SET_PASSENGERS, // 0x46
+ SET_PLAYER_TEAM, // 0x47
+ SET_SCORE, // 0x48
+ SET_DEFAULT_SPAWN_POSITION, // 0x49
+ SET_TIME, // 0x4A
+ SET_TITLES, // 0x4B
+ STOP_SOUND, // 0x4C
+ SOUND, // 0x4D
+ SOUND_ENTITY, // 0x4E
+ TAB_LIST, // 0x4F
+ TAKE_ITEM_ENTITY, // 0x50
+ TELEPORT_ENTITY, // 0x51
+ UPDATE_ADVANCEMENTS, // 0x52
+ UPDATE_ATTRIBUTES, // 0x53
+ UPDATE_MOB_EFFECT, // 0x54
+ UPDATE_RECIPES, // 0x55
+ UPDATE_TAGS, // 0x56
+ LIGHT_UPDATE, // 0x57
+ OPEN_SCREEN, // 0x58
+ MERCHANT_OFFERS, // 0x59
+ SET_CHUNK_CACHE_RADIUS; // 0x5A
+
+ @Override
+ public int getId() {
+ return this.ordinal();
+ }
+
+ @Override
+ public String getName() {
+ return this.name();
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/ServerboundPackets3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/packet/ServerboundPackets3D_Shareware.java
similarity index 51%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/ServerboundPackets3D_Shareware.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/packet/ServerboundPackets3D_Shareware.java
index 9d28407..56f7a22 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/ServerboundPackets3D_Shareware.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/packet/ServerboundPackets3D_Shareware.java
@@ -15,57 +15,57 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware;
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
public enum ServerboundPackets3D_Shareware implements ServerboundPacketType {
- TELEPORT_CONFIRM, // 0x00
- QUERY_BLOCK_NBT, // 0x01
- SET_DIFFICULTY, // 0x02
- CHAT_MESSAGE, // 0x03
- CLIENT_STATUS, // 0x04
- CLIENT_SETTINGS, // 0x05
- TAB_COMPLETE, // 0x06
- WINDOW_CONFIRMATION, // 0x07
- CLICK_WINDOW_BUTTON, // 0x08
- CLICK_WINDOW, // 0x09
- CLOSE_WINDOW, // 0x0A
- PLUGIN_MESSAGE, // 0x0B
+ ACCEPT_TELEPORTATION, // 0x00
+ BLOCK_ENTITY_TAG_QUERY, // 0x01
+ CHANGE_DIFFICULTY, // 0x02
+ CHAT, // 0x03
+ CLIENT_COMMAND, // 0x04
+ CLIENT_INFORMATION, // 0x05
+ COMMAND_SUGGESTION, // 0x06
+ CONTAINER_ACK, // 0x07
+ CONTAINER_BUTTON_CLICK, // 0x08
+ CONTAINER_CLICK, // 0x09
+ CONTAINER_CLOSE, // 0x0A
+ CUSTOM_PAYLOAD, // 0x0B
EDIT_BOOK, // 0x0C
- ENTITY_NBT_REQUEST, // 0x0D
- INTERACT_ENTITY, // 0x0E
+ ENTITY_TAG_QUERY, // 0x0D
+ INTERACT, // 0x0E
LOCK_DIFFICULTY, // 0x0F
KEEP_ALIVE, // 0x10
- PLAYER_MOVEMENT, // 0x11
- PLAYER_POSITION, // 0x12
- PLAYER_POSITION_AND_ROTATION, // 0x13
- PLAYER_ROTATION, // 0x14
- VEHICLE_MOVE, // 0x15
- STEER_BOAT, // 0x16
+ MOVE_PLAYER_STATUS_ONLY, // 0x11
+ MOVE_PLAYER_POS, // 0x12
+ MOVE_PLAYER_POS_ROT, // 0x13
+ MOVE_PLAYER_ROT, // 0x14
+ MOVE_VEHICLE, // 0x15
+ PADDLE_BOAT, // 0x16
PICK_ITEM, // 0x17
- CRAFT_RECIPE_REQUEST, // 0x18
+ PLACE_RECIPE, // 0x18
PLAYER_ABILITIES, // 0x19
- PLAYER_DIGGING, // 0x1A
- ENTITY_ACTION, // 0x1B
- STEER_VEHICLE, // 0x1C
- RECIPE_BOOK_DATA, // 0x1D
+ PLAYER_ACTION, // 0x1A
+ PLAYER_COMMAND, // 0x1B
+ PLAYER_INPUT, // 0x1C
+ RECIPE_BOOK_UPDATE, // 0x1D
RENAME_ITEM, // 0x1E
- RESOURCE_PACK_STATUS, // 0x1F
- ADVANCEMENT_TAB, // 0x20
+ RESOURCE_PACK, // 0x1F
+ SEEN_ADVANCEMENTS, // 0x20
SELECT_TRADE, // 0x21
- SET_BEACON_EFFECT, // 0x22
- HELD_ITEM_CHANGE, // 0x23
- UPDATE_COMMAND_BLOCK, // 0x24
- UPDATE_COMMAND_BLOCK_MINECART, // 0x25
- CREATIVE_INVENTORY_ACTION, // 0x26
- UPDATE_JIGSAW_BLOCK, // 0x27
- UPDATE_STRUCTURE_BLOCK, // 0x28
- UPDATE_SIGN, // 0x29
- ANIMATION, // 0x2A
- SPECTATE, // 0x2B
- PLAYER_BLOCK_PLACEMENT, // 0x2C
+ SET_BEACON, // 0x22
+ SET_CARRIED_ITEM, // 0x23
+ SET_COMMAND_BLOCK, // 0x24
+ SET_COMMAND_MINECART, // 0x25
+ SET_CREATIVE_MODE_SLOT, // 0x26
+ SET_JIGSAW_BLOCK, // 0x27
+ SET_STRUCTURE_BLOCK, // 0x28
+ SIGN_UPDATE, // 0x29
+ SWING, // 0x2A
+ TELEPORT_TO_ENTITY, // 0x2B
+ USE_ITEM_ON, // 0x2C
USE_ITEM; // 0x2D
@Override
@@ -78,4 +78,4 @@ public enum ServerboundPackets3D_Shareware implements ServerboundPacketType {
return this.name();
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/BlockItemPacketRewriter3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/BlockItemPacketRewriter3D_Shareware.java
new file mode 100644
index 0000000..8e8b6ed
--- /dev/null
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/BlockItemPacketRewriter3D_Shareware.java
@@ -0,0 +1,70 @@
+/*
+ * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
+ * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter;
+
+import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
+import com.viaversion.viaversion.api.type.Types;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14;
+import com.viaversion.viaversion.rewriter.ItemRewriter;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ClientboundPackets3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.Protocol1_14to3D_Shareware;
+
+public class BlockItemPacketRewriter3D_Shareware extends ItemRewriter {
+
+ public BlockItemPacketRewriter3D_Shareware(Protocol1_14to3D_Shareware protocol) {
+ super(protocol, Types.ITEM1_13_2, Types.ITEM1_13_2_SHORT_ARRAY);
+ }
+
+ @Override
+ protected void registerPackets() {
+ this.registerCooldown(ClientboundPackets3D_Shareware.COOLDOWN);
+ this.registerSetContent(ClientboundPackets3D_Shareware.CONTAINER_SET_CONTENT);
+ this.registerSetSlot(ClientboundPackets3D_Shareware.CONTAINER_SET_SLOT);
+ this.registerSetEquippedItem(ClientboundPackets3D_Shareware.SET_EQUIPPED_ITEM);
+ this.registerAdvancements(ClientboundPackets3D_Shareware.UPDATE_ADVANCEMENTS);
+ this.registerContainerClick(ServerboundPackets1_14.CONTAINER_CLICK);
+ this.registerSetCreativeModeSlot(ServerboundPackets1_14.SET_CREATIVE_MODE_SLOT);
+ this.registerLevelParticles(ClientboundPackets3D_Shareware.LEVEL_PARTICLES, Types.FLOAT);
+
+ this.protocol.registerClientbound(ClientboundPackets3D_Shareware.MERCHANT_OFFERS, new PacketHandlers() {
+ public void register() {
+ this.handler((wrapper) -> {
+ wrapper.passthrough(Types.VAR_INT);
+ int size = wrapper.passthrough(Types.UNSIGNED_BYTE);
+
+ for (int i = 0; i < size; ++i) {
+ BlockItemPacketRewriter3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2));
+ BlockItemPacketRewriter3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2));
+ if (wrapper.passthrough(Types.BOOLEAN)) {
+ BlockItemPacketRewriter3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2));
+ }
+
+ wrapper.passthrough(Types.BOOLEAN);
+ wrapper.passthrough(Types.INT);
+ wrapper.passthrough(Types.INT);
+ wrapper.passthrough(Types.INT);
+ wrapper.passthrough(Types.INT);
+ wrapper.passthrough(Types.FLOAT);
+ }
+
+ });
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/EntityPacketRewriter3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/EntityPacketRewriter3D_Shareware.java
new file mode 100644
index 0000000..b69beca
--- /dev/null
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/rewriter/EntityPacketRewriter3D_Shareware.java
@@ -0,0 +1,90 @@
+/*
+ * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
+ * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter;
+
+import com.viaversion.viaversion.api.connection.UserConnection;
+import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
+import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
+import com.viaversion.viaversion.api.rewriter.RewriterBase;
+import com.viaversion.viaversion.api.type.Types;
+import com.viaversion.viaversion.api.type.types.version.Types1_14;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ClientboundPackets3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.Protocol1_14to3D_Shareware;
+
+import java.util.List;
+
+public class EntityPacketRewriter3D_Shareware extends RewriterBase {
+
+ public EntityPacketRewriter3D_Shareware(Protocol1_14to3D_Shareware protocol) {
+ super(protocol);
+ }
+
+ @Override
+ public void registerPackets() {
+ this.protocol.registerClientbound(ClientboundPackets3D_Shareware.ADD_MOB, new PacketHandlers() {
+ @Override
+ public void register() {
+ map(Types.VAR_INT); // 0 - Entity ID
+ map(Types.UUID); // 1 - Entity UUID
+ map(Types.VAR_INT); // 2 - Entity Type
+ map(Types.DOUBLE); // 3 - X
+ map(Types.DOUBLE); // 4 - Y
+ map(Types.DOUBLE); // 5 - Z
+ map(Types.BYTE); // 6 - Yaw
+ map(Types.BYTE); // 7 - Pitch
+ map(Types.BYTE); // 8 - Head Pitch
+ map(Types.SHORT); // 9 - Velocity X
+ map(Types.SHORT); // 10 - Velocity Y
+ map(Types.SHORT); // 11 - Velocity Z
+ map(Types1_14.ENTITY_DATA_LIST); // 12 - Entity data
+ handler(packetWrapper -> handleEntityData(packetWrapper.user(), packetWrapper.get(Types1_14.ENTITY_DATA_LIST, 0)));
+ }
+ });
+ this.protocol.registerClientbound(ClientboundPackets3D_Shareware.ADD_PLAYER, new PacketHandlers() {
+ @Override
+ public void register() {
+ map(Types.VAR_INT); // 0 - Entity ID
+ map(Types.UUID); // 1 - Player UUID
+ map(Types.DOUBLE); // 2 - X
+ map(Types.DOUBLE); // 3 - Y
+ map(Types.DOUBLE); // 4 - Z
+ map(Types.BYTE); // 5 - Yaw
+ map(Types.BYTE); // 6 - Pitch
+ map(Types1_14.ENTITY_DATA_LIST); // 7 - Entity data
+ handler(packetWrapper -> handleEntityData(packetWrapper.user(), packetWrapper.get(Types1_14.ENTITY_DATA_LIST, 0)));
+ }
+ });
+ this.protocol.registerClientbound(ClientboundPackets3D_Shareware.SET_ENTITY_DATA, new PacketHandlers() {
+ @Override
+ public void register() {
+ map(Types.VAR_INT); // 0 - Entity ID
+ map(Types1_14.ENTITY_DATA_LIST);
+ handler(packetWrapper -> handleEntityData(packetWrapper.user(), packetWrapper.get(Types1_14.ENTITY_DATA_LIST, 0)));
+ }
+ });
+ }
+
+ public void handleEntityData(final UserConnection user, final List entityDataList) {
+ for (EntityData entityData : entityDataList) {
+ if (entityData.dataType() == Types1_14.ENTITY_DATA_TYPES.itemType) {
+ entityData.setValue(this.protocol.getItemRewriter().handleItemToClient(user, entityData.value()));
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/storage/ChunkCenterTracker3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/storage/ChunkCenterTracker3D_Shareware.java
similarity index 95%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/storage/ChunkCenterTracker3D_Shareware.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/storage/ChunkCenterTracker3D_Shareware.java
index 0ddc10f..b860bf5 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/storage/ChunkCenterTracker3D_Shareware.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/s3d_sharewaretov1_14/storage/ChunkCenterTracker3D_Shareware.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.storage;
+package net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16_2toCombatTest8c/Protocol1_16_2toCombatTest8c.java b/src/main/java/net/raphimc/viaaprilfools/protocol/scombattest8ctov1_16_2/Protocol1_16_2toCombatTest8c.java
similarity index 72%
rename from src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16_2toCombatTest8c/Protocol1_16_2toCombatTest8c.java
rename to src/main/java/net/raphimc/viaaprilfools/protocol/scombattest8ctov1_16_2/Protocol1_16_2toCombatTest8c.java
index 36eb71f..88f19b1 100644
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16_2toCombatTest8c/Protocol1_16_2toCombatTest8c.java
+++ b/src/main/java/net/raphimc/viaaprilfools/protocol/scombattest8ctov1_16_2/Protocol1_16_2toCombatTest8c.java
@@ -15,16 +15,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package net.raphimc.viaaprilfools.protocols.protocol1_16_2toCombatTest8c;
+package net.raphimc.viaaprilfools.protocol.scombattest8ctov1_16_2;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import com.viaversion.viaversion.api.type.Type;
-import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
-import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
+import com.viaversion.viaversion.api.type.Types;
+import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ClientboundPackets1_16_2;
+import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPackets1_16_2;
public class Protocol1_16_2toCombatTest8c extends AbstractProtocol {
@@ -34,16 +34,16 @@ public class Protocol1_16_2toCombatTest8c extends AbstractProtocol.
*/
-package net.raphimc.viaaprilfools.protocols.protocol3D_Sharewareto1_14;
+package net.raphimc.viaaprilfools.protocol.v1_14tos3d_shareware;
import com.viaversion.viabackwards.api.BackwardsProtocol;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ClientboundPackets3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ServerboundPackets3D_Shareware;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPackets1_14;
+import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ClientboundPackets3D_Shareware;
+import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ServerboundPackets3D_Shareware;
public class Protocol3D_Sharewareto1_14 extends BackwardsProtocol {
@@ -31,7 +31,7 @@ public class Protocol3D_Sharewareto1_14 extends BackwardsProtocol.
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware;
-
-import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
-
-public enum ClientboundPackets3D_Shareware implements ClientboundPacketType {
-
- SPAWN_ENTITY, // 0x00
- SPAWN_EXPERIENCE_ORB, // 0x01
- SPAWN_GLOBAL_ENTITY, // 0x02
- SPAWN_MOB, // 0x03
- SPAWN_PAINTING, // 0x04
- SPAWN_PLAYER, // 0x05
- ENTITY_ANIMATION, // 0x06
- STATISTICS, // 0x07
- BLOCK_BREAK_ANIMATION, // 0x08
- BLOCK_ENTITY_DATA, // 0x09
- BLOCK_ACTION, // 0x0A
- BLOCK_CHANGE, // 0x0B
- BOSSBAR, // 0x0C
- SERVER_DIFFICULTY, // 0x0D
- CHAT_MESSAGE, // 0x0E
- MULTI_BLOCK_CHANGE, // 0x0F
- TAB_COMPLETE, // 0x10
- DECLARE_COMMANDS, // 0x11
- WINDOW_CONFIRMATION, // 0x12
- CLOSE_WINDOW, // 0x13
- OPEN_HORSE_WINDOW, // 0x14
- WINDOW_ITEMS, // 0x15
- WINDOW_PROPERTY, // 0x16
- SET_SLOT, // 0x17
- COOLDOWN, // 0x18
- PLUGIN_MESSAGE, // 0x19
- NAMED_SOUND, // 0x1A
- DISCONNECT, // 0x1B
- ENTITY_STATUS, // 0x1C
- NBT_QUERY, // 0x1D
- EXPLOSION, // 0x1E
- UNLOAD_CHUNK, // 0x1F
- GAME_EVENT, // 0x20
- KEEP_ALIVE, // 0x21
- CHUNK_DATA, // 0x22
- EFFECT, // 0x23
- SPAWN_PARTICLE, // 0x24
- JOIN_GAME, // 0x25
- MAP_DATA, // 0x26
- ENTITY_MOVEMENT, // 0x27
- ENTITY_POSITION, // 0x28
- ENTITY_POSITION_AND_ROTATION, // 0x29
- ENTITY_ROTATION, // 0x2A
- VEHICLE_MOVE, // 0x2B
- OPEN_BOOK, // 0x2C
- OPEN_SIGN_EDITOR, // 0x2D
- CRAFT_RECIPE_RESPONSE, // 0x2E
- PLAYER_ABILITIES, // 0x2F
- COMBAT_EVENT, // 0x30
- PLAYER_INFO, // 0x31
- FACE_PLAYER, // 0x32
- PLAYER_POSITION, // 0x33
- UNLOCK_RECIPES, // 0x34
- DESTROY_ENTITIES, // 0x35
- REMOVE_ENTITY_EFFECT, // 0x36
- RESOURCE_PACK, // 0x37
- RESPAWN, // 0x38
- ENTITY_HEAD_LOOK, // 0x39
- SELECT_ADVANCEMENTS_TAB, // 0x3A
- WORLD_BORDER, // 0x3B
- CAMERA, // 0x3C
- HELD_ITEM_CHANGE, // 0x3D
- DISPLAY_SCOREBOARD, // 0x3E
- ENTITY_METADATA, // 0x3F
- ATTACH_ENTITY, // 0x40
- ENTITY_VELOCITY, // 0x41
- ENTITY_EQUIPMENT, // 0x42
- SET_EXPERIENCE, // 0x43
- UPDATE_HEALTH, // 0x44
- SCOREBOARD_OBJECTIVE, // 0x45
- SET_PASSENGERS, // 0x46
- TEAMS, // 0x47
- UPDATE_SCORE, // 0x48
- SPAWN_POSITION, // 0x49
- TIME_UPDATE, // 0x4A
- TITLE, // 0x4B
- STOP_SOUND, // 0x4C
- SOUND, // 0x4D
- ENTITY_SOUND, // 0x4E
- TAB_LIST, // 0x4F
- COLLECT_ITEM, // 0x50
- ENTITY_TELEPORT, // 0x51
- ADVANCEMENTS, // 0x52
- ENTITY_PROPERTIES, // 0x53
- ENTITY_EFFECT, // 0x54
- DECLARE_RECIPES, // 0x55
- TAGS, // 0x56
- UPDATE_LIGHT, // 0x57
- OPEN_WINDOW, // 0x58
- TRADE_LIST, // 0x59
- UPDATE_VIEW_DISTANCE; // 0x5A
-
- @Override
- public int getId() {
- return this.ordinal();
- }
-
- @Override
- public String getName() {
- return this.name();
- }
-
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/BlockItemPackets3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/BlockItemPackets3D_Shareware.java
deleted file mode 100644
index f62d6a6..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/BlockItemPackets3D_Shareware.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets;
-
-import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
-import com.viaversion.viaversion.api.type.Type;
-import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
-import com.viaversion.viaversion.rewriter.ItemRewriter;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ClientboundPackets3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.Protocol1_14to3D_Shareware;
-
-public class BlockItemPackets3D_Shareware extends ItemRewriter {
-
- public BlockItemPackets3D_Shareware(Protocol1_14to3D_Shareware protocol) {
- super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY);
- }
-
- @Override
- protected void registerPackets() {
- this.registerSetCooldown(ClientboundPackets3D_Shareware.COOLDOWN);
- this.registerWindowItems(ClientboundPackets3D_Shareware.WINDOW_ITEMS);
- this.registerSetSlot(ClientboundPackets3D_Shareware.SET_SLOT);
- this.registerEntityEquipment(ClientboundPackets3D_Shareware.ENTITY_EQUIPMENT);
- this.registerAdvancements(ClientboundPackets3D_Shareware.ADVANCEMENTS);
- this.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW);
- this.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION);
- this.registerSpawnParticle(ClientboundPackets3D_Shareware.SPAWN_PARTICLE, Type.FLOAT);
-
- this.protocol.registerClientbound(ClientboundPackets3D_Shareware.TRADE_LIST, new PacketHandlers() {
- public void register() {
- this.handler((wrapper) -> {
- wrapper.passthrough(Type.VAR_INT);
- int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
-
- for (int i = 0; i < size; ++i) {
- BlockItemPackets3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Type.ITEM1_13_2));
- BlockItemPackets3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Type.ITEM1_13_2));
- if (wrapper.passthrough(Type.BOOLEAN)) {
- BlockItemPackets3D_Shareware.this.handleItemToClient(wrapper.user(), wrapper.passthrough(Type.ITEM1_13_2));
- }
-
- wrapper.passthrough(Type.BOOLEAN);
- wrapper.passthrough(Type.INT);
- wrapper.passthrough(Type.INT);
- wrapper.passthrough(Type.INT);
- wrapper.passthrough(Type.INT);
- wrapper.passthrough(Type.FLOAT);
- }
-
- });
- }
- });
- }
-
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/EntityPackets3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/EntityPackets3D_Shareware.java
deleted file mode 100644
index 3fb5183..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/packets/EntityPackets3D_Shareware.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets;
-
-import com.viaversion.viaversion.api.connection.UserConnection;
-import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
-import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
-import com.viaversion.viaversion.api.type.Type;
-import com.viaversion.viaversion.api.type.types.version.Types1_14;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.ClientboundPackets3D_Shareware;
-import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.Protocol1_14to3D_Shareware;
-
-import java.util.List;
-
-public class EntityPackets3D_Shareware {
-
- private final Protocol1_14to3D_Shareware protocol;
-
- public EntityPackets3D_Shareware(final Protocol1_14to3D_Shareware protocol) {
- this.protocol = protocol;
- }
-
- public void registerPackets() {
- this.protocol.registerClientbound(ClientboundPackets3D_Shareware.SPAWN_MOB, new PacketHandlers() {
- @Override
- public void register() {
- map(Type.VAR_INT); // 0 - Entity ID
- map(Type.UUID); // 1 - Entity UUID
- map(Type.VAR_INT); // 2 - Entity Type
- map(Type.DOUBLE); // 3 - X
- map(Type.DOUBLE); // 4 - Y
- map(Type.DOUBLE); // 5 - Z
- map(Type.BYTE); // 6 - Yaw
- map(Type.BYTE); // 7 - Pitch
- map(Type.BYTE); // 8 - Head Pitch
- map(Type.SHORT); // 9 - Velocity X
- map(Type.SHORT); // 10 - Velocity Y
- map(Type.SHORT); // 11 - Velocity Z
- map(Types1_14.METADATA_LIST); // 12 - Metadata
- handler(packetWrapper -> handleMetadata(packetWrapper.user(), packetWrapper.get(Types1_14.METADATA_LIST, 0)));
- }
- });
- this.protocol.registerClientbound(ClientboundPackets3D_Shareware.SPAWN_PLAYER, new PacketHandlers() {
- @Override
- public void register() {
- map(Type.VAR_INT); // 0 - Entity ID
- map(Type.UUID); // 1 - Player UUID
- map(Type.DOUBLE); // 2 - X
- map(Type.DOUBLE); // 3 - Y
- map(Type.DOUBLE); // 4 - Z
- map(Type.BYTE); // 5 - Yaw
- map(Type.BYTE); // 6 - Pitch
- map(Types1_14.METADATA_LIST); // 7 - Metadata
- handler(packetWrapper -> handleMetadata(packetWrapper.user(), packetWrapper.get(Types1_14.METADATA_LIST, 0)));
- }
- });
- this.protocol.registerClientbound(ClientboundPackets3D_Shareware.ENTITY_METADATA, new PacketHandlers() {
- @Override
- public void register() {
- map(Type.VAR_INT); // 0 - Entity ID
- map(Types1_14.METADATA_LIST);
- handler(packetWrapper -> handleMetadata(packetWrapper.user(), packetWrapper.get(Types1_14.METADATA_LIST, 0)));
- }
- });
- }
-
- public void handleMetadata(final UserConnection user, final List metadataList) {
- for (Metadata metadata : metadataList) {
- if (metadata.metaType() == Types1_14.META_TYPES.itemType) {
- metadata.setValue(this.protocol.getItemRewriter().handleItemToClient(user, metadata.value()));
- }
- }
- }
-
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ClientboundPackets20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ClientboundPackets20w14infinite.java
deleted file mode 100644
index d598df4..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/ClientboundPackets20w14infinite.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite;
-
-import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
-
-public enum ClientboundPackets20w14infinite implements ClientboundPacketType {
-
- SPAWN_ENTITY, // 0x00
- SPAWN_EXPERIENCE_ORB, // 0x01
- SPAWN_GLOBAL_ENTITY, // 0x02
- SPAWN_MOB, // 0x03
- SPAWN_PAINTING, // 0x04
- SPAWN_PLAYER, // 0x05
- ENTITY_ANIMATION, // 0x09
- STATISTICS, // 0x07
- ACKNOWLEDGE_PLAYER_DIGGING, // 0x08
- BLOCK_BREAK_ANIMATION, // 0x09
- BLOCK_ENTITY_DATA, // 0x0A
- BLOCK_ACTION, // 0x0B
- BLOCK_CHANGE, // 0x0C
- BOSSBAR, // 0x0D
- SERVER_DIFFICULTY, // 0x0E
- CHAT_MESSAGE, // 0x0F
- MULTI_BLOCK_CHANGE, // 0x10
- TAB_COMPLETE, // 0x11
- DECLARE_COMMANDS, // 0x12
- WINDOW_CONFIRMATION, // 0x13
- CLOSE_WINDOW, // 0x14
- WINDOW_ITEMS, // 0x15
- WINDOW_PROPERTY, // 0x16
- SET_SLOT, // 0x17
- COOLDOWN, // 0x18
- PLUGIN_MESSAGE, // 0x19
- NAMED_SOUND, // 0x1A
- DISCONNECT, // 0x1B
- ENTITY_STATUS, // 0x1C
- EXPLOSION, // 0x1D
- UNLOAD_CHUNK, // 0x1E
- GAME_EVENT, // 0x1F
- OPEN_HORSE_WINDOW, // 0x20
- KEEP_ALIVE, // 0x21
- CHUNK_DATA, // 0x22
- EFFECT, // 0x22
- SPAWN_PARTICLE, // 0x24
- UPDATE_LIGHT, // 0x25
- JOIN_GAME, // 0x26
- MAP_DATA, // 0x27
- TRADE_LIST, // 0x28
- ENTITY_POSITION, // 0x29
- ENTITY_POSITION_AND_ROTATION, // 0x2A
- ENTITY_ROTATION, // 0x2B
- ENTITY_MOVEMENT, // 0x2C
- VEHICLE_MOVE, // 0x2D
- OPEN_BOOK, // 0x2E
- OPEN_WINDOW, // 0x2F
- OPEN_SIGN_EDITOR, // 0x30
- CRAFT_RECIPE_RESPONSE, // 0x31
- PLAYER_ABILITIES, // 0x32
- COMBAT_EVENT, // 0x33
- PLAYER_INFO, // 0x34
- FACE_PLAYER, // 0x35
- PLAYER_POSITION, // 0x36
- UNLOCK_RECIPES, // 0x37
- DESTROY_ENTITIES, // 0x38
- REMOVE_ENTITY_EFFECT, // 0x39
- RESOURCE_PACK, // 0x3A
- RESPAWN, // 0x3B
- ENTITY_HEAD_LOOK, // 0x3C
- SELECT_ADVANCEMENTS_TAB, // 0x3D
- WORLD_BORDER, // 0x3E
- CAMERA, // 0x3F
- HELD_ITEM_CHANGE, // 0x40
- UPDATE_VIEW_POSITION, // 0x41
- UPDATE_VIEW_DISTANCE, // 0x42
- SPAWN_POSITION, // 0x43
- DISPLAY_SCOREBOARD, // 0x44
- ENTITY_METADATA, // 0x45
- ATTACH_ENTITY, // 0x46
- ENTITY_VELOCITY, // 0x47
- ENTITY_EQUIPMENT, // 0x48
- SET_EXPERIENCE, // 0x49
- UPDATE_HEALTH, // 0x4A
- SCOREBOARD_OBJECTIVE, // 0x4B
- SET_PASSENGERS, // 0x4C
- TEAMS, // 0x4D
- UPDATE_SCORE, // 0x4E
- TIME_UPDATE, // 0x4F
- TITLE, // 0x50
- ENTITY_SOUND, // 0x51
- SOUND, // 0x52
- STOP_SOUND, // 0x53
- TAB_LIST, // 0x54
- NBT_QUERY, // 0x55
- COLLECT_ITEM, // 0x56
- ENTITY_TELEPORT, // 0x57
- ADVANCEMENTS, // 0x58
- ENTITY_PROPERTIES, // 0x59
- ENTITY_EFFECT, // 0x5A
- DECLARE_RECIPES, // 0x5B
- TAGS; // 0x5C
-
- @Override
- public int getId() {
- return this.ordinal();
- }
-
- @Override
- public String getName() {
- return this.name();
- }
-
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/Entity20w14infiniteTypes.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/Entity20w14infiniteTypes.java
deleted file mode 100644
index fc9789e..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/Entity20w14infiniteTypes.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.metadata;
-
-import com.viaversion.viaversion.api.minecraft.entities.EntityType;
-import net.raphimc.viaaprilfools.ViaAprilFools;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-public enum Entity20w14infiniteTypes implements EntityType {
-
- ENTITY(-1),
-
- AREA_EFFECT_CLOUD(0, ENTITY),
- END_CRYSTAL(18, ENTITY),
- EVOKER_FANGS(22, ENTITY),
- EXPERIENCE_ORB(24, ENTITY),
- EYE_OF_ENDER(25, ENTITY),
- FALLING_BLOCK(26, ENTITY),
- FIREWORK_ROCKET(27, ENTITY),
- ITEM(35, ENTITY),
- LLAMA_SPIT(40, ENTITY),
- TNT(59, ENTITY),
- SHULKER_BULLET(64, ENTITY),
- FISHING_BOBBER(105, ENTITY),
-
- LIVINGENTITY(-1, ENTITY),
- ARMOR_STAND(1, LIVINGENTITY),
- PLAYER(104, LIVINGENTITY),
-
- ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
- ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
-
- BEE(4, ABSTRACT_INSENTIENT),
-
- ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
-
- ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
- VILLAGER(85, ABSTRACT_AGEABLE),
- WANDERING_TRADER(89, ABSTRACT_AGEABLE),
-
- // Animals
- ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
- DOLPHIN(14, ABSTRACT_INSENTIENT),
- CHICKEN(9, ABSTRACT_ANIMAL),
- COW(11, ABSTRACT_ANIMAL),
- MOOSHROOM(50, COW),
- PANDA(53, ABSTRACT_INSENTIENT),
- PIG(55, ABSTRACT_ANIMAL),
- POLAR_BEAR(58, ABSTRACT_ANIMAL),
- RABBIT(60, ABSTRACT_ANIMAL),
- SHEEP(62, ABSTRACT_ANIMAL),
- TURTLE(78, ABSTRACT_ANIMAL),
- FOX(28, ABSTRACT_ANIMAL),
-
- ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
- CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
- OCELOT(51, ABSTRACT_TAMEABLE_ANIMAL),
- WOLF(94, ABSTRACT_TAMEABLE_ANIMAL),
-
- ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
- PARROT(54, ABSTRACT_PARROT),
-
- // Horses
- ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
- CHESTED_HORSE(-1, ABSTRACT_HORSE),
- DONKEY(13, CHESTED_HORSE),
- MULE(49, CHESTED_HORSE),
- LLAMA(39, CHESTED_HORSE),
- TRADER_LLAMA(76, CHESTED_HORSE),
- HORSE(32, ABSTRACT_HORSE),
- SKELETON_HORSE(67, ABSTRACT_HORSE),
- ZOMBIE_HORSE(96, ABSTRACT_HORSE),
-
- // Golem
- ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
- SNOW_GOLEM(70, ABSTRACT_GOLEM),
- IRON_GOLEM(86, ABSTRACT_GOLEM),
- SHULKER(63, ABSTRACT_GOLEM),
-
- // Fish
- ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
- COD(10, ABSTRACT_FISHES),
- PUFFERFISH(56, ABSTRACT_FISHES),
- SALMON(61, ABSTRACT_FISHES),
- TROPICAL_FISH(77, ABSTRACT_FISHES),
-
- // Monsters
- ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
- BLAZE(5, ABSTRACT_MONSTER),
- CREEPER(12, ABSTRACT_MONSTER),
- ENDERMITE(21, ABSTRACT_MONSTER),
- ENDERMAN(20, ABSTRACT_MONSTER),
- GIANT(30, ABSTRACT_MONSTER),
- SILVERFISH(65, ABSTRACT_MONSTER),
- VEX(84, ABSTRACT_MONSTER),
- WITCH(90, ABSTRACT_MONSTER),
- WITHER(91, ABSTRACT_MONSTER),
- RAVAGER(99, ABSTRACT_MONSTER),
- HOGLIN(100, ABSTRACT_ANIMAL),
- PIGLIN(101, ABSTRACT_MONSTER),
- STRIDER(102, ABSTRACT_ANIMAL),
-
- // Illagers
- ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
- ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
- EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
- ILLUSIONER(34, ABSTRACT_EVO_ILLU_ILLAGER),
- VINDICATOR(87, ABSTRACT_ILLAGER_BASE),
- PILLAGER(88, ABSTRACT_ILLAGER_BASE),
-
- // Skeletons
- ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
- SKELETON(66, ABSTRACT_SKELETON),
- STRAY(75, ABSTRACT_SKELETON),
- WITHER_SKELETON(92, ABSTRACT_SKELETON),
-
- // Guardians
- GUARDIAN(31, ABSTRACT_MONSTER),
- ELDER_GUARDIAN(17, GUARDIAN),
-
- // Spiders
- SPIDER(73, ABSTRACT_MONSTER),
- CAVE_SPIDER(8, SPIDER),
-
- // Zombies
- ZOMBIE(95, ABSTRACT_MONSTER),
- DROWNED(16, ZOMBIE),
- HUSK(33, ZOMBIE),
- ZOMBIE_PIGMAN(57, ZOMBIE),
- ZOMBIE_VILLAGER(97, ZOMBIE),
-
- // Flying entities
- ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
- GHAST(29, ABSTRACT_FLYING),
- PHANTOM(98, ABSTRACT_FLYING),
-
- ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
- BAT(3, ABSTRACT_AMBIENT),
-
- ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
- SQUID(74, ABSTRACT_WATERMOB),
-
- // Slimes
- SLIME(68, ABSTRACT_INSENTIENT),
- MAGMA_CUBE(41, SLIME),
-
- // Hangable objects
- ABSTRACT_HANGING(-1, ENTITY),
- LEASH_KNOT(38, ABSTRACT_HANGING),
- ITEM_FRAME(36, ABSTRACT_HANGING),
- PAINTING(52, ABSTRACT_HANGING),
-
- ABSTRACT_LIGHTNING(-1, ENTITY),
- LIGHTNING_BOLT(103, ABSTRACT_LIGHTNING),
-
- // Arrows
- ABSTRACT_ARROW(-1, ENTITY),
- ARROW(2, ABSTRACT_ARROW),
- SPECTRAL_ARROW(72, ABSTRACT_ARROW),
- TRIDENT(83, ABSTRACT_ARROW),
-
- // Fireballs
- ABSTRACT_FIREBALL(-1, ENTITY),
- DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
- FIREBALL(37, ABSTRACT_FIREBALL),
- SMALL_FIREBALL(69, ABSTRACT_FIREBALL),
- WITHER_SKULL(93, ABSTRACT_FIREBALL),
-
- // Projectiles
- PROJECTILE_ABSTRACT(-1, ENTITY),
- SNOWBALL(71, PROJECTILE_ABSTRACT),
- ENDER_PEARL(80, PROJECTILE_ABSTRACT),
- EGG(79, PROJECTILE_ABSTRACT),
- POTION(82, PROJECTILE_ABSTRACT),
- EXPERIENCE_BOTTLE(81, PROJECTILE_ABSTRACT),
-
- // Vehicles
- MINECART_ABSTRACT(-1, ENTITY),
- CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT),
- CHEST_MINECART(43, CHESTED_MINECART_ABSTRACT),
- HOPPER_MINECART(46, CHESTED_MINECART_ABSTRACT),
- MINECART(42, MINECART_ABSTRACT),
- FURNACE_MINECART(45, MINECART_ABSTRACT),
- COMMAND_BLOCK_MINECART(44, MINECART_ABSTRACT),
- TNT_MINECART(48, MINECART_ABSTRACT),
- SPAWNER_MINECART(47, MINECART_ABSTRACT),
- BOAT(6, ENTITY);
-
- private static final EntityType[] TYPES;
-
- private final int id;
- private final EntityType parent;
-
- Entity20w14infiniteTypes(int id) {
- this.id = id;
- this.parent = null;
- }
-
- Entity20w14infiniteTypes(int id, EntityType parent) {
- this.id = id;
- this.parent = parent;
- }
-
- @Override
- public int getId() {
- return id;
- }
-
- @Override
- public EntityType getParent() {
- return parent;
- }
-
- @Override
- public String identifier() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isAbstractType() {
- return this.id != -1;
- }
-
- static {
- List types = new ArrayList<>();
- for (Entity20w14infiniteTypes type : values()) {
- if (type.id != -1) {
- types.add(type);
- }
- }
-
- types.sort(Comparator.comparingInt(Entity20w14infiniteTypes::getId));
- TYPES = types.toArray(new EntityType[0]);
- }
-
- public static EntityType getTypeFromId(int typeId) {
- EntityType type;
- if (typeId < 0 || typeId >= TYPES.length || (type = TYPES[typeId]) == null) {
- ViaAprilFools.getPlatform().getLogger().severe("Could not find 1.15 type id " + typeId);
- return ENTITY;
- }
- return type;
- }
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/MetadataRewriter1_16to20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/MetadataRewriter1_16to20w14infinite.java
deleted file mode 100644
index b153cf2..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/metadata/MetadataRewriter1_16to20w14infinite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.metadata;
-
-import com.viaversion.viaversion.api.minecraft.entities.EntityType;
-import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
-import com.viaversion.viaversion.api.type.types.version.Types1_14;
-import com.viaversion.viaversion.rewriter.EntityRewriter;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.ClientboundPackets20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
-
-public class MetadataRewriter1_16to20w14infinite extends EntityRewriter {
-
- public MetadataRewriter1_16to20w14infinite(Protocol1_16to20w14infinite protocol) {
- super(protocol);
- }
-
- @Override
- protected void registerRewrites() {
- registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, Types1_14.META_TYPES.particleType);
-
- filter().type(EntityTypes1_16.MINECART_ABSTRACT).index(10).handler((event, meta) -> {
- // Convert to new block id
- int data = (int) meta.getValue();
- meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
- });
-
- filter().type(EntityTypes1_16.ABSTRACT_ARROW).removeIndex(8);
- }
-
- @Override
- public void onMappingDataLoaded() {
- mapTypes();
- mapEntityType(Entity20w14infiniteTypes.ZOMBIE_PIGMAN, EntityTypes1_16.ZOMBIFIED_PIGLIN);
- }
-
- @Override
- public EntityType typeFromId(int type) {
- return EntityTypes1_16.getTypeFromId(type);
- }
-
-}
diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/EntityPackets20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/EntityPackets20w14infinite.java
deleted file mode 100644
index 3a55eb0..0000000
--- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/packets/EntityPackets20w14infinite.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
- * Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets;
-
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16;
-import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
-import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
-import com.viaversion.viaversion.api.type.Type;
-import com.viaversion.viaversion.api.type.types.version.Types1_14;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.AttributeMappings;
-import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.packets.EntityPackets;
-import com.viaversion.viaversion.util.Key;
-import net.raphimc.viaaprilfools.ViaAprilFools;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.ClientboundPackets20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.Protocol1_16to20w14infinite;
-import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.metadata.MetadataRewriter1_16to20w14infinite;
-
-import java.util.UUID;
-
-public class EntityPackets20w14infinite {
-
- private static final PacketHandler DIMENSION_HANDLER = wrapper -> {
- int dimension = wrapper.read(Type.INT);
- String dimensionType;
- String dimensionName;
- switch (dimension) {
- case -1:
- dimensionName = dimensionType = "minecraft:the_nether";
- break;
- case 0:
- dimensionName = dimensionType = "minecraft:overworld";
- break;
- case 1:
- dimensionName = dimensionType = "minecraft:the_end";
- break;
- default:
- dimensionType = "minecraft:overworld";
- dimensionName = dimensionType + dimension;
- }
-
- wrapper.write(Type.STRING, dimensionType); // dimension type
- wrapper.write(Type.STRING, dimensionName); // dimension
- };
- private static final String[] WORLD_NAMES = {"minecraft:overworld", "minecraft:the_nether", "minecraft:the_end"};
-
- public static void register(Protocol1_16to20w14infinite protocol) {
- MetadataRewriter1_16to20w14infinite metadataRewriter = protocol.get(MetadataRewriter1_16to20w14infinite.class);
- metadataRewriter.registerTrackerWithData(ClientboundPackets20w14infinite.SPAWN_ENTITY, EntityTypes1_16.FALLING_BLOCK);
- metadataRewriter.registerTracker(ClientboundPackets20w14infinite.SPAWN_MOB);
- metadataRewriter.registerTracker(ClientboundPackets20w14infinite.SPAWN_PLAYER, EntityTypes1_16.PLAYER);
- metadataRewriter.registerMetadataRewriter(ClientboundPackets20w14infinite.ENTITY_METADATA, Types1_14.METADATA_LIST);
- metadataRewriter.registerRemoveEntities(ClientboundPackets20w14infinite.DESTROY_ENTITIES);
-
- // Spawn lightning -> Spawn entity
- protocol.registerClientbound(ClientboundPackets20w14infinite.SPAWN_GLOBAL_ENTITY, ClientboundPackets1_16.SPAWN_ENTITY, wrapper -> {
- final int entityId = wrapper.passthrough(Type.VAR_INT); // entity id
- wrapper.user().getEntityTracker(Protocol1_16to20w14infinite.class).addEntity(entityId, EntityTypes1_16.LIGHTNING_BOLT);
-
- wrapper.write(Type.UUID, UUID.randomUUID()); // uuid
- wrapper.write(Type.VAR_INT, EntityTypes1_16.LIGHTNING_BOLT.getId()); // entity type
-
- wrapper.read(Type.BYTE); // remove type
-
- wrapper.passthrough(Type.DOUBLE); // x
- wrapper.passthrough(Type.DOUBLE); // y
- wrapper.passthrough(Type.DOUBLE); // z
- wrapper.write(Type.BYTE, (byte) 0); // yaw
- wrapper.write(Type.BYTE, (byte) 0); // pitch
- wrapper.write(Type.INT, 0); // data
- wrapper.write(Type.SHORT, (short) 0); // velocity
- wrapper.write(Type.SHORT, (short) 0); // velocity
- wrapper.write(Type.SHORT, (short) 0); // velocity
- });
- protocol.registerClientbound(ClientboundPackets20w14infinite.RESPAWN, new PacketHandlers() {
- @Override
- public void register() {
- handler(DIMENSION_HANDLER);
- map(Type.LONG); // Seed
- map(Type.UNSIGNED_BYTE); // Gamemode
- handler(wrapper -> {
- wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none
-
- final String levelType = wrapper.read(Type.STRING);
- wrapper.write(Type.BOOLEAN, false); // debug
- wrapper.write(Type.BOOLEAN, levelType.equals("flat"));
- wrapper.write(Type.BOOLEAN, true); // keep all playerdata
- });
- }
- });
- protocol.registerClientbound(ClientboundPackets20w14infinite.JOIN_GAME, new PacketHandlers() {
- @Override
- public void register() {
- map(Type.INT); // Entity ID
- map(Type.UNSIGNED_BYTE); // Gamemode
- handler(wrapper -> {
- wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none
- wrapper.write(Type.STRING_ARRAY, WORLD_NAMES); // World list - only used for command completion
- wrapper.write(Type.NAMED_COMPOUND_TAG, EntityPackets.DIMENSIONS_TAG); // Dimension registry
- });
- handler(DIMENSION_HANDLER); // Dimension
- map(Type.LONG); // Seed
- map(Type.UNSIGNED_BYTE); // Max players
- handler(wrapper -> {
- wrapper.user().getEntityTracker(Protocol1_16to20w14infinite.class).addEntity(wrapper.get(Type.INT, 0), EntityTypes1_16.PLAYER);
-
- final String type = wrapper.read(Type.STRING);// level type
- wrapper.passthrough(Type.VAR_INT); // View distance
- wrapper.passthrough(Type.BOOLEAN); // Reduced debug info
- wrapper.passthrough(Type.BOOLEAN); // Show death screen
-
- wrapper.write(Type.BOOLEAN, false); // Debug
- wrapper.write(Type.BOOLEAN, type.equals("flat"));
- });
- }
- });
- protocol.registerClientbound(ClientboundPackets20w14infinite.ENTITY_PROPERTIES, wrapper -> {
- wrapper.passthrough(Type.VAR_INT);
- int size = wrapper.passthrough(Type.INT);
- int actualSize = size;
- for (int i = 0; i < size; i++) {
- // Attributes have been renamed and are now namespaced identifiers
- String key = wrapper.read(Type.STRING);
- String attributeIdentifier = AttributeMappings.attributeIdentifierMappings().get(key);
- if (attributeIdentifier == null) {
- attributeIdentifier = "minecraft:" + key;
- if (!Key.isValid(attributeIdentifier)) {
- if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
- ViaAprilFools.getPlatform().getLogger().warning("Invalid attribute: " + key);
- }
- actualSize--;
- wrapper.read(Type.DOUBLE);
- int modifierSize = wrapper.read(Type.VAR_INT);
- for (int j = 0; j < modifierSize; j++) {
- wrapper.read(Type.UUID);
- wrapper.read(Type.DOUBLE);
- wrapper.read(Type.BYTE);
- }
- continue;
- }
- }
-
- wrapper.write(Type.STRING, attributeIdentifier);
-
- wrapper.passthrough(Type.DOUBLE);
- int modifierSize = wrapper.passthrough(Type.VAR_INT);
- for (int j = 0; j < modifierSize; j++) {
- wrapper.passthrough(Type.UUID);
- wrapper.passthrough(Type.DOUBLE);
- wrapper.passthrough(Type.BYTE);
- }
- }
- if (size != actualSize) {
- wrapper.set(Type.INT, 0, actualSize);
- }
- });
- }
-}
diff --git a/src/main/resources/assets/viaaprilfools/data/identifiers-20w14infinite.nbt b/src/main/resources/assets/viaaprilfools/data/identifiers-20w14infinite.nbt
index 647fa72..dee5907 100644
Binary files a/src/main/resources/assets/viaaprilfools/data/identifiers-20w14infinite.nbt and b/src/main/resources/assets/viaaprilfools/data/identifiers-20w14infinite.nbt differ
diff --git a/src/main/resources/assets/viaaprilfools/data/identifiers-3D_Shareware.nbt b/src/main/resources/assets/viaaprilfools/data/identifiers-3D_Shareware.nbt
index 1d6568d..cbcaa96 100644
Binary files a/src/main/resources/assets/viaaprilfools/data/identifiers-3D_Shareware.nbt and b/src/main/resources/assets/viaaprilfools/data/identifiers-3D_Shareware.nbt differ
diff --git a/src/main/resources/assets/viaaprilfools/data/mappings-20w14infiniteto1.16.nbt b/src/main/resources/assets/viaaprilfools/data/mappings-20w14infiniteto1.16.nbt
index 905f07e..a0b02ff 100644
Binary files a/src/main/resources/assets/viaaprilfools/data/mappings-20w14infiniteto1.16.nbt and b/src/main/resources/assets/viaaprilfools/data/mappings-20w14infiniteto1.16.nbt differ