Skip to content

Commit

Permalink
fix packet radius issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nthxny committed Jul 8, 2023
1 parent d031312 commit f4211f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Java CI with Gradle
name: Gradle Package

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
- { uses: actions/checkout@v2, with: { fetch-depth: 0 } }
- name: "Set up JDK 17"
uses: actions/setup-java@v2
with: { distribution: "adopt", java-version: "17" }

- name: "Build with Gradle"
id: build
run: "chmod +x gradlew && ./gradlew build publish"

- uses: Kir-Antipov/[email protected]
with:
curseforge-id: 558905
curseforge-token: ${{ secrets.CF_API_TOKEN }}
loaders: |
forge
game-versions: |
1.20.1
java: |
17
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ private void onUnload(ClientboundForgetLevelChunkPacket packet, CallbackInfo ci)

@Redirect(method = {"handleSetChunkCacheRadius"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/game/ClientboundSetChunkCacheRadiusPacket;getRadius()I"))
private int onViewDistChange(ClientboundSetChunkCacheRadiusPacket sUpdateViewDistancePacket) {
return Minecraft.getInstance().options.renderDistance().get();
return Math.max(sUpdateViewDistancePacket.getRadius(), Minecraft.getInstance().options.renderDistance().get());
}

@Redirect(method = {"handleLogin"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/game/ClientboundLoginPacket;chunkRadius()I"))
private int onJoinGame(ClientboundLoginPacket sJoinGamePacket) {
return Minecraft.getInstance().options.renderDistance().get();
return Math.max(sJoinGamePacket.chunkRadius(), Minecraft.getInstance().options.renderDistance().get());
}
}

0 comments on commit f4211f5

Please sign in to comment.