Skip to content

Commit

Permalink
Port to 1.21
Browse files Browse the repository at this point in the history
- Bumped dependency versions.
- Updated `CommonListenerCookie` constructor args and added comments.
- Updated fabric's 'show player' mixin to include the new `DeltaTracker`.
  • Loading branch information
MattSturgeon committed Jun 13, 2024
1 parent 75e0643 commit 1c13517
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and Freecam's versioning is based on [Semantic Versioning](https://semver.org/sp

### Added

- 1.21 Support ([#222](https://github.com/MinecraftFreecam/Freecam/pull/222)).
- 1.20.6 Support ([#223](https://github.com/MinecraftFreecam/Freecam/pull/223)).

### Changed
Expand Down
17 changes: 16 additions & 1 deletion common/src/main/java/net/xolt/freecam/util/FreeCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.ServerLinks;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -33,16 +34,30 @@ public class FreeCamera extends LocalPlayer {
MC,
MC.getConnection().getConnection(),
new CommonListenerCookie(
// localGameProfile
new GameProfile(UUID.randomUUID(), "FreeCamera"),
// worldSessionTelemetryManager
MC.getTelemetryManager().createWorldSessionManager(false, null, null),
// receivedRegistries
RegistryAccess.Frozen.EMPTY,
// enabledFeatures
FeatureFlagSet.of(),
// serverBrand
null,
// serverData
MC.getCurrentServer(),
// postDisconnectScreen
MC.screen,
// serverCookies
Collections.emptyMap(),
// chatState
MC.gui.getChat().storeState(),
false)) {
// strictErrorHandling
false,
// customReportDetails
Collections.emptyMap(),
// serverLinks
ServerLinks.EMPTY)) {
@Override
public void send(Packet<?> packet) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.util.profiling.ProfilerFiller;
Expand All @@ -27,21 +28,21 @@ public abstract class LevelRendererMixin {

@Shadow @Final private RenderBuffers renderBuffers;

@Shadow private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers) {}
@Shadow protected abstract void renderEntity(Entity entity, double camX, double camY, double camZ, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource);

// Makes the player render if showPlayer is enabled.
@Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;checkPoseStack(Lcom/mojang/blaze3d/vertex/PoseStack;)V", ordinal = 0), locals = CAPTURE_FAILHARD)
private void onRender(float partialTick,
long nanoTime,
private void onRender(DeltaTracker deltaTracker,
boolean renderBlockOutline,
Camera camera,
GameRenderer gameRenderer,
LightTexture lightTexture,
Matrix4f matrix4f,
Matrix4f matrix4f2,
CallbackInfo ci,
// Local capture needed for poseStack
TickRateManager tickRateManager,
float g,
float partialTick,
ProfilerFiller profilerFiller,
Vec3 cameraPosition,
double x,
Expand Down
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ release_type=release
# https://maven.parchmentmc.org/org/parchmentmc/data
# Forge dependencies use maven's version range spec:
# https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html
minecraft_version=1.20.6
minecraft_version=1.21
parchment_version=1.20.6-2024.06.02
supported_mc_versions=

fabric_loader_version=0.15.11
fabric_api_version=0.100.0+1.20.6
fabric_loader_req=>=0.12.11
fabric_mc_req=~1.20.5
fabric_supported_mc_versions=1.20.5
fabric_api_version=0.100.1+1.21
fabric_loader_req=>=0.14.0
fabric_mc_req=>1.21-
fabric_supported_mc_versions=

neoforge_version=20.6.116
neoforge_version=21.0.0-beta
neoforge_pr=
neoforge_mc_req=[1.20.6,)
neoforge_mc_req=[1.21,)
neoforge_loader_req=[1,)
neoforge_req=[20.6.11-beta,)
neoforge_req=[21.0.0-beta,)
neoforge_supported_mc_versions=

# Other dependencies
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
# https://mvnrepository.com/artifact/me.shedaniel.cloth/cloth-config?repo=architectury
modmenu_version=10.0.0-beta.1
cloth_version=14.0.126
modmenu_version=11.0.0-beta.1
cloth_version=15.0.127

0 comments on commit 1c13517

Please sign in to comment.