├── .gitattributes ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── build.yml ├── .gitignore ├── .idea └── copyright │ ├── GPL_3_0.xml │ └── profiles_settings.xml ├── LICENSE ├── README.md ├── build.gradle ├── buildSrc ├── build.gradle └── src │ └── main │ └── groovy │ ├── base.base-conventions.gradle │ ├── base.exclude-run-folder.gradle │ ├── base.fill-build-constants.gradle │ ├── base.publishing-conventions.gradle │ ├── via.run-with-viaproxy-task.gradle │ ├── via.viaversion-maven-publishing.gradle │ └── vialegacy.publishing-conventions.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java └── net │ └── raphimc │ └── vialegacy │ ├── ViaLegacy.java │ ├── ViaLegacyConfig.java │ ├── api │ ├── LegacyProtocolVersion.java │ ├── data │ │ ├── BlockList1_6.java │ │ └── ItemList1_6.java │ ├── model │ │ ├── ChunkCoord.java │ │ └── Location.java │ ├── protocol │ │ ├── StatelessProtocol.java │ │ └── StatelessTransitionProtocol.java │ ├── remapper │ │ ├── AbstractBlockRemapper.java │ │ ├── AbstractChunkTracker.java │ │ └── LegacyItemRewriter.java │ ├── splitter │ │ ├── PreNettyPacketType.java │ │ ├── PreNettySplitter.java │ │ └── PreNettyTypes.java │ └── util │ │ ├── BlockFaceUtil.java │ │ ├── ChunkCoordSpiral.java │ │ ├── GameProfileUtil.java │ │ └── PacketUtil.java │ ├── netty │ ├── PreNettyLengthCodec.java │ ├── PreNettyLengthPrepender.java │ └── PreNettyLengthRemover.java │ ├── platform │ ├── ViaLegacyConfig.java │ └── ViaLegacyPlatform.java │ └── protocol │ ├── alpha │ ├── a1_0_15toa1_0_16_2 │ │ ├── Protocola1_0_15Toa1_0_16_2.java │ │ └── packet │ │ │ ├── ClientboundPacketsa1_0_15.java │ │ │ └── ServerboundPacketsa1_0_15.java │ ├── a1_0_16_2toa1_0_17_1_0_17_4 │ │ ├── Protocola1_0_16_2Toa1_0_17_1_0_17_4.java │ │ ├── packet │ │ │ └── ClientboundPacketsa1_0_16.java │ │ ├── storage │ │ │ └── TimeLockStorage.java │ │ └── task │ │ │ └── TimeLockTask.java │ ├── a1_0_17_1_0_17_4toa1_1_0_1_1_2_1 │ │ ├── Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1.java │ │ └── packet │ │ │ ├── ClientboundPacketsa1_0_17.java │ │ │ └── ServerboundPacketsa1_0_17.java │ ├── a1_1_0_1_1_2_1toa1_2_0_1_2_1_1 │ │ ├── Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1.java │ │ └── packet │ │ │ ├── ClientboundPacketsa1_1_0.java │ │ │ └── ServerboundPacketsa1_1_0.java │ ├── a1_2_0_1_2_1_1toa1_2_2 │ │ ├── Protocola1_2_0_1_2_1_1Toa1_2_2.java │ │ └── packet │ │ │ ├── ClientboundPacketsa1_2_0.java │ │ │ └── ServerboundPacketsa1_2_0.java │ ├── a1_2_2toa1_2_3_1_2_3_4 │ │ ├── Protocola1_2_2Toa1_2_3_1_2_3_4.java │ │ └── packet │ │ │ ├── ClientboundPacketsa1_2_2.java │ │ │ └── ServerboundPacketsa1_2_2.java │ ├── a1_2_3_1_2_3_4toa1_2_3_5_1_2_6 │ │ ├── Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6.java │ │ └── packet │ │ │ └── ClientboundPacketsa1_2_3.java │ └── a1_2_3_5_1_2_6tob1_0_1_1_1 │ │ ├── Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.java │ │ ├── data │ │ ├── AlphaItems.java │ │ └── CraftingManager.java │ │ ├── model │ │ └── CraftingRecipe.java │ │ ├── packet │ │ ├── ClientboundPacketsa1_2_6.java │ │ └── ServerboundPacketsa1_2_6.java │ │ ├── provider │ │ ├── AlphaInventoryProvider.java │ │ ├── NoOpAlphaInventoryProvider.java │ │ └── TrackingAlphaInventoryProvider.java │ │ ├── storage │ │ ├── AlphaInventoryTracker.java │ │ └── InventoryStorage.java │ │ └── task │ │ └── AlphaInventoryUpdateTask.java │ ├── beta │ ├── b1_0_1_1tob1_1_2 │ │ └── Protocolb1_0_1_1Tob1_1_2.java │ ├── b1_1_2tob1_2_0_2 │ │ ├── Protocolb1_1_2Tob1_2_0_2.java │ │ ├── packet │ │ │ ├── ClientboundPacketsb1_1.java │ │ │ └── ServerboundPacketsb1_1.java │ │ ├── rewriter │ │ │ └── BlockDataRewriter.java │ │ ├── storage │ │ │ └── EntityFlagStorage.java │ │ └── types │ │ │ ├── NbtLessItemType.java │ │ │ └── Typesb1_1.java │ ├── b1_2_0_2tob1_3_0_1 │ │ ├── Protocolb1_2_0_2Tob1_3_0_1.java │ │ ├── data │ │ │ └── BlockHardnessList.java │ │ ├── packet │ │ │ ├── ClientboundPacketsb1_2.java │ │ │ └── ServerboundPacketsb1_2.java │ │ ├── storage │ │ │ └── BlockDigStorage.java │ │ ├── task │ │ │ └── BlockDigTickTask.java │ │ └── types │ │ │ ├── EntityDataType.java │ │ │ ├── EntityDataTypesb1_2.java │ │ │ └── Typesb1_2.java │ ├── b1_3_0_1tob1_4_0_1 │ │ ├── Protocolb1_3_0_1Tob1_4_0_1.java │ │ └── packet │ │ │ └── ClientboundPacketsb1_3.java │ ├── b1_4_0_1tob1_5_0_2 │ │ ├── Protocolb1_4_0_1Tob1_5_0_2.java │ │ ├── packet │ │ │ ├── ClientboundPacketsb1_4.java │ │ │ └── ServerboundPacketsb1_4.java │ │ └── types │ │ │ ├── EntityDataType.java │ │ │ ├── EntityDataTypesb1_4.java │ │ │ └── Typesb1_4.java │ ├── b1_5_0_2tob1_6_0_6 │ │ ├── Protocolb1_5_0_2Tob1_6_0_6.java │ │ ├── packet │ │ │ ├── ClientboundPacketsb1_5.java │ │ │ └── ServerboundPacketsb1_5.java │ │ ├── storage │ │ │ └── WorldTimeStorage.java │ │ └── task │ │ │ └── TimeTrackTask.java │ ├── b1_6_0_6tob1_7_0_3 │ │ └── Protocolb1_6_0_6Tob1_7_0_3.java │ ├── b1_7_0_3tob1_8_0_1 │ │ ├── Protocolb1_7_0_3Tob1_8_0_1.java │ │ ├── packet │ │ │ ├── ClientboundPacketsb1_7.java │ │ │ └── ServerboundPacketsb1_7.java │ │ ├── storage │ │ │ ├── PlayerHealthTracker.java │ │ │ └── PlayerNameTracker.java │ │ └── types │ │ │ ├── StringType.java │ │ │ └── Typesb1_7_0_3.java │ └── b1_8_0_1tor1_0_0_1 │ │ ├── Protocolb1_8_0_1tor1_0_0_1.java │ │ ├── packet │ │ ├── ClientboundPacketsb1_8.java │ │ └── ServerboundPacketsb1_8.java │ │ ├── rewriter │ │ └── ItemRewriter.java │ │ ├── storage │ │ └── PlayerAirTimeStorage.java │ │ ├── task │ │ └── PlayerAirTimeUpdateTask.java │ │ └── types │ │ ├── NbtLessItemType.java │ │ └── Typesb1_8_0_1.java │ ├── classic │ ├── c0_0_15a_1toc0_0_16a_02 │ │ ├── Protocolc0_0_15a_1Toc0_0_16a_02.java │ │ └── packet │ │ │ ├── ClientboundPacketsc0_15a.java │ │ │ └── ServerboundPacketsc0_15a.java │ ├── c0_0_16a_02toc0_0_18a_02 │ │ └── Protocolc0_0_16a_02Toc0_0_18a_02.java │ ├── c0_0_18a_02toc0_0_19a_06 │ │ └── Protocolc0_0_18a_02Toc0_0_19a_06.java │ ├── c0_0_19a_06toc0_0_20a_27 │ │ ├── Protocolc0_0_19a_06Toc0_0_20a_27.java │ │ └── packet │ │ │ ├── ClientboundPacketsc0_19a.java │ │ │ └── ServerboundPacketsc0_19a.java │ ├── c0_0_20a_27toc0_28_30 │ │ ├── Protocolc0_0_20a_27Toc0_28_30.java │ │ └── packet │ │ │ └── ClientboundPacketsc0_20a.java │ ├── c0_28_30toa1_0_15 │ │ ├── Protocolc0_28_30Toa1_0_15.java │ │ ├── data │ │ │ ├── ClassicBlocks.java │ │ │ └── Cp437String.java │ │ ├── model │ │ │ └── ClassicLevel.java │ │ ├── packet │ │ │ ├── ClientboundPacketsc0_28.java │ │ │ └── ServerboundPacketsc0_28.java │ │ ├── provider │ │ │ ├── ClassicCustomCommandProvider.java │ │ │ ├── ClassicMPPassProvider.java │ │ │ └── ClassicWorldHeightProvider.java │ │ ├── storage │ │ │ ├── ClassicBlockRemapper.java │ │ │ ├── ClassicLevelStorage.java │ │ │ ├── ClassicOpLevelStorage.java │ │ │ ├── ClassicPositionTracker.java │ │ │ ├── ClassicProgressStorage.java │ │ │ └── ClassicServerTitleStorage.java │ │ ├── task │ │ │ └── ClassicLevelStorageTickTask.java │ │ └── types │ │ │ ├── BlockPositionType.java │ │ │ ├── ByteArrayType.java │ │ │ ├── StringType.java │ │ │ └── Typesc0_30.java │ └── c0_30cpetoc0_28_30 │ │ ├── Protocolc0_30cpeToc0_28_30.java │ │ ├── data │ │ ├── ClassicProtocolExtension.java │ │ └── ExtendedClassicBlocks.java │ │ ├── packet │ │ ├── ClientboundPacketsc0_30cpe.java │ │ └── ServerboundPacketsc0_30cpe.java │ │ ├── storage │ │ ├── ExtBlockPermissionsStorage.java │ │ └── ExtensionProtocolMetadataStorage.java │ │ └── task │ │ └── ClassicPingTask.java │ └── release │ ├── r1_0_0_1tor1_1 │ ├── Protocolr1_0_0_1Tor1_1.java │ ├── packet │ │ ├── ClientboundPackets1_0_0.java │ │ └── ServerboundPackets1_0_0.java │ └── rewriter │ │ ├── ChatFilter.java │ │ └── ItemRewriter.java │ ├── r1_1tor1_2_1_3 │ ├── Protocolr1_1Tor1_2_1_3.java │ ├── biome │ │ ├── EndBiomeGenerator.java │ │ ├── IWorldChunkManager.java │ │ ├── NetherBiomeGenerator.java │ │ ├── PlainsBiomeGenerator.java │ │ ├── beta │ │ │ ├── NoiseGenerator2.java │ │ │ ├── NoiseGeneratorOctaves2.java │ │ │ ├── OldBiomeGenBase.java │ │ │ └── WorldChunkManager_b1_7.java │ │ └── release │ │ │ ├── BiomeCache.java │ │ │ ├── BiomeCacheBlock.java │ │ │ ├── IntCache.java │ │ │ ├── IntCacheInstance.java │ │ │ ├── NewBiomeGenBase.java │ │ │ ├── WorldChunkManager_r1_1.java │ │ │ └── genlayer │ │ │ ├── GenLayer.java │ │ │ ├── GenLayerDownfall.java │ │ │ ├── GenLayerDownfallMix.java │ │ │ ├── GenLayerHills.java │ │ │ ├── GenLayerIsland_b1_8.java │ │ │ ├── GenLayerIsland_r1_0.java │ │ │ ├── GenLayerMushroomIsland.java │ │ │ ├── GenLayerRiver.java │ │ │ ├── GenLayerRiverInit.java │ │ │ ├── GenLayerRiverMix.java │ │ │ ├── GenLayerShore_r1_0.java │ │ │ ├── GenLayerShore_r1_1.java │ │ │ ├── GenLayerSmooth.java │ │ │ ├── GenLayerSmoothZoom.java │ │ │ ├── GenLayerSnow.java │ │ │ ├── GenLayerSwampRivers.java │ │ │ ├── GenLayerTemperature.java │ │ │ ├── GenLayerTemperatureMix.java │ │ │ ├── GenLayerVillageLandscape_b1_8.java │ │ │ ├── GenLayerVillageLandscape_r1_0.java │ │ │ ├── GenLayerZoom.java │ │ │ ├── GenLayerZoomFuzzy.java │ │ │ ├── GenLayerZoomVoronoi.java │ │ │ └── LayerIsland.java │ ├── model │ │ ├── LegacyNibbleArray.java │ │ ├── NonFullChunk.java │ │ └── PendingBlockEntry.java │ ├── packet │ │ ├── ClientboundPackets1_1.java │ │ └── ServerboundPackets1_1.java │ ├── rewriter │ │ └── ItemRewriter.java │ ├── storage │ │ ├── PendingBlocksTracker.java │ │ └── SeedStorage.java │ ├── task │ │ └── BlockReceiveInvalidatorTask.java │ └── types │ │ ├── BlockChangeRecordArrayType.java │ │ ├── ChunkType.java │ │ └── Types1_1.java │ ├── r1_2_1_3tor1_2_4_5 │ ├── Protocolr1_2_1_3Tor1_2_4_5.java │ ├── packet │ │ ├── ClientboundPackets1_2_1.java │ │ └── ServerboundPackets1_2_1.java │ └── rewriter │ │ └── ItemRewriter.java │ ├── r1_2_4_5tor1_3_1_2 │ ├── Protocolr1_2_4_5Tor1_3_1_2.java │ ├── data │ │ ├── EntityList1_2_4.java │ │ ├── NbtItemList1_2_4.java │ │ └── sound │ │ │ ├── Sound.java │ │ │ ├── SoundRegistry1_2_4.java │ │ │ └── SoundType.java │ ├── model │ │ ├── AbstractTrackedEntity.java │ │ ├── ConfiguredSound.java │ │ ├── TrackedEntity.java │ │ └── TrackedLivingEntity.java │ ├── packet │ │ ├── ClientboundPackets1_2_4.java │ │ └── ServerboundPackets1_2_4.java │ ├── provider │ │ └── OldAuthProvider.java │ ├── rewriter │ │ └── ItemRewriter.java │ ├── storage │ │ ├── ChestStateTracker.java │ │ └── EntityTracker.java │ ├── task │ │ └── EntityTrackerTickTask.java │ └── types │ │ ├── ChunkType.java │ │ ├── ItemType.java │ │ └── Types1_2_4.java │ ├── r1_3_1_2tor1_4_2 │ ├── Protocolr1_3_1_2Tor1_4_2.java │ ├── packet │ │ ├── ClientboundPackets1_3_1.java │ │ └── ServerboundPackets1_3_1.java │ ├── rewriter │ │ ├── ItemRewriter.java │ │ └── SoundRewriter.java │ └── types │ │ ├── EntityDataType.java │ │ ├── EntityDataTypes1_3_1.java │ │ ├── NbtLessItemType.java │ │ └── Types1_3_1.java │ ├── r1_4_2tor1_4_4_5 │ ├── Protocolr1_4_2Tor1_4_4_5.java │ ├── packet │ │ └── ClientboundPackets1_4_2.java │ ├── rewriter │ │ └── ItemRewriter.java │ └── types │ │ ├── EntityDataType.java │ │ ├── EntityDataTypes1_4_2.java │ │ ├── NbtLessItemType.java │ │ ├── Types1_4_2.java │ │ └── UnsignedByteByteArrayType.java │ ├── r1_4_4_5tor1_4_6_7 │ ├── Protocolr1_4_4_5Tor1_4_6_7.java │ ├── packet │ │ └── ClientboundPackets1_4_4.java │ ├── rewriter │ │ └── ItemRewriter.java │ └── types │ │ ├── BulkChunkType.java │ │ └── Types1_4_4.java │ ├── r1_4_6_7tor1_5_0_1 │ ├── Protocolr1_4_6_7Tor1_5_0_1.java │ ├── packet │ │ └── ClientboundPackets1_4_6.java │ └── rewriter │ │ └── ItemRewriter.java │ ├── r1_5_0_1tor1_5_2 │ └── Protocolr1_5_0_1Tor1_5_2.java │ ├── r1_5_2tor1_6_1 │ ├── Protocolr1_5_2Tor1_6_1.java │ ├── data │ │ └── EntityDataIndex1_5_2.java │ ├── packet │ │ ├── ClientboundPackets1_5_2.java │ │ └── ServerboundPackets1_5_2.java │ ├── rewriter │ │ ├── EntityDataRewriter.java │ │ ├── ItemRewriter.java │ │ └── SoundRewriter.java │ └── storage │ │ ├── AttachTracker.java │ │ └── EntityTracker.java │ ├── r1_6_1tor1_6_2 │ ├── Protocolr1_6_1Tor1_6_2.java │ └── packet │ │ └── ClientboundPackets1_6_1.java │ ├── r1_6_2tor1_6_4 │ └── Protocolr1_6_2Tor1_6_4.java │ ├── r1_6_4tor1_7_2_5 │ ├── Protocolr1_6_4Tor1_7_2_5.java │ ├── packet │ │ ├── ClientboundPackets1_6_4.java │ │ └── ServerboundPackets1_6_4.java │ ├── provider │ │ └── EncryptionProvider.java │ ├── rewriter │ │ ├── ItemRewriter.java │ │ ├── SoundRewriter.java │ │ ├── StatisticRewriter.java │ │ └── TextRewriter.java │ ├── storage │ │ ├── ChunkTracker.java │ │ ├── HandshakeStorage.java │ │ ├── PlayerInfoStorage.java │ │ ├── ProtocolMetadataStorage.java │ │ └── StatisticsStorage.java │ └── types │ │ ├── EntityDataType.java │ │ ├── EntityDataTypes1_6_4.java │ │ ├── StringType.java │ │ └── Types1_6_4.java │ ├── r1_7_2_5tor1_7_6_10 │ ├── Protocolr1_7_2_5Tor1_7_6_10.java │ ├── packet │ │ ├── ClientboundPackets1_7_2.java │ │ └── ServerboundPackets1_7_2.java │ └── rewriter │ │ └── TextRewriter.java │ └── r1_7_6_10tor1_8 │ ├── Protocolr1_7_6_10Tor1_8.java │ ├── data │ ├── EntityDataIndex1_7_6.java │ └── Particle1_7_6.java │ ├── model │ ├── ExtendedBlockStorage.java │ ├── HologramPartEntity.java │ ├── MapData.java │ ├── MapIcon.java │ └── TabListEntry.java │ ├── provider │ └── GameProfileFetcher.java │ ├── rewriter │ ├── EntityDataRewriter.java │ ├── ItemRewriter.java │ └── TextRewriter.java │ ├── storage │ ├── ChunkTracker.java │ ├── EntityTracker.java │ ├── MapStorage.java │ ├── TablistStorage.java │ └── WindowTracker.java │ └── types │ ├── BlockChangeRecordArrayType.java │ ├── BlockPositionVarYType.java │ ├── BulkChunkType.java │ ├── ChunkType.java │ ├── EntityDataType.java │ ├── EntityDataTypes1_7_6.java │ ├── IntArrayType.java │ ├── ItemArrayType.java │ ├── ItemType.java │ ├── NBTType.java │ └── Types1_7_6.java └── resources └── assets └── vialegacy └── vialegacy.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: rk_01 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | registries: 3 | maven-central: 4 | type: maven-repository 5 | url: "https://repo.maven.apache.org/maven2/" 6 | updates: 7 | - package-ecosystem: "gradle" 8 | directory: "/" 9 | schedule: 10 | interval: "daily" 11 | registries: 12 | - maven-central 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | on: [push, pull_request, workflow_dispatch] 3 | 4 | jobs: 5 | build: 6 | runs-on: ubuntu-24.04 7 | if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} 8 | steps: 9 | - name: Checkout Repository 10 | uses: actions/checkout@v5 11 | with: 12 | persist-credentials: false 13 | - name: Validate Gradle Wrapper 14 | uses: gradle/actions/wrapper-validation@v5 15 | - name: Set up JDK 21 16 | uses: actions/setup-java@v5 17 | with: 18 | distribution: temurin 19 | java-version: 21 20 | check-latest: true 21 | - name: Build with Gradle 22 | run: ./gradlew build 23 | - name: Upload Artifacts to GitHub 24 | uses: actions/upload-artifact@v4 25 | with: 26 | name: Artifacts 27 | path: build/libs/ 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | *.log.gz 7 | 8 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 9 | hs_err_pid* 10 | 11 | # Project files 12 | /.idea/* 13 | !/.idea/copyright/ 14 | /.gradle/ 15 | /buildSrc/.gradle/ 16 | build/ 17 | out/ 18 | /run/ 19 | -------------------------------------------------------------------------------- /.idea/copyright/GPL_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java-library" 3 | id "base.base-conventions" 4 | id "base.fill-build-constants" 5 | id "vialegacy.publishing-conventions" 6 | id "via.run-with-viaproxy-task" 7 | id "net.raphimc.class-token-replacer" version "1.1.7" 8 | } 9 | 10 | repositories { 11 | maven { 12 | name = "ViaVersion" 13 | url = "https://repo.viaversion.com" 14 | 15 | content { 16 | includeGroupByRegex "com\\.viaversion(\\..+)?" 17 | includeGroupByRegex "net\\.raphimc(\\..+)?" 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compileOnly "com.viaversion:viaversion-common:5.5.1-SNAPSHOT" 24 | compileOnly "com.google.guava:guava:33.5.0-jre" 25 | compileOnly "io.netty:netty-handler:4.2.7.Final" 26 | } 27 | -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "groovy-gradle-plugin" 3 | } 4 | 5 | repositories { 6 | gradlePluginPortal() 7 | } 8 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/base.base-conventions.gradle: -------------------------------------------------------------------------------- 1 | base { 2 | java.toolchain.languageVersion = JavaLanguageVersion.of(project.java_version) 3 | 4 | group = project.maven_group 5 | archivesName = project.name 6 | version = project.maven_version 7 | } 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | jar { 14 | if (layout.projectDirectory.file("LICENSE").asFile.exists()) { 15 | def projectName = project.name 16 | from(layout.projectDirectory.file("LICENSE")) { 17 | rename { "${it}_${projectName}" } 18 | } 19 | } else if (rootProject.layout.projectDirectory.file("LICENSE").asFile.exists()) { 20 | def projectName = rootProject.name 21 | from(rootProject.layout.projectDirectory.file("LICENSE")) { 22 | rename { "${it}_${projectName}" } 23 | } 24 | } 25 | } 26 | 27 | tasks.withType(JavaCompile).configureEach { 28 | it.options.encoding = "UTF-8" 29 | } 30 | 31 | tasks.withType(Javadoc).configureEach { 32 | it.options.encoding = "UTF-8" 33 | it.options.addStringOption("Xdoclint:none", "-quiet") 34 | } 35 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/base.exclude-run-folder.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "idea" 3 | } 4 | 5 | idea { 6 | module { 7 | ["run"].each { 8 | excludeDirs << layout.projectDirectory.file("$it").asFile 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/base.fill-build-constants.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "net.raphimc.class-token-replacer" 3 | } 4 | 5 | sourceSets.configureEach { 6 | it.classTokenReplacer { 7 | property("\${version}", project.version) 8 | property("\${commit_hash}", latestCommitHash().get()) 9 | } 10 | } 11 | 12 | Provider latestCommitHash() { 13 | return providers.exec { 14 | commandLine = ["git", "rev-parse", "--short", "HEAD"] 15 | }.standardOutput.getAsText().map(String::trim) 16 | } 17 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/base.publishing-conventions.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "maven-publish" 3 | id "signing" 4 | } 5 | 6 | java { 7 | withSourcesJar() 8 | withJavadocJar() 9 | } 10 | 11 | publishing { 12 | publications { 13 | mavenJava(MavenPublication) { 14 | from(components.java) 15 | 16 | groupId = project.maven_group 17 | artifactId = project.maven_name 18 | version = project.maven_version 19 | } 20 | } 21 | } 22 | 23 | signing { 24 | setRequired(false) 25 | sign(publishing.publications.mavenJava) 26 | } 27 | 28 | tasks.withType(PublishToMavenRepository).configureEach { 29 | it.dependsOn(tasks.withType(Sign)) 30 | } 31 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/via.run-with-viaproxy-task.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "base.exclude-run-folder" 3 | } 4 | 5 | def prepareTask = tasks.register("prepareViaProxyFiles", Copy) { 6 | dependsOn(tasks.jar) 7 | 8 | def projectName = project.name 9 | from(tasks.jar.archiveFile) 10 | into(file("run/jars")) 11 | rename { "${projectName}.jar" } 12 | } 13 | 14 | def cleanupTask = tasks.register("cleanupViaProxyFiles", Delete) { 15 | delete(file("run/jars/${project.name}.jar")) 16 | delete(file("run/logs")) 17 | } 18 | 19 | tasks.register("runViaProxy", JavaExec) { 20 | dependsOn(prepareTask) 21 | finalizedBy(cleanupTask) 22 | 23 | def viaProxyConfiguration = configurations.create("viaProxy") 24 | viaProxyConfiguration.dependencies.add(dependencies.create("net.raphimc:ViaProxy:3.4.6-SNAPSHOT") { 25 | transitive = false 26 | }) 27 | 28 | mainClass = "net.raphimc.viaproxy.ViaProxy" 29 | classpath = viaProxyConfiguration 30 | workingDir = file("run") 31 | jvmArgs = ["-DskipUpdateCheck"] 32 | } 33 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/via.viaversion-maven-publishing.gradle: -------------------------------------------------------------------------------- 1 | publishing { 2 | repositories { 3 | maven { 4 | name = "Via" 5 | url = "https://repo.viaversion.com/" 6 | 7 | credentials(PasswordCredentials) 8 | authentication { 9 | basic(BasicAuthentication) 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/vialegacy.publishing-conventions.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "base.publishing-conventions" 3 | id "via.viaversion-maven-publishing" 4 | } 5 | 6 | publishing { 7 | publications { 8 | mavenJava { 9 | pom { 10 | name = "ViaLegacy" 11 | description = "ViaVersion addon to add support for EVERY Minecraft server version (Classic, Alpha, Beta, Release)" 12 | url = "https://github.com/ViaVersion/ViaLegacy" 13 | licenses { 14 | license { 15 | name = "GPL-3.0 License" 16 | url = "https://github.com/ViaVersion/ViaLegacy/blob/main/LICENSE" 17 | } 18 | } 19 | developers { 20 | developer { 21 | id = "RK_01" 22 | } 23 | } 24 | scm { 25 | connection = "scm:git:git://github.com/ViaVersion/ViaLegacy.git" 26 | developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaLegacy.git" 27 | url = "https://github.com/ViaVersion/ViaLegacy.git" 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.parallel=true 3 | org.gradle.configuration-cache=true 4 | 5 | java_version=17 6 | maven_group=net.raphimc 7 | maven_name=ViaLegacy 8 | maven_version=3.0.12-SNAPSHOT 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ViaVersion/ViaLegacy/d22a243e49baaeedae33d021ee0b4e56aec8a9be/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=8fad3d78296ca518113f3d29016617c7f9367dc005f932bd9d93bf45ba46072b 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id "org.gradle.toolchains.foojay-resolver-convention" version "1.0.0" 10 | } 11 | 12 | rootProject.name = "ViaLegacy" 13 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/ViaLegacy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy; 19 | 20 | import net.raphimc.vialegacy.platform.ViaLegacyConfig; 21 | import net.raphimc.vialegacy.platform.ViaLegacyPlatform; 22 | 23 | public class ViaLegacy { 24 | 25 | public static final String VERSION = "${version}"; 26 | public static final String IMPL_VERSION = "git-ViaLegacy-${version}:${commit_hash}"; 27 | 28 | private static ViaLegacyPlatform platform; 29 | private static ViaLegacyConfig config; 30 | 31 | private ViaLegacy() { 32 | } 33 | 34 | public static void init(final ViaLegacyPlatform platform, final ViaLegacyConfig config) { 35 | if (ViaLegacy.platform != null) throw new IllegalStateException("ViaLegacy is already initialized"); 36 | 37 | ViaLegacy.platform = platform; 38 | ViaLegacy.config = config; 39 | } 40 | 41 | public static ViaLegacyPlatform getPlatform() { 42 | return ViaLegacy.platform; 43 | } 44 | 45 | public static ViaLegacyConfig getConfig() { 46 | return ViaLegacy.config; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/api/splitter/PreNettyPacketType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.api.splitter; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import io.netty.buffer.ByteBuf; 22 | 23 | import java.util.function.BiConsumer; 24 | 25 | public interface PreNettyPacketType { 26 | 27 | BiConsumer getPacketReader(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/api/splitter/PreNettySplitter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.api.splitter; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.api.protocol.Protocol; 22 | 23 | import java.util.function.IntFunction; 24 | 25 | public class PreNettySplitter implements StorableObject { 26 | 27 | private final IntFunction packetTypeSupplier; 28 | private final Class> protocolClass; 29 | 30 | public PreNettySplitter(Class> protocolClass, IntFunction packetTypeSupplier) { 31 | this.protocolClass = protocolClass; 32 | this.packetTypeSupplier = packetTypeSupplier; 33 | } 34 | 35 | public PreNettyPacketType getPacketType(final int packetId) { 36 | return this.packetTypeSupplier.apply(packetId); 37 | } 38 | 39 | public String getProtocolName() { 40 | return this.protocolClass.getSimpleName(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/api/util/BlockFaceUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.api.util; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockFace; 21 | 22 | public class BlockFaceUtil { 23 | 24 | public static BlockFace getFace(final int direction) { 25 | return switch (direction) { 26 | case 0 -> BlockFace.BOTTOM; 27 | default -> BlockFace.TOP; 28 | case 2 -> BlockFace.NORTH; 29 | case 3 -> BlockFace.SOUTH; 30 | case 4 -> BlockFace.WEST; 31 | case 5 -> BlockFace.EAST; 32 | }; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/api/util/GameProfileUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.api.util; 19 | 20 | import com.viaversion.viaversion.api.minecraft.GameProfile; 21 | 22 | import java.nio.charset.StandardCharsets; 23 | import java.util.UUID; 24 | 25 | public class GameProfileUtil { 26 | 27 | public static UUID getOfflinePlayerUuid(final String name) { 28 | return UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8)); 29 | } 30 | 31 | public static boolean isOfflineGameProfile(final GameProfile gameProfile) { 32 | return gameProfile.id() != null && gameProfile.name() != null && gameProfile.id().equals(getOfflinePlayerUuid(gameProfile.name())); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/api/util/PacketUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.api.util; 19 | 20 | import com.viaversion.viaversion.api.protocol.packet.PacketType; 21 | import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; 22 | import com.viaversion.viaversion.protocol.packet.PacketWrapperImpl; 23 | import io.netty.buffer.ByteBuf; 24 | import io.netty.buffer.Unpooled; 25 | 26 | public class PacketUtil { 27 | 28 | public static int calculateLength(final PacketWrapper wrapper) { 29 | final PacketType packetType = wrapper.getPacketType(); 30 | wrapper.setPacketType(null); 31 | 32 | final ByteBuf lengthBuffer = Unpooled.buffer(); 33 | if (wrapper instanceof PacketWrapperImpl impl && impl.getInputBuffer() != null) { 34 | impl.getInputBuffer().markReaderIndex(); 35 | } 36 | wrapper.writeToBuffer(lengthBuffer); 37 | if (wrapper instanceof PacketWrapperImpl impl && impl.getInputBuffer() != null) { 38 | impl.getInputBuffer().resetReaderIndex(); 39 | } 40 | final int length = lengthBuffer.readableBytes(); 41 | lengthBuffer.release(); 42 | 43 | wrapper.setPacketType(packetType); 44 | return length; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/netty/PreNettyLengthCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.netty; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import io.netty.buffer.ByteBuf; 22 | import io.netty.channel.ChannelHandlerContext; 23 | import io.netty.handler.codec.ByteToMessageCodec; 24 | 25 | import java.util.List; 26 | 27 | public class PreNettyLengthCodec extends ByteToMessageCodec { 28 | 29 | protected final PreNettyLengthRemover encoder; 30 | protected final PreNettyLengthPrepender decoder; 31 | 32 | public PreNettyLengthCodec(final UserConnection user) { 33 | this.encoder = new PreNettyLengthRemover(user); 34 | this.decoder = new PreNettyLengthPrepender(user); 35 | } 36 | 37 | @Override 38 | protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) { 39 | this.encoder.encode(ctx, in, out); 40 | } 41 | 42 | @Override 43 | protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { 44 | this.decoder.decode(ctx, in, out); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/netty/PreNettyLengthRemover.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.netty; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.type.Types; 22 | import io.netty.buffer.ByteBuf; 23 | import io.netty.channel.ChannelHandlerContext; 24 | import io.netty.handler.codec.MessageToByteEncoder; 25 | 26 | public class PreNettyLengthRemover extends MessageToByteEncoder { 27 | 28 | protected final UserConnection user; 29 | 30 | public PreNettyLengthRemover(final UserConnection user) { 31 | this.user = user; 32 | } 33 | 34 | @Override 35 | protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) { 36 | Types.VAR_INT.readPrimitive(in); // length 37 | out.writeByte(Types.VAR_INT.readPrimitive(in) & 255); // id 38 | out.writeBytes(in); // content 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/platform/ViaLegacyConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.platform; 19 | 20 | import com.viaversion.viaversion.api.configuration.Config; 21 | 22 | public interface ViaLegacyConfig extends Config { 23 | 24 | boolean isDynamicOnground(); 25 | 26 | boolean isIgnoreLong1_8ChannelNames(); 27 | 28 | boolean isLegacySkullLoading(); 29 | 30 | boolean isLegacySkinLoading(); 31 | 32 | boolean isSoundEmulation(); 33 | 34 | boolean isOldBiomes(); 35 | 36 | boolean enableB1_7_3Sprinting(); 37 | 38 | String getB1_7_3Motd(); 39 | 40 | int getClassicChunkRange(); 41 | 42 | boolean enableClassicFly(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/alpha/a1_0_16_2toa1_0_17_1_0_17_4/storage/TimeLockStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class TimeLockStorage implements StorableObject { 23 | 24 | private long time; 25 | 26 | public TimeLockStorage(final long time) { 27 | this.time = time; 28 | } 29 | 30 | public void setTime(final long time) { 31 | this.time = time; 32 | } 33 | 34 | public long getTime() { 35 | return this.time; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/alpha/a1_2_3_5_1_2_6tob1_0_1_1_1/provider/AlphaInventoryProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.platform.providers.Provider; 23 | import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage; 24 | 25 | public abstract class AlphaInventoryProvider implements Provider { 26 | 27 | public abstract boolean usesInventoryTracker(); 28 | 29 | public Item getHandItem(final UserConnection user) { 30 | final InventoryStorage inventoryStorage = user.get(InventoryStorage.class); 31 | final Item[] inventory = this.getMainInventoryItems(user); 32 | return inventory[inventoryStorage.selectedHotbarSlot]; 33 | } 34 | 35 | public abstract Item[] getMainInventoryItems(final UserConnection user); 36 | 37 | public abstract Item[] getCraftingInventoryItems(final UserConnection user); 38 | 39 | public abstract Item[] getArmorInventoryItems(final UserConnection user); 40 | 41 | public abstract Item[] getContainerItems(final UserConnection user); 42 | 43 | public abstract void addToInventory(final UserConnection user, final Item item); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/alpha/a1_2_3_5_1_2_6tob1_0_1_1_1/provider/NoOpAlphaInventoryProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage; 23 | 24 | public class NoOpAlphaInventoryProvider extends AlphaInventoryProvider { 25 | 26 | @Override 27 | public boolean usesInventoryTracker() { 28 | return false; 29 | } 30 | 31 | @Override 32 | public Item[] getMainInventoryItems(UserConnection user) { 33 | return new Item[36]; 34 | } 35 | 36 | @Override 37 | public Item[] getCraftingInventoryItems(UserConnection user) { 38 | return new Item[4]; 39 | } 40 | 41 | @Override 42 | public Item[] getArmorInventoryItems(UserConnection user) { 43 | return new Item[4]; 44 | } 45 | 46 | @Override 47 | public Item[] getContainerItems(UserConnection user) { 48 | final InventoryStorage inventoryStorage = user.get(InventoryStorage.class); 49 | return inventoryStorage.containers.get(inventoryStorage.openContainerPos); 50 | } 51 | 52 | @Override 53 | public void addToInventory(UserConnection user, Item item) { 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_0_1_1tob1_1_2/Protocolb1_0_1_1Tob1_1_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_0_1_1tob1_1_2; 19 | 20 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 21 | import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ClientboundPacketsb1_1; 22 | import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ServerboundPacketsb1_1; 23 | 24 | public class Protocolb1_0_1_1Tob1_1_2 extends StatelessProtocol { 25 | 26 | public Protocolb1_0_1_1Tob1_1_2() { 27 | super(ClientboundPacketsb1_1.class, ClientboundPacketsb1_1.class, ServerboundPacketsb1_1.class, ServerboundPacketsb1_1.class); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_1_2tob1_2_0_2/rewriter/BlockDataRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.rewriter; 19 | 20 | import com.viaversion.viaversion.util.IdAndData; 21 | import net.raphimc.vialegacy.api.data.BlockList1_6; 22 | import net.raphimc.vialegacy.api.remapper.AbstractBlockRemapper; 23 | 24 | public class BlockDataRewriter extends AbstractBlockRemapper { 25 | 26 | public BlockDataRewriter() { 27 | for (int i = 1; i < 16; i++) { // cobblestone 28 | this.registerReplacement(new IdAndData(BlockList1_6.cobblestone.blockId(), i), new IdAndData(BlockList1_6.cobblestone.blockId(), 0)); 29 | } 30 | for (int i = 1; i < 16; i++) { // sand 31 | this.registerReplacement(new IdAndData(BlockList1_6.sand.blockId(), i), new IdAndData(BlockList1_6.sand.blockId(), 0)); 32 | } 33 | for (int i = 1; i < 16; i++) { // gravel 34 | this.registerReplacement(new IdAndData(BlockList1_6.gravel.blockId(), i), new IdAndData(BlockList1_6.gravel.blockId(), 0)); 35 | } 36 | for (int i = 1; i < 16; i++) { // obsidian 37 | this.registerReplacement(new IdAndData(BlockList1_6.obsidian.blockId(), i), new IdAndData(BlockList1_6.obsidian.blockId(), 0)); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_1_2tob1_2_0_2/storage/EntityFlagStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; 22 | import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; 23 | 24 | public class EntityFlagStorage implements StorableObject { 25 | 26 | private final Int2IntMap animationFlags = new Int2IntOpenHashMap(); 27 | 28 | public boolean getFlag(final int entityId, final int index) { 29 | return (this.getFlagMask(entityId) & 1 << index) != 0; 30 | } 31 | 32 | public int getFlagMask(final int entityId) { 33 | return this.animationFlags.get(entityId); 34 | } 35 | 36 | public void setFlag(final int entityId, final int index, final boolean flag) { 37 | final int mask = this.animationFlags.get(entityId); 38 | if (flag) { 39 | this.animationFlags.put(entityId, mask | 1 << index); 40 | } else { 41 | this.animationFlags.put(entityId, mask & ~(1 << index)); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_1_2tob1_2_0_2/types/NbtLessItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.DataItem; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import io.netty.buffer.ByteBuf; 24 | 25 | public class NbtLessItemType extends Type { 26 | 27 | public NbtLessItemType() { 28 | super(Item.class); 29 | } 30 | 31 | public Item read(ByteBuf buffer) { 32 | final short id = buffer.readShort(); 33 | if (id < 0) { 34 | return null; 35 | } 36 | 37 | final Item item = new DataItem(); 38 | item.setIdentifier(id); 39 | item.setAmount(buffer.readByte()); 40 | item.setData(buffer.readByte()); 41 | return item; 42 | } 43 | 44 | public void write(ByteBuf buffer, Item item) { 45 | if (item == null) { 46 | buffer.writeShort(-1); 47 | } else { 48 | buffer.writeShort(item.identifier()); 49 | buffer.writeByte(item.amount()); 50 | buffer.writeByte(item.data()); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_1_2tob1_2_0_2/types/Typesb1_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.Item; 21 | import com.viaversion.viaversion.api.type.Type; 22 | 23 | public class Typesb1_1 { 24 | 25 | public static final Type NBTLESS_ITEM = new NbtLessItemType(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_2_0_2tob1_3_0_1/storage/BlockDigStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StoredObject; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import com.viaversion.viaversion.api.minecraft.BlockPosition; 23 | import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.Protocolb1_2_0_2Tob1_3_0_1; 24 | 25 | public class BlockDigStorage extends StoredObject { 26 | 27 | public int tick = 1; 28 | private final BlockPosition position; 29 | private final short facing; 30 | 31 | public BlockDigStorage(UserConnection user, final BlockPosition position, final short facing) { 32 | super(user); 33 | this.position = position; 34 | this.facing = facing; 35 | } 36 | 37 | public void tick() { 38 | if (this.tick >= 5) { 39 | Protocolb1_2_0_2Tob1_3_0_1.sendBlockDigPacket(this.user(), (byte) 0, this.position, this.facing); 40 | this.tick = 0; 41 | } else { 42 | this.tick++; 43 | } 44 | Protocolb1_2_0_2Tob1_3_0_1.sendBlockDigPacket(this.user(), (byte) 1, this.position, this.facing); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_2_0_2tob1_3_0_1/task/BlockDigTickTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.task; 19 | 20 | import com.viaversion.viaversion.api.Via; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import net.raphimc.vialegacy.ViaLegacy; 23 | import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage.BlockDigStorage; 24 | 25 | import java.util.logging.Level; 26 | 27 | public class BlockDigTickTask implements Runnable { 28 | 29 | @Override 30 | public void run() { 31 | for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) { 32 | final BlockDigStorage blockDigStorage = info.get(BlockDigStorage.class); 33 | if (blockDigStorage != null) { 34 | info.getChannel().eventLoop().submit(() -> { 35 | if (!info.getChannel().isActive()) return; 36 | 37 | try { 38 | blockDigStorage.tick(); 39 | } catch (Throwable e) { 40 | ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error while ticking BlockDigStorage", e); 41 | } 42 | }); 43 | } 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_2_0_2tob1_3_0_1/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypesb1_2.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_2_0_2tob1_3_0_1/types/EntityDataTypesb1_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.Types; 23 | import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3; 24 | import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1; 25 | 26 | public enum EntityDataTypesb1_2 implements EntityDataType { 27 | 28 | BYTE(0, Types.BYTE), 29 | SHORT(1, Types.SHORT), 30 | INT(2, Types.INT), 31 | FLOAT(3, Types.FLOAT), 32 | STRING(4, Typesb1_7_0_3.STRING), 33 | ITEM(5, Types1_3_1.NBTLESS_ITEM); 34 | 35 | private final int typeID; 36 | private final Type type; 37 | 38 | EntityDataTypesb1_2(int typeID, Type type) { 39 | this.typeID = typeID; 40 | this.type = type; 41 | } 42 | 43 | public static EntityDataTypesb1_2 byId(int id) { 44 | return values()[id]; 45 | } 46 | 47 | public int typeId() { 48 | return this.typeID; 49 | } 50 | 51 | public Type type() { 52 | return this.type; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_2_0_2tob1_3_0_1/types/Typesb1_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; 23 | 24 | import java.util.List; 25 | 26 | public class Typesb1_2 { 27 | 28 | public static final Type ENTITY_DATA = new EntityDataType(); 29 | public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_3_0_1tob1_4_0_1/Protocolb1_3_0_1Tob1_4_0_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 22 | import net.raphimc.vialegacy.api.splitter.PreNettySplitter; 23 | import net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1.packet.ClientboundPacketsb1_3; 24 | import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ClientboundPacketsb1_4; 25 | import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ServerboundPacketsb1_4; 26 | 27 | public class Protocolb1_3_0_1Tob1_4_0_1 extends StatelessProtocol { 28 | 29 | public Protocolb1_3_0_1Tob1_4_0_1() { 30 | super(ClientboundPacketsb1_3.class, ClientboundPacketsb1_4.class, ServerboundPacketsb1_4.class, ServerboundPacketsb1_4.class); 31 | } 32 | 33 | @Override 34 | public void init(UserConnection userConnection) { 35 | userConnection.put(new PreNettySplitter(Protocolb1_3_0_1Tob1_4_0_1.class, ClientboundPacketsb1_3::getPacket)); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_4_0_1tob1_5_0_2/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypesb1_4.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_4_0_1tob1_5_0_2/types/Typesb1_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; 23 | 24 | import java.util.List; 25 | 26 | public class Typesb1_4 { 27 | 28 | public static final Type ENTITY_DATA = new EntityDataType(); 29 | public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_5_0_2tob1_6_0_6/storage/WorldTimeStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class WorldTimeStorage implements StorableObject { 23 | 24 | public long time; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_5_0_2tob1_6_0_6/task/TimeTrackTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.task; 19 | 20 | import com.viaversion.viaversion.api.Via; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.storage.WorldTimeStorage; 23 | 24 | public class TimeTrackTask implements Runnable { 25 | 26 | @Override 27 | public void run() { 28 | for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) { 29 | final WorldTimeStorage worldTimeStorage = info.get(WorldTimeStorage.class); 30 | if (worldTimeStorage != null) worldTimeStorage.time++; 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_6_0_6tob1_7_0_3/Protocolb1_6_0_6Tob1_7_0_3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_6_0_6tob1_7_0_3; 19 | 20 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 21 | import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ClientboundPacketsb1_7; 22 | import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ServerboundPacketsb1_7; 23 | 24 | public class Protocolb1_6_0_6Tob1_7_0_3 extends StatelessProtocol { 25 | 26 | public Protocolb1_6_0_6Tob1_7_0_3() { 27 | super(ClientboundPacketsb1_7.class, ClientboundPacketsb1_7.class, ServerboundPacketsb1_7.class, ServerboundPacketsb1_7.class); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_7_0_3tob1_8_0_1/storage/PlayerHealthTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class PlayerHealthTracker implements StorableObject { 23 | 24 | private short health = 20; 25 | 26 | public void setHealth(final short health) { 27 | this.health = health; 28 | } 29 | 30 | public short getHealth() { 31 | return this.health; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_7_0_3tob1_8_0_1/storage/PlayerNameTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectArrayMap; 22 | import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; 23 | 24 | public class PlayerNameTracker implements StorableObject { 25 | 26 | public final Int2ObjectMap names = new Int2ObjectArrayMap<>(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_7_0_3tob1_8_0_1/types/StringType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | import io.netty.buffer.ByteBufInputStream; 23 | import io.netty.buffer.ByteBufOutputStream; 24 | 25 | import java.io.IOException; 26 | 27 | public class StringType extends Type { 28 | 29 | public StringType() { 30 | super(String.class); 31 | } 32 | 33 | public String read(ByteBuf buffer) { 34 | final ByteBufInputStream dis = new ByteBufInputStream(buffer); 35 | try { 36 | return dis.readUTF(); 37 | } catch (IOException e) { 38 | throw new RuntimeException(e); 39 | } 40 | } 41 | 42 | public void write(ByteBuf buffer, String s) { 43 | final ByteBufOutputStream dos = new ByteBufOutputStream(buffer); 44 | try { 45 | dos.writeUTF(s); 46 | } catch (IOException e) { 47 | throw new RuntimeException(e); 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_7_0_3tob1_8_0_1/types/Typesb1_7_0_3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | 22 | public class Typesb1_7_0_3 { 23 | 24 | public static final Type STRING = new StringType(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_8_0_1tor1_0_0_1/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.Protocolb1_8_0_1tor1_0_0_1; 22 | import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ClientboundPacketsb1_8; 23 | import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types.Typesb1_8_0_1; 24 | import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ServerboundPackets1_0_0; 25 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4; 26 | 27 | public class ItemRewriter extends LegacyItemRewriter { 28 | 29 | public ItemRewriter(final Protocolb1_8_0_1tor1_0_0_1 protocol) { 30 | super(protocol, "b1.8.1", Typesb1_8_0_1.CREATIVE_ITEM, null, Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); 31 | 32 | this.addNonExistentItemRange(110, 122); 33 | this.addNonExistentItemRange(369, 382); 34 | this.addNonExistentItems(438); 35 | this.addNonExistentItemRange(2256, 2266); 36 | } 37 | 38 | @Override 39 | protected void registerPackets() { 40 | this.registerCreativeInventoryAction(ServerboundPackets1_0_0.SET_CREATIVE_MODE_SLOT); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_8_0_1tor1_0_0_1/storage/PlayerAirTimeStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class PlayerAirTimeStorage implements StorableObject { 23 | 24 | public final int MAX_AIR = 300; 25 | public int air = MAX_AIR; 26 | public boolean sentPacket = true; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_8_0_1tor1_0_0_1/types/NbtLessItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.DataItem; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import io.netty.buffer.ByteBuf; 24 | 25 | public class NbtLessItemType extends Type { 26 | 27 | public NbtLessItemType() { 28 | super(Item.class); 29 | } 30 | 31 | public Item read(ByteBuf buffer) { 32 | final short id = buffer.readShort(); 33 | if (id < 0) { 34 | return null; 35 | } else { 36 | final Item item = new DataItem(); 37 | item.setIdentifier(id); 38 | item.setAmount((byte) buffer.readShort()); 39 | item.setData(buffer.readShort()); 40 | return item; 41 | } 42 | } 43 | 44 | public void write(ByteBuf buffer, Item item) { 45 | if (item == null) { 46 | buffer.writeShort(-1); 47 | buffer.writeShort(0); 48 | buffer.writeShort(0); 49 | } else { 50 | buffer.writeShort(item.identifier()); 51 | buffer.writeShort(item.amount()); 52 | buffer.writeShort(item.data()); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/beta/b1_8_0_1tor1_0_0_1/types/Typesb1_8_0_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.Item; 21 | import com.viaversion.viaversion.api.type.Type; 22 | 23 | public class Typesb1_8_0_1 { 24 | 25 | public static final Type CREATIVE_ITEM = new NbtLessItemType(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_0_16a_02toc0_0_18a_02/Protocolc0_0_16a_02Toc0_0_18a_02.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_0_16a_02toc0_0_18a_02; 19 | 20 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 21 | import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ClientboundPacketsc0_19a; 22 | import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ServerboundPacketsc0_19a; 23 | 24 | public class Protocolc0_0_16a_02Toc0_0_18a_02 extends StatelessProtocol { 25 | 26 | public Protocolc0_0_16a_02Toc0_0_18a_02() { 27 | super(ClientboundPacketsc0_19a.class, ClientboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/provider/ClassicCustomCommandProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.platform.providers.Provider; 22 | import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; 23 | import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet.ClientboundPacketsa1_0_15; 24 | import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3; 25 | import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.Protocolc0_28_30Toa1_0_15; 26 | 27 | public class ClassicCustomCommandProvider implements Provider { 28 | 29 | public boolean handleChatMessage(final UserConnection user, final String message) { 30 | return false; 31 | } 32 | 33 | public void sendFeedback(final UserConnection user, final String message) { 34 | final PacketWrapper chatMessage = PacketWrapper.create(ClientboundPacketsa1_0_15.CHAT, user); 35 | chatMessage.write(Typesb1_7_0_3.STRING, message); // message 36 | chatMessage.send(Protocolc0_28_30Toa1_0_15.class); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/provider/ClassicMPPassProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.platform.providers.Provider; 22 | 23 | public class ClassicMPPassProvider implements Provider { 24 | 25 | public String getMpPass(final UserConnection user) { 26 | return "0"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/provider/ClassicWorldHeightProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.platform.providers.Provider; 22 | 23 | public class ClassicWorldHeightProvider implements Provider { 24 | 25 | public short getMaxChunkSectionCount(final UserConnection user) { 26 | return 8; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicBlockRemapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectFunction; 22 | import com.viaversion.viaversion.libs.fastutil.objects.Object2IntFunction; 23 | import com.viaversion.viaversion.util.IdAndData; 24 | 25 | public record ClassicBlockRemapper(Int2ObjectFunction mapper, Object2IntFunction reverseMapper) implements StorableObject { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicProgressStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class ClassicProgressStorage implements StorableObject { 23 | 24 | public int upperBound = 100; 25 | public int progress; // 0% - upperBound 26 | public String status = "Waiting..."; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/task/ClassicLevelStorageTickTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.task; 19 | 20 | import com.viaversion.viaversion.api.Via; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import net.raphimc.vialegacy.ViaLegacy; 23 | import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage.ClassicLevelStorage; 24 | 25 | import java.util.logging.Level; 26 | 27 | public class ClassicLevelStorageTickTask implements Runnable { 28 | 29 | @Override 30 | public void run() { 31 | for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) { 32 | final ClassicLevelStorage classicLevelStorage = info.get(ClassicLevelStorage.class); 33 | if (classicLevelStorage != null) { 34 | info.getChannel().eventLoop().submit(() -> { 35 | if (!info.getChannel().isActive()) return; 36 | 37 | try { 38 | classicLevelStorage.tick(); 39 | } catch (Throwable e) { 40 | ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error while ticking ClassicLevelStorage", e); 41 | } 42 | }); 43 | } 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/types/BlockPositionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockPosition; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import io.netty.buffer.ByteBuf; 23 | 24 | public class BlockPositionType extends Type { 25 | 26 | public BlockPositionType() { 27 | super(BlockPosition.class); 28 | } 29 | 30 | @Override 31 | public BlockPosition read(ByteBuf buffer) { 32 | return new BlockPosition(buffer.readShort(), (int) buffer.readShort(), buffer.readShort()); 33 | } 34 | 35 | @Override 36 | public void write(ByteBuf buffer, BlockPosition position) { 37 | buffer.writeShort(position.x()); 38 | buffer.writeShort(position.y()); 39 | buffer.writeShort(position.z()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/types/ByteArrayType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | 23 | public class ByteArrayType extends Type { 24 | 25 | public ByteArrayType() { 26 | super(byte[].class); 27 | } 28 | 29 | public void write(ByteBuf buffer, byte[] array) { 30 | if (array.length != 1024) throw new IllegalStateException("Byte array needs to be exactly 1024 bytes long"); 31 | 32 | buffer.writeBytes(array); 33 | } 34 | 35 | public byte[] read(ByteBuf buffer) { 36 | final byte[] array = new byte[1024]; 37 | buffer.readBytes(array); 38 | return array; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/types/StringType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data.Cp437String; 23 | 24 | import java.util.Arrays; 25 | 26 | public class StringType extends Type { 27 | 28 | public StringType() { 29 | super(String.class); 30 | } 31 | 32 | public String read(ByteBuf buffer) { 33 | final byte[] stringBytes = new byte[64]; 34 | buffer.readBytes(stringBytes); 35 | return Cp437String.fromBytes(stringBytes).trim(); 36 | } 37 | 38 | public void write(ByteBuf buffer, String s) { 39 | final byte[] bytes = new byte[64]; 40 | final byte[] stringBytes = Cp437String.toBytes(s); 41 | 42 | Arrays.fill(bytes, (byte) 32); 43 | System.arraycopy(stringBytes, 0, bytes, 0, Math.min(bytes.length, stringBytes.length)); 44 | 45 | buffer.writeBytes(bytes); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/types/Typesc0_30.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockPosition; 21 | import com.viaversion.viaversion.api.type.Type; 22 | 23 | public class Typesc0_30 { 24 | 25 | public static final Type STRING = new StringType(); 26 | 27 | public static final Type BYTE_ARRAY = new ByteArrayType(); 28 | 29 | public static final Type BLOCK_POSITION = new BlockPositionType(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/classic/c0_30cpetoc0_28_30/storage/ExtBlockPermissionsStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.IntOpenHashSet; 22 | import com.viaversion.viaversion.libs.fastutil.ints.IntSet; 23 | 24 | public class ExtBlockPermissionsStorage implements StorableObject { 25 | 26 | private final IntSet placingDenied = new IntOpenHashSet(); 27 | private final IntSet breakingDenied = new IntOpenHashSet(); 28 | 29 | public void addPlaceable(final int block) { 30 | this.placingDenied.remove(block); 31 | } 32 | 33 | public void addBreakable(final int block) { 34 | this.breakingDenied.remove(block); 35 | } 36 | 37 | public void removePlaceable(final int block) { 38 | this.placingDenied.add(block); 39 | } 40 | 41 | public void removeBreakable(final int block) { 42 | this.breakingDenied.add(block); 43 | } 44 | 45 | public boolean isPlacingDenied(final int block) { 46 | return this.placingDenied.contains(block); 47 | } 48 | 49 | public boolean isBreakingDenied(final int block) { 50 | return this.breakingDenied.contains(block); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_0_0_1tor1_1/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.Protocolr1_0_0_1Tor1_1; 22 | import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ClientboundPackets1_0_0; 23 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.packet.ServerboundPackets1_1; 24 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_0_0_1Tor1_1 protocol) { 29 | super(protocol, "1.0", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); 30 | 31 | this.addNonExistentItems(383); 32 | } 33 | 34 | @Override 35 | protected void registerPackets() { 36 | this.registerCreativeInventoryAction(ServerboundPackets1_1.SET_CREATIVE_MODE_SLOT); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/EndBiomeGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 21 | 22 | import java.util.Arrays; 23 | 24 | public class EndBiomeGenerator implements IWorldChunkManager { 25 | 26 | private static final byte[] END_BIOME_DATA; 27 | 28 | static { 29 | END_BIOME_DATA = new byte[256]; 30 | Arrays.fill(END_BIOME_DATA, (byte) NewBiomeGenBase.sky.biomeID); 31 | } 32 | 33 | @Override 34 | public byte[] getBiomeDataAt(int chunkX, int chunkZ) { 35 | return END_BIOME_DATA; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/IWorldChunkManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome; 19 | 20 | public interface IWorldChunkManager { 21 | 22 | byte[] getBiomeDataAt(int chunkX, int chunkZ); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/NetherBiomeGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 21 | 22 | import java.util.Arrays; 23 | 24 | public class NetherBiomeGenerator implements IWorldChunkManager { 25 | 26 | private static final byte[] NETHER_BIOME_DATA; 27 | 28 | static { 29 | NETHER_BIOME_DATA = new byte[256]; 30 | Arrays.fill(NETHER_BIOME_DATA, (byte) NewBiomeGenBase.hell.biomeID); 31 | } 32 | 33 | @Override 34 | public byte[] getBiomeDataAt(int chunkX, int chunkZ) { 35 | return NETHER_BIOME_DATA; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/PlainsBiomeGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 21 | 22 | import java.util.Arrays; 23 | 24 | public class PlainsBiomeGenerator implements IWorldChunkManager { 25 | 26 | private static final byte[] PLAINS_BIOME_DATA; 27 | 28 | static { 29 | PLAINS_BIOME_DATA = new byte[256]; 30 | Arrays.fill(PLAINS_BIOME_DATA, (byte) NewBiomeGenBase.plains.biomeID); 31 | } 32 | 33 | @Override 34 | public byte[] getBiomeDataAt(int chunkX, int chunkZ) { 35 | return PLAINS_BIOME_DATA; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/BiomeCacheBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release; 19 | 20 | public class BiomeCacheBlock { 21 | 22 | public NewBiomeGenBase[] biomes; 23 | public int xPosition; 24 | public int zPosition; 25 | public long lastAccessTime; 26 | final BiomeCache biomeCache; 27 | 28 | public BiomeCacheBlock(BiomeCache biomecache, int i, int j) { 29 | biomeCache = biomecache; 30 | 31 | biomes = new NewBiomeGenBase[256]; 32 | xPosition = i; 33 | zPosition = j; 34 | BiomeCache.getWorldChunkManager(biomecache).getBiomeGenAt(biomes, i << 4, j << 4, 16, 16, false); 35 | } 36 | 37 | public NewBiomeGenBase getBiomeGenAt(int i, int j) { 38 | return biomes[i & 0xf | (j & 0xf) << 4]; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/IntCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release; 19 | 20 | public class IntCache { 21 | 22 | private static final ThreadLocal INT_CACHE = ThreadLocal.withInitial(IntCacheInstance::new); 23 | 24 | public static int[] getIntCache(int i) { 25 | return INT_CACHE.get().getIntCache(i); 26 | } 27 | 28 | public static void resetIntCache() { 29 | INT_CACHE.get().resetIntCache(); 30 | } 31 | 32 | public static void resetEverything() { 33 | INT_CACHE.get().resetEverything(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerDownfall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerDownfall extends GenLayer { 24 | public GenLayerDownfall(GenLayer genlayer) { 25 | super(0L); 26 | parent = genlayer; 27 | } 28 | 29 | public int[] getInts(int i, int j, int k, int l) { 30 | int[] ai = parent.getInts(i, j, k, l); 31 | int[] ai1 = IntCache.getIntCache(k * l); 32 | for (int i1 = 0; i1 < k * l; i1++) { 33 | ai1[i1] = NewBiomeGenBase.BIOME_LIST[ai[i1]].getIntRainfall(); 34 | } 35 | 36 | return ai1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerDownfallMix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerDownfallMix extends GenLayer { 24 | private final GenLayer field_35507_b; 25 | private final int field_35508_c; 26 | 27 | public GenLayerDownfallMix(GenLayer genlayer, GenLayer genlayer1, int i) { 28 | super(0L); 29 | parent = genlayer1; 30 | field_35507_b = genlayer; 31 | field_35508_c = i; 32 | } 33 | 34 | public int[] getInts(int i, int j, int k, int l) { 35 | int[] ai = parent.getInts(i, j, k, l); 36 | int[] ai1 = field_35507_b.getInts(i, j, k, l); 37 | int[] ai2 = IntCache.getIntCache(k * l); 38 | for (int i1 = 0; i1 < k * l; i1++) { 39 | ai2[i1] = ai1[i1] + (NewBiomeGenBase.BIOME_LIST[ai[i1]].getIntRainfall() - ai1[i1]) / (field_35508_c + 1); 40 | } 41 | 42 | return ai2; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerRiverInit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | 22 | public class GenLayerRiverInit extends GenLayer { 23 | public GenLayerRiverInit(long l, GenLayer genlayer) { 24 | super(l); 25 | parent = genlayer; 26 | } 27 | 28 | public int[] getInts(int i, int j, int k, int l) { 29 | int[] ai = parent.getInts(i, j, k, l); 30 | int[] ai1 = IntCache.getIntCache(k * l); 31 | for (int i1 = 0; i1 < l; i1++) { 32 | for (int j1 = 0; j1 < k; j1++) { 33 | initChunkSeed(j1 + i, i1 + j); 34 | ai1[j1 + i1 * k] = ai[j1 + i1 * k] <= 0 ? 0 : nextInt(2) + 2; 35 | } 36 | } 37 | 38 | return ai1; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerSwampRivers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerSwampRivers extends GenLayer { 24 | public GenLayerSwampRivers(long l, GenLayer genlayer) { 25 | super(l); 26 | parent = genlayer; 27 | } 28 | 29 | public int[] getInts(int i, int j, int k, int l) { 30 | int[] ai = parent.getInts(i - 1, j - 1, k + 2, l + 2); 31 | int[] ai1 = IntCache.getIntCache(k * l); 32 | for (int i1 = 0; i1 < l; i1++) { 33 | for (int j1 = 0; j1 < k; j1++) { 34 | initChunkSeed(j1 + i, i1 + j); 35 | int k1 = ai[j1 + 1 + (i1 + 1) * (k + 2)]; 36 | if (k1 == NewBiomeGenBase.swampland.biomeID && nextInt(6) == 0) { 37 | ai1[j1 + i1 * k] = NewBiomeGenBase.river.biomeID; 38 | } else { 39 | ai1[j1 + i1 * k] = k1; 40 | } 41 | } 42 | } 43 | 44 | return ai1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerTemperature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerTemperature extends GenLayer { 24 | public GenLayerTemperature(GenLayer genlayer) { 25 | super(0L); 26 | parent = genlayer; 27 | } 28 | 29 | public int[] getInts(int i, int j, int k, int l) { 30 | int[] ai = parent.getInts(i, j, k, l); 31 | int[] ai1 = IntCache.getIntCache(k * l); 32 | for (int i1 = 0; i1 < k * l; i1++) { 33 | ai1[i1] = NewBiomeGenBase.BIOME_LIST[ai[i1]].getIntTemperature(); 34 | } 35 | 36 | return ai1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerTemperatureMix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerTemperatureMix extends GenLayer { 24 | private final GenLayer field_35505_b; 25 | private final int field_35506_c; 26 | 27 | public GenLayerTemperatureMix(GenLayer genlayer, GenLayer genlayer1, int i) { 28 | super(0L); 29 | parent = genlayer1; 30 | field_35505_b = genlayer; 31 | field_35506_c = i; 32 | } 33 | 34 | public int[] getInts(int i, int j, int k, int l) { 35 | int[] ai = parent.getInts(i, j, k, l); 36 | int[] ai1 = field_35505_b.getInts(i, j, k, l); 37 | int[] ai2 = IntCache.getIntCache(k * l); 38 | for (int i1 = 0; i1 < k * l; i1++) { 39 | ai2[i1] = ai1[i1] + (NewBiomeGenBase.BIOME_LIST[ai[i1]].getIntTemperature() - ai1[i1]) / (field_35506_c * 2 + 1); 40 | } 41 | 42 | return ai2; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/GenLayerVillageLandscape_b1_8.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.NewBiomeGenBase; 22 | 23 | public class GenLayerVillageLandscape_b1_8 extends GenLayer { 24 | private final NewBiomeGenBase[] allowedBiomes; 25 | 26 | public GenLayerVillageLandscape_b1_8(long l, GenLayer genlayer) { 27 | super(l); 28 | allowedBiomes = (new NewBiomeGenBase[] 29 | { 30 | NewBiomeGenBase.desert, NewBiomeGenBase.forest, NewBiomeGenBase.extremeHills, NewBiomeGenBase.swampland, NewBiomeGenBase.plains, NewBiomeGenBase.taiga 31 | }); 32 | parent = genlayer; 33 | } 34 | 35 | public int[] getInts(int i, int j, int k, int l) { 36 | int[] ai = parent.getInts(i, j, k, l); 37 | int[] ai1 = IntCache.getIntCache(k * l); 38 | for (int i1 = 0; i1 < l; i1++) { 39 | for (int j1 = 0; j1 < k; j1++) { 40 | initChunkSeed(j1 + i, i1 + j); 41 | ai1[j1 + i1 * k] = ai[j1 + i1 * k] <= 0 ? 0 : allowedBiomes[nextInt(allowedBiomes.length)].biomeID; 42 | } 43 | } 44 | 45 | return ai1; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/biome/release/genlayer/LayerIsland.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.genlayer; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.release.IntCache; 21 | 22 | public class LayerIsland extends GenLayer { 23 | public LayerIsland(long l) { 24 | super(l); 25 | } 26 | 27 | public int[] getInts(int i, int j, int k, int l) { 28 | int[] ai = IntCache.getIntCache(k * l); 29 | for (int i1 = 0; i1 < l; i1++) { 30 | for (int j1 = 0; j1 < k; j1++) { 31 | initChunkSeed(i + j1, j + i1); 32 | ai[j1 + i1 * k] = nextInt(10) != 0 ? 0 : 1; 33 | } 34 | } 35 | 36 | if (i > -k && i <= 0 && j > -l && j <= 0) { 37 | ai[-i + -j * k] = 1; 38 | } 39 | return ai; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/model/LegacyNibbleArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.model; 19 | 20 | import com.viaversion.viaversion.api.minecraft.chunks.NibbleArray; 21 | 22 | public class LegacyNibbleArray extends NibbleArray { 23 | 24 | private final int depthBits; 25 | private final int depthBitsPlusFour; 26 | 27 | public LegacyNibbleArray(final int length) { 28 | this(length, 7); 29 | } 30 | 31 | public LegacyNibbleArray(final byte[] handle) { 32 | this(handle, 7); 33 | } 34 | 35 | public LegacyNibbleArray(final int length, final int depthBits) { 36 | super(length); 37 | this.depthBits = depthBits; 38 | this.depthBitsPlusFour = depthBits + 4; 39 | } 40 | 41 | public LegacyNibbleArray(final byte[] handle, final int depthBits) { 42 | super(handle); 43 | this.depthBits = depthBits; 44 | this.depthBitsPlusFour = depthBits + 4; 45 | } 46 | 47 | @Override 48 | public byte get(int x, int y, int z) { 49 | return this.get(this.index(x, y, z)); 50 | } 51 | 52 | @Override 53 | public void set(int x, int y, int z, int value) { 54 | this.set(this.index(x, y, z), value); 55 | } 56 | 57 | public int index(final int x, final int y, final int z) { 58 | return x << this.depthBitsPlusFour | z << this.depthBits | y; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/model/PendingBlockEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.model; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockPosition; 21 | import com.viaversion.viaversion.util.IdAndData; 22 | 23 | public class PendingBlockEntry { 24 | 25 | private final BlockPosition position; 26 | private final IdAndData block; 27 | private int countdown = 80; 28 | 29 | public PendingBlockEntry(final BlockPosition position, final IdAndData block) { 30 | this.position = position; 31 | this.block = block; 32 | } 33 | 34 | public BlockPosition getPosition() { 35 | return this.position; 36 | } 37 | 38 | public IdAndData getBlock() { 39 | return this.block; 40 | } 41 | 42 | public boolean decrementAndCheckIsExpired() { 43 | return --this.countdown <= 0; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.Protocolr1_1Tor1_2_1_3; 22 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.packet.ClientboundPackets1_1; 23 | import net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.packet.ServerboundPackets1_2_1; 24 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_1Tor1_2_1_3 protocol) { 29 | super(protocol, "1.1", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); 30 | 31 | this.addNonExistentItem(6, 3); 32 | this.addNonExistentItem(17, 3); 33 | this.addNonExistentItem(18, 3); 34 | this.addNonExistentItem(98, 3); 35 | this.addNonExistentItemRange(123, 124); 36 | this.addNonExistentItemRange(384, 385); 37 | this.addNonExistentItem(383, 98); 38 | } 39 | 40 | @Override 41 | protected void registerPackets() { 42 | this.registerCreativeInventoryAction(ServerboundPackets1_2_1.SET_CREATIVE_MODE_SLOT); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/storage/SeedStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.biome.IWorldChunkManager; 22 | 23 | public class SeedStorage implements StorableObject { 24 | 25 | public long seed; 26 | public IWorldChunkManager worldChunkManager; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/task/BlockReceiveInvalidatorTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.task; 19 | 20 | import com.viaversion.viaversion.api.Via; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.storage.PendingBlocksTracker; 23 | 24 | public class BlockReceiveInvalidatorTask implements Runnable { 25 | 26 | @Override 27 | public void run() { 28 | for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) { 29 | final PendingBlocksTracker pendingBlocksTracker = info.get(PendingBlocksTracker.class); 30 | if (pendingBlocksTracker != null) { 31 | info.getChannel().eventLoop().submit(pendingBlocksTracker::tick); 32 | } 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_1tor1_2_1_3/types/Types1_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; 21 | import com.viaversion.viaversion.api.minecraft.chunks.Chunk; 22 | import com.viaversion.viaversion.api.type.Type; 23 | 24 | public class Types1_1 { 25 | 26 | public static Type BLOCK_CHANGE_RECORD_ARRAY = new BlockChangeRecordArrayType(); 27 | public static Type CHUNK = new ChunkType(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_1_3tor1_2_4_5/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.Protocolr1_2_1_3Tor1_2_4_5; 22 | import net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.packet.ClientboundPackets1_2_1; 23 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.packet.ServerboundPackets1_2_4; 24 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_2_1_3Tor1_2_4_5 protocol) { 29 | super(protocol, "1.2.3", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); 30 | 31 | this.addNonExistentItem(5, 1, 3); 32 | this.addNonExistentItem(24, 1, 2); 33 | } 34 | 35 | @Override 36 | protected void registerPackets() { 37 | this.registerCreativeInventoryAction(ServerboundPackets1_2_4.SET_CREATIVE_MODE_SLOT); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/data/sound/SoundType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.data.sound; 19 | 20 | public enum SoundType { 21 | 22 | IDLE, HURT, DEATH 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/model/ConfiguredSound.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.model; 19 | 20 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.data.sound.Sound; 21 | 22 | public class ConfiguredSound { 23 | 24 | private Sound sound; 25 | private float volume; 26 | private float pitch; 27 | 28 | public ConfiguredSound(Sound sound, float volume, float pitch) { 29 | this.sound = sound; 30 | this.volume = volume; 31 | this.pitch = pitch; 32 | } 33 | 34 | public Sound getSound() { 35 | return sound; 36 | } 37 | 38 | public void setSound(Sound sound) { 39 | this.sound = sound; 40 | } 41 | 42 | public float getVolume() { 43 | return volume; 44 | } 45 | 46 | public void setVolume(float volume) { 47 | this.volume = volume; 48 | } 49 | 50 | public float getPitch() { 51 | return pitch; 52 | } 53 | 54 | public void setPitch(float pitch) { 55 | this.pitch = pitch; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/model/TrackedEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.model; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8; 21 | import net.raphimc.vialegacy.api.model.Location; 22 | 23 | public class TrackedEntity extends AbstractTrackedEntity { 24 | 25 | public TrackedEntity(int entityId, Location location, EntityTypes1_8.EntityType entityType) { 26 | super(entityId, location, entityType); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/provider/OldAuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.platform.providers.Provider; 22 | 23 | public class OldAuthProvider implements Provider { 24 | 25 | public void sendAuthRequest(final UserConnection user, final String serverId) throws Throwable { 26 | throw new IllegalStateException("Online mode auth is not implemented!"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.Protocolr1_2_4_5Tor1_3_1_2; 22 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.packet.ClientboundPackets1_2_4; 23 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4; 24 | import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.packet.ServerboundPackets1_3_1; 25 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 26 | 27 | public class ItemRewriter extends LegacyItemRewriter { 28 | 29 | public ItemRewriter(final Protocolr1_2_4_5Tor1_3_1_2 protocol) { 30 | super(protocol, "1.2.5", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY, Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); 31 | 32 | this.addNonExistentItemRange(126, 136); 33 | this.addNonExistentItem(322, 1); 34 | this.addNonExistentItemRange(386, 388); 35 | } 36 | 37 | @Override 38 | protected void registerPackets() { 39 | this.registerCreativeInventoryAction(ServerboundPackets1_3_1.SET_CREATIVE_MODE_SLOT); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/task/EntityTrackerTickTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.task; 19 | 20 | import com.viaversion.viaversion.api.Via; 21 | import com.viaversion.viaversion.api.connection.UserConnection; 22 | import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.storage.EntityTracker; 23 | 24 | public class EntityTrackerTickTask implements Runnable { 25 | 26 | @Override 27 | public void run() { 28 | for (UserConnection info : Via.getManager().getConnectionManager().getConnections()) { 29 | final EntityTracker entityTracker = info.get(EntityTracker.class); 30 | if (entityTracker != null) { 31 | info.getChannel().eventLoop().submit(entityTracker::tick); 32 | } 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/types/ChunkType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.chunks.Chunk; 21 | import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; 22 | import io.netty.buffer.ByteBuf; 23 | 24 | public class ChunkType extends net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.ChunkType { 25 | 26 | public ChunkType() { 27 | super(true); 28 | } 29 | 30 | @Override 31 | protected void readUnusedInt(ByteBuf byteBuf) { 32 | byteBuf.readInt(); 33 | } 34 | 35 | @Override 36 | protected void writeUnusedInt(ByteBuf byteBuf, Chunk chunk) { 37 | byteBuf.writeInt(0); 38 | } 39 | 40 | @Override 41 | public void write(ByteBuf byteBuf, Chunk chunk) { 42 | for (ChunkSection section : chunk.getSections()) { 43 | if (section != null && !section.getLight().hasSkyLight()) { 44 | throw new IllegalStateException("Chunk section does not have skylight"); 45 | } 46 | } 47 | 48 | super.write(byteBuf, chunk); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_2_4_5tor1_3_1_2/types/Types1_2_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.chunks.Chunk; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.ItemArrayType; 24 | 25 | public class Types1_2_4 { 26 | 27 | public static final Type NBT_ITEM = new ItemType(); 28 | public static final Type NBT_ITEM_ARRAY = new ItemArrayType<>(NBT_ITEM); 29 | 30 | public static final Type CHUNK = new ChunkType(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_3_1_2tor1_4_2/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypes1_3_1.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_3_1_2tor1_4_2/types/EntityDataTypes1_3_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.Types; 23 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types.Types1_6_4; 24 | 25 | public enum EntityDataTypes1_3_1 implements EntityDataType { 26 | 27 | BYTE(0, Types.BYTE), 28 | SHORT(1, Types.SHORT), 29 | INT(2, Types.INT), 30 | FLOAT(3, Types.FLOAT), 31 | STRING(4, Types1_6_4.STRING), 32 | ITEM(5, Types1_3_1.NBTLESS_ITEM), 33 | BLOCK_POSITION(6, Types.VECTOR); 34 | 35 | private final int typeID; 36 | private final Type type; 37 | 38 | EntityDataTypes1_3_1(int typeID, Type type) { 39 | this.typeID = typeID; 40 | this.type = type; 41 | } 42 | 43 | public static EntityDataTypes1_3_1 byId(int id) { 44 | return values()[id]; 45 | } 46 | 47 | public int typeId() { 48 | return this.typeID; 49 | } 50 | 51 | public Type type() { 52 | return this.type; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_3_1_2tor1_4_2/types/NbtLessItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.DataItem; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import io.netty.buffer.ByteBuf; 24 | 25 | public class NbtLessItemType extends Type { 26 | 27 | public NbtLessItemType() { 28 | super(Item.class); 29 | } 30 | 31 | public Item read(ByteBuf buffer) { 32 | final short id = buffer.readShort(); 33 | final byte amount = buffer.readByte(); 34 | final short data = buffer.readShort(); 35 | if (id < 0) { 36 | return null; 37 | } 38 | 39 | final Item item = new DataItem(); 40 | item.setIdentifier(id); 41 | item.setAmount(amount); 42 | item.setData(data); 43 | return item; 44 | } 45 | 46 | public void write(ByteBuf buffer, Item item) { 47 | if (item == null) { 48 | buffer.writeShort(-1); 49 | buffer.writeByte(0); 50 | buffer.writeShort(0); 51 | } else { 52 | buffer.writeShort(item.identifier()); 53 | buffer.writeByte(item.amount()); 54 | buffer.writeShort(item.data()); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_3_1_2tor1_4_2/types/Types1_3_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; 24 | 25 | import java.util.List; 26 | 27 | public class Types1_3_1 { 28 | 29 | public static final Type NBTLESS_ITEM = new NbtLessItemType(); 30 | 31 | public static final Type ENTITY_DATA = new EntityDataType(); 32 | public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.Protocolr1_4_2Tor1_4_4_5; 22 | import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.packet.ClientboundPackets1_4_2; 23 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ServerboundPackets1_5_2; 24 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_4_2Tor1_4_4_5 protocol) { 29 | super(protocol, "1.4.2", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); 30 | 31 | this.addNonExistentItems(2267); 32 | } 33 | 34 | @Override 35 | protected void registerPackets() { 36 | this.registerCreativeInventoryAction(ServerboundPackets1_5_2.SET_CREATIVE_MODE_SLOT); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypes1_4_2.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/types/EntityDataTypes1_4_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.Types; 23 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types.Types1_6_4; 24 | 25 | public enum EntityDataTypes1_4_2 implements EntityDataType { 26 | 27 | BYTE(0, Types.BYTE), 28 | SHORT(1, Types.SHORT), 29 | INT(2, Types.INT), 30 | FLOAT(3, Types.FLOAT), 31 | STRING(4, Types1_6_4.STRING), 32 | ITEM(5, Types1_4_2.NBTLESS_ITEM), 33 | BLOCK_POSITION(6, Types.VECTOR); 34 | 35 | private final int typeID; 36 | private final Type type; 37 | 38 | EntityDataTypes1_4_2(int typeID, Type type) { 39 | this.typeID = typeID; 40 | this.type = type; 41 | } 42 | 43 | public static EntityDataTypes1_4_2 byId(int id) { 44 | return values()[id]; 45 | } 46 | 47 | public int typeId() { 48 | return this.typeID; 49 | } 50 | 51 | public Type type() { 52 | return this.type; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/types/NbtLessItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.DataItem; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import io.netty.buffer.ByteBuf; 24 | 25 | public class NbtLessItemType extends Type { 26 | 27 | public NbtLessItemType() { 28 | super(Item.class); 29 | } 30 | 31 | public Item read(ByteBuf buffer) { 32 | final short id = buffer.readShort(); 33 | if (id < 0) { 34 | return null; 35 | } 36 | 37 | final Item item = new DataItem(); 38 | item.setIdentifier(id); 39 | item.setAmount(buffer.readByte()); 40 | item.setData(buffer.readShort()); 41 | return item; 42 | } 43 | 44 | public void write(ByteBuf buffer, Item item) { 45 | if (item == null) { 46 | buffer.writeShort(-1); 47 | } else { 48 | buffer.writeShort(item.identifier()); 49 | buffer.writeByte(item.amount()); 50 | buffer.writeShort(item.data()); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/types/Types1_4_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; 24 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.ItemArrayType; 25 | 26 | import java.util.List; 27 | 28 | public class Types1_4_2 { 29 | 30 | public static final Type UNSIGNED_BYTE_BYTE_ARRAY = new UnsignedByteByteArrayType(); 31 | 32 | public static final Type NBTLESS_ITEM = new NbtLessItemType(); 33 | public static final Type NBTLESS_ITEM_ARRAY = new ItemArrayType<>(NBTLESS_ITEM); 34 | 35 | public static final Type ENTITY_DATA = new EntityDataType(); 36 | public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_2tor1_4_4_5/types/UnsignedByteByteArrayType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | 23 | public class UnsignedByteByteArrayType extends Type { 24 | 25 | public UnsignedByteByteArrayType() { 26 | super(byte[].class); 27 | } 28 | 29 | public void write(ByteBuf buffer, byte[] array) { 30 | buffer.writeByte(array.length & 255); 31 | buffer.writeBytes(array); 32 | } 33 | 34 | public byte[] read(ByteBuf buffer) { 35 | final byte[] array = new byte[buffer.readUnsignedByte()]; 36 | buffer.readBytes(array); 37 | return array; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_4_5tor1_4_6_7/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.Protocolr1_4_4_5Tor1_4_6_7; 22 | import net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.packet.ClientboundPackets1_4_4; 23 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ServerboundPackets1_5_2; 24 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_4_4_5Tor1_4_6_7 protocol) { 29 | super(protocol, "1.4.5", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); 30 | 31 | this.addNonExistentItem(43, 6); 32 | this.addNonExistentItem(44, 6); 33 | this.addNonExistentItemRange(401, 403); 34 | } 35 | 36 | @Override 37 | protected void registerPackets() { 38 | this.registerCreativeInventoryAction(ServerboundPackets1_5_2.SET_CREATIVE_MODE_SLOT); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_4_5tor1_4_6_7/types/BulkChunkType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.types; 19 | 20 | import io.netty.buffer.ByteBuf; 21 | 22 | public class BulkChunkType extends net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.BulkChunkType { 23 | 24 | @Override 25 | protected boolean readHasSkyLight(ByteBuf byteBuf) { 26 | return true; 27 | } 28 | 29 | @Override 30 | protected void writeHasSkyLight(ByteBuf byteBuf, boolean hasSkyLight) { 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_4_5tor1_4_6_7/types/Types1_4_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.chunks.Chunk; 21 | import com.viaversion.viaversion.api.type.Type; 22 | 23 | public class Types1_4_4 { 24 | 25 | public static final Type CHUNK_BULK = new BulkChunkType(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_4_6_7tor1_5_0_1/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_4_6_7tor1_5_0_1.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_4_6_7tor1_5_0_1.Protocolr1_4_6_7Tor1_5_0_1; 22 | import net.raphimc.vialegacy.protocol.release.r1_4_6_7tor1_5_0_1.packet.ClientboundPackets1_4_6; 23 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ServerboundPackets1_5_2; 24 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_4_6_7Tor1_5_0_1 protocol) { 29 | super(protocol, "1.4.7", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); 30 | 31 | this.addNonExistentItem(43, 7); 32 | this.addNonExistentItem(44, 7); 33 | this.addNonExistentItemRange(146, 158); 34 | this.addNonExistentItems(178); 35 | this.addNonExistentItemRange(404, 408); 36 | } 37 | 38 | @Override 39 | protected void registerPackets() { 40 | this.registerCreativeInventoryAction(ServerboundPackets1_5_2.SET_CREATIVE_MODE_SLOT); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_5_0_1tor1_5_2/Protocolr1_5_0_1Tor1_5_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_5_0_1tor1_5_2; 19 | 20 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 21 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ClientboundPackets1_5_2; 22 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ServerboundPackets1_5_2; 23 | 24 | public class Protocolr1_5_0_1Tor1_5_2 extends StatelessProtocol { 25 | 26 | public Protocolr1_5_0_1Tor1_5_2() { 27 | super(ClientboundPackets1_5_2.class, ClientboundPackets1_5_2.class, ServerboundPackets1_5_2.class, ServerboundPackets1_5_2.class); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_5_2tor1_6_1/rewriter/ItemRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.rewriter; 19 | 20 | import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; 21 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.Protocolr1_5_2Tor1_6_1; 22 | import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.packet.ClientboundPackets1_5_2; 23 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.packet.ServerboundPackets1_6_4; 24 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 25 | 26 | public class ItemRewriter extends LegacyItemRewriter { 27 | 28 | public ItemRewriter(final Protocolr1_5_2Tor1_6_1 protocol) { 29 | super(protocol, "1.5.2", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); 30 | 31 | this.addNonExistentItems(159); 32 | this.addNonExistentItemRange(170, 173); 33 | this.addNonExistentItem(383, 100); 34 | this.addNonExistentItemRange(417, 421); 35 | } 36 | 37 | @Override 38 | protected void registerPackets() { 39 | this.registerCreativeInventoryAction(ServerboundPackets1_6_4.SET_CREATIVE_MODE_SLOT); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_5_2tor1_6_1/storage/AttachTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class AttachTracker implements StorableObject { 23 | 24 | public int vehicleEntityId = -1; 25 | public boolean lastSneakState = false; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_5_2tor1_6_1/storage/EntityTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8; 22 | 23 | import java.util.Map; 24 | import java.util.concurrent.ConcurrentHashMap; 25 | 26 | public class EntityTracker implements StorableObject { 27 | 28 | private final Map entityMap = new ConcurrentHashMap<>(); 29 | 30 | private int playerID; 31 | 32 | public int getPlayerID() { 33 | return this.playerID; 34 | } 35 | 36 | public void setPlayerID(int playerID) { 37 | this.playerID = playerID; 38 | } 39 | 40 | public void removeEntity(int entityId) { 41 | this.entityMap.remove(entityId); 42 | } 43 | 44 | public Map getTrackedEntities() { 45 | return this.entityMap; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_2tor1_6_4/Protocolr1_6_2Tor1_6_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_2tor1_6_4; 19 | 20 | import net.raphimc.vialegacy.api.protocol.StatelessProtocol; 21 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.packet.ClientboundPackets1_6_4; 22 | import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.packet.ServerboundPackets1_6_4; 23 | 24 | public class Protocolr1_6_2Tor1_6_4 extends StatelessProtocol { 25 | 26 | public Protocolr1_6_2Tor1_6_4() { 27 | super(ClientboundPackets1_6_4.class, ClientboundPackets1_6_4.class, ServerboundPackets1_6_4.class, ServerboundPackets1_6_4.class); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/provider/EncryptionProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider; 19 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; 21 | import com.viaversion.viaversion.api.platform.providers.Provider; 22 | 23 | public abstract class EncryptionProvider implements Provider { 24 | 25 | public abstract void enableDecryption(final UserConnection user); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/storage/HandshakeStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class HandshakeStorage implements StorableObject { 23 | 24 | private final String hostname; 25 | private final int port; 26 | 27 | public HandshakeStorage(final String hostName, final int port) { 28 | this.hostname = hostName; 29 | this.port = port; 30 | } 31 | 32 | public String getHostname() { 33 | return this.hostname; 34 | } 35 | 36 | public int getPort() { 37 | return this.port; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/storage/PlayerInfoStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class PlayerInfoStorage implements StorableObject { 23 | 24 | public int entityId = -1; 25 | public boolean onGround = false; 26 | public double posX = 8; 27 | public double posY = 64; 28 | public double posZ = 8; 29 | public float yaw = -180; 30 | public float pitch = 0; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/storage/ProtocolMetadataStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | public class ProtocolMetadataStorage implements StorableObject { 23 | 24 | public boolean authenticate; 25 | public boolean skipEncryption; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/storage/StatisticsStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; 22 | import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; 23 | 24 | public class StatisticsStorage implements StorableObject { 25 | 26 | public final Int2IntMap values = new Int2IntOpenHashMap(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypes1_6_4.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/types/EntityDataTypes1_6_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.Types; 23 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6; 24 | 25 | public enum EntityDataTypes1_6_4 implements EntityDataType { 26 | 27 | BYTE(0, Types.BYTE), 28 | SHORT(1, Types.SHORT), 29 | INT(2, Types.INT), 30 | FLOAT(3, Types.FLOAT), 31 | STRING(4, Types1_6_4.STRING), 32 | ITEM(5, Types1_7_6.ITEM), 33 | BLOCK_POSITION(6, Types.VECTOR); 34 | 35 | private final int typeID; 36 | private final Type type; 37 | 38 | EntityDataTypes1_6_4(int typeID, Type type) { 39 | this.typeID = typeID; 40 | this.type = type; 41 | } 42 | 43 | public static EntityDataTypes1_6_4 byId(int id) { 44 | return values()[id]; 45 | } 46 | 47 | public int typeId() { 48 | return this.typeID; 49 | } 50 | 51 | public Type type() { 52 | return this.type; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/types/StringType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | 23 | public class StringType extends Type { 24 | 25 | public StringType() { 26 | super(String.class); 27 | } 28 | 29 | public String read(ByteBuf buffer) { 30 | final short length = buffer.readShort(); 31 | final StringBuilder builder = new StringBuilder(); 32 | for (int i = 0; i < length; i++) { 33 | builder.append(buffer.readChar()); 34 | } 35 | return builder.toString(); 36 | } 37 | 38 | public void write(ByteBuf buffer, String s) { 39 | buffer.writeShort(s.length()); 40 | for (char c : s.toCharArray()) { 41 | buffer.writeChar(c); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_6_4tor1_7_2_5/types/Types1_6_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; 23 | 24 | import java.util.List; 25 | 26 | public class Types1_6_4 { 27 | 28 | public static final Type STRING = new StringType(); 29 | 30 | public static final Type ENTITY_DATA = new EntityDataType(); 31 | public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_2_5tor1_7_6_10/packet/ServerboundPackets1_7_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.packet; 19 | 20 | import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; 21 | 22 | public enum ServerboundPackets1_7_2 implements ServerboundPacketType { 23 | 24 | KEEP_ALIVE, // 0x00 25 | CHAT, // 0x01 26 | INTERACT, // 0x02 27 | MOVE_PLAYER_STATUS_ONLY, // 0x03 28 | MOVE_PLAYER_POS, // 0x04 29 | MOVE_PLAYER_ROT, // 0x05 30 | MOVE_PLAYER_POS_ROT, // 0x06 31 | PLAYER_ACTION, // 0x07 32 | USE_ITEM_ON, // 0x08 33 | SET_CARRIED_ITEM, // 0x09 34 | SWING, // 0x0A 35 | PLAYER_COMMAND, // 0x0B 36 | PLAYER_INPUT, // 0x0C 37 | CONTAINER_CLOSE, // 0x0D 38 | CONTAINER_CLICK, // 0x0E 39 | CONTAINER_ACK, // 0x0F 40 | SET_CREATIVE_MODE_SLOT, // 0x10 41 | CONTAINER_BUTTON_CLICK, // 0x11 42 | SIGN_UPDATE, // 0x12 43 | PLAYER_ABILITIES, // 0x13 44 | COMMAND_SUGGESTION, // 0x14 45 | CLIENT_INFORMATION, // 0x15 46 | CLIENT_COMMAND, // 0x16 47 | CUSTOM_PAYLOAD; // 0x17 48 | 49 | @Override 50 | public int getId() { 51 | return ordinal(); 52 | } 53 | 54 | @Override 55 | public String getName() { 56 | return name(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/model/MapData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.model; 19 | 20 | public class MapData { 21 | 22 | public byte scale = 0; 23 | public MapIcon[] mapIcons = new MapIcon[0]; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/model/MapIcon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.model; 19 | 20 | public class MapIcon { 21 | 22 | public byte direction; 23 | public byte type; 24 | public byte x; 25 | public byte z; 26 | 27 | public MapIcon(final byte direction, final byte type, final byte x, final byte z) { 28 | this.direction = direction; 29 | this.type = type; 30 | this.x = x; 31 | this.z = z; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/model/TabListEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.model; 19 | 20 | import com.viaversion.viaversion.api.minecraft.GameProfile; 21 | 22 | import java.nio.charset.StandardCharsets; 23 | import java.util.UUID; 24 | 25 | public class TabListEntry { 26 | 27 | public GameProfile gameProfile; 28 | public int ping; 29 | public int gameMode; 30 | 31 | public boolean resolved; 32 | 33 | public TabListEntry(final String name, final UUID uuid) { 34 | this(new GameProfile(name, uuid)); 35 | } 36 | 37 | public TabListEntry(final GameProfile gameProfile) { 38 | this.gameProfile = gameProfile; 39 | this.resolved = true; 40 | } 41 | 42 | public TabListEntry(final String name, final short ping) { 43 | this.gameProfile = new GameProfile(name, UUID.nameUUIDFromBytes(("LegacyPlayer:" + name).getBytes(StandardCharsets.UTF_8))); 44 | this.ping = ping; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/storage/MapStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; 22 | import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; 23 | import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.model.MapData; 24 | 25 | public class MapStorage implements StorableObject { 26 | 27 | private final Int2ObjectMap maps = new Int2ObjectOpenHashMap<>(); 28 | 29 | public MapData getMapData(final int id) { 30 | return this.maps.get(id); 31 | } 32 | 33 | public void putMapData(final int id, final MapData mapData) { 34 | this.maps.put(id, mapData); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/storage/WindowTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.storage; 19 | 20 | import com.viaversion.viaversion.api.connection.StorableObject; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | public class WindowTracker implements StorableObject { 26 | 27 | public final Map types = new HashMap<>(); 28 | 29 | public short get(short windowId) { 30 | return types.getOrDefault(windowId, (short) -1); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/BlockPositionVarYType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.BlockPosition; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import io.netty.buffer.ByteBuf; 23 | 24 | import java.util.function.IntFunction; 25 | 26 | public class BlockPositionVarYType extends Type { 27 | 28 | private final Type yType; 29 | private final IntFunction yConverter; 30 | 31 | public BlockPositionVarYType(final Type yType, final IntFunction yConverter) { 32 | super(BlockPosition.class); 33 | this.yType = yType; 34 | this.yConverter = yConverter; 35 | } 36 | 37 | @Override 38 | public BlockPosition read(ByteBuf buffer) { 39 | return new BlockPosition(buffer.readInt(), this.yType.read(buffer).intValue(), buffer.readInt()); 40 | } 41 | 42 | @Override 43 | public void write(ByteBuf buffer, BlockPosition position) { 44 | buffer.writeInt(position.x()); 45 | this.yType.write(buffer, this.yConverter.apply(position.y())); 46 | buffer.writeInt(position.z()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/EntityDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType; 21 | 22 | public class EntityDataType extends OldEntityDataType { 23 | 24 | @Override 25 | protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) { 26 | return EntityDataTypes1_7_6.byId(index); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/EntityDataTypes1_7_6.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import com.viaversion.viaversion.api.type.Types; 23 | 24 | public enum EntityDataTypes1_7_6 implements EntityDataType { 25 | 26 | BYTE(0, Types.BYTE), 27 | SHORT(1, Types.SHORT), 28 | INT(2, Types.INT), 29 | FLOAT(3, Types.FLOAT), 30 | STRING(4, Types.STRING), 31 | ITEM(5, Types1_7_6.ITEM), 32 | BLOCK_POSITION(6, Types.VECTOR); 33 | 34 | private final int typeID; 35 | private final Type type; 36 | 37 | EntityDataTypes1_7_6(int typeID, Type type) { 38 | this.typeID = typeID; 39 | this.type = type; 40 | } 41 | 42 | public static EntityDataTypes1_7_6 byId(int id) { 43 | return values()[id]; 44 | } 45 | 46 | public int typeId() { 47 | return this.typeID; 48 | } 49 | 50 | public Type type() { 51 | return this.type; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/IntArrayType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.type.Type; 21 | import io.netty.buffer.ByteBuf; 22 | 23 | public class IntArrayType extends Type { 24 | 25 | public IntArrayType() { 26 | super(int[].class); 27 | } 28 | 29 | @Override 30 | public int[] read(ByteBuf buffer) { 31 | final byte length = buffer.readByte(); 32 | final int[] array = new int[length]; 33 | 34 | for (byte i = 0; i < length; i++) { 35 | array[i] = buffer.readInt(); 36 | } 37 | return array; 38 | } 39 | 40 | @Override 41 | public void write(ByteBuf buffer, int[] array) { 42 | buffer.writeByte(array.length); 43 | for (int i : array) buffer.writeInt(i); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/ItemArrayType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.Item; 21 | import com.viaversion.viaversion.api.type.Type; 22 | import io.netty.buffer.ByteBuf; 23 | 24 | public class ItemArrayType extends Type { 25 | 26 | private final Type itemType; 27 | 28 | public ItemArrayType(final Type itemType) { 29 | super(Item[].class); 30 | this.itemType = itemType; 31 | } 32 | 33 | @Override 34 | public Item[] read(ByteBuf buffer) { 35 | final int amount = buffer.readShort(); 36 | final Item[] items = new Item[amount]; 37 | 38 | for (int i = 0; i < amount; i++) { 39 | items[i] = this.itemType.read(buffer); 40 | } 41 | return items; 42 | } 43 | 44 | @Override 45 | public void write(ByteBuf buffer, Item[] items) { 46 | buffer.writeShort(items.length); 47 | for (Item item : items) { 48 | this.itemType.write(buffer, (T) item); 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/net/raphimc/vialegacy/protocol/release/r1_7_6_10tor1_8/types/ItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy 3 | * Copyright (C) 2020-2025 RK_01/RaphiMC and contributors 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types; 19 | 20 | import com.viaversion.viaversion.api.minecraft.item.DataItem; 21 | import com.viaversion.viaversion.api.minecraft.item.Item; 22 | import com.viaversion.viaversion.api.type.Type; 23 | import io.netty.buffer.ByteBuf; 24 | 25 | public class ItemType extends Type { 26 | 27 | public ItemType() { 28 | super(Item.class); 29 | } 30 | 31 | @Override 32 | public Item read(ByteBuf buffer) { 33 | final short id = buffer.readShort(); 34 | if (id < 0) { 35 | return null; 36 | } 37 | 38 | final Item item = new DataItem(); 39 | item.setIdentifier(id); 40 | item.setAmount(buffer.readByte()); 41 | item.setData(buffer.readShort()); 42 | item.setTag(Types1_7_6.NBT.read(buffer)); 43 | return item; 44 | } 45 | 46 | @Override 47 | public void write(ByteBuf buffer, Item item) { 48 | if (item == null) { 49 | buffer.writeShort(-1); 50 | } else { 51 | buffer.writeShort(item.identifier()); 52 | buffer.writeByte(item.amount()); 53 | buffer.writeShort(item.data()); 54 | Types1_7_6.NBT.write(buffer, item.tag()); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/resources/assets/vialegacy/vialegacy.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Calculate 1.7.10 OnGround field dynamically. Requires a bit of extra caching 3 | dynamic-onground: true 4 | # 5 | # Ignores serverbound plugin channel messages of 1.8+ clients with channel names longer than 16 characters 6 | # CraftBukkit had this limit hardcoded until 1.8 7 | ignore-long-1_8-channel-names: true 8 | # 9 | # Load <= 1.7.2 player skull skins 10 | legacy-skull-loading: false 11 | # 12 | # Load <= 1.6.4 skins. (Adds max 500ms delay to player spawn packets) 13 | legacy-skin-loading: false 14 | # 15 | # Emulate sounds for <= 1.2.5 16 | sound-emulation: true 17 | # 18 | # Calculate <= 1.1 biomes. Requires a lot of extra calculations 19 | old-biomes: true 20 | # 21 | # Enables sprinting for versions below beta 1.8. !THIS CAN CAUSE ISSUES WITH ANTI-CHEAT PLUGINS! 22 | enable-b1_7_3-sprinting: false 23 | # 24 | # The MOTD to use for <= beta 1.7.3 servers. Supports newlines. Doesn't support color codes. 25 | b1_7_3-motd: | 26 | The server seems to be running! 27 | Wait 5 seconds between each connection 28 | # 29 | # Classic chunk loading range 30 | classic-chunk-range: 10 31 | # 32 | # Enable fly on regular (non CPE) classic servers 33 | enable-classic-fly: false 34 | --------------------------------------------------------------------------------