Skip to content

Commit

Permalink
1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AutumnVN committed Dec 29, 2024
1 parent 2693ca2 commit 2d97cbf
Show file tree
Hide file tree
Showing 23 changed files with 96 additions and 183 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build

on:
push:
branches:
- main
push:
branches:
- 1.20.1

permissions:
contents: write
Expand All @@ -18,14 +18,14 @@ jobs:

- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 17
distribution: 'temurin'

- name: Build
run: ./gradlew build

- name: Release
run: |
gh release upload release --clobber build/libs/autumn-1.21.4.jar
gh release upload release --clobber build/libs/autumn-1.20.1.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
it.options.release = 17
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
Expand Down
13 changes: 5 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.16.9

# Mod Properties
mod_version=1.21.4
mod_version=1.20.1
maven_group=autumnvn.autumn
archives_base_name=autumn

# Dependencies
fabric_version=0.112.2+1.21.4
modmenu_version=12.0.0
fabric_version=0.92.2+1.20.1
modmenu_version=7.2.2
5 changes: 2 additions & 3 deletions src/client/java/autumnvn/autumn/AutumnClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.PlayerInput;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult.Type;
import net.minecraft.util.math.BlockPos;
Expand All @@ -48,7 +47,7 @@ public void onInitializeClient() {
settingKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("Open Autumn Settings", GLFW.GLFW_KEY_BACKSLASH, "Autumn"));
zoomKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("Zoom", GLFW.GLFW_KEY_LEFT_ALT, "Autumn"));

FabricLoader.getInstance().getModContainer("autumn").ifPresent(container -> ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of("autumn", "autumn"), container, ResourcePackActivationType.DEFAULT_ENABLED));
FabricLoader.getInstance().getModContainer("autumn").ifPresent(container -> ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("autumn", "autumn"), container, ResourcePackActivationType.DEFAULT_ENABLED));
BlockRenderLayerMap.INSTANCE.putBlock(Blocks.BARRIER, RenderLayer.getTranslucent());

ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
Expand All @@ -74,7 +73,7 @@ public void onInitializeClient() {
// FreeCam
if (AutumnClient.options.freeCam.getValue() && client.player.input instanceof KeyboardInput) {
Input input = new Input();
input.playerInput = new PlayerInput(false, false, false, false, false, client.player.input.playerInput.sneak(), false);
input.sneaking = client.player.input.sneaking;
client.player.input = input;
} else if (!AutumnClient.options.freeCam.getValue() && !(client.player.input instanceof KeyboardInput)) {
client.player.input = new KeyboardInput(client.options);
Expand Down
4 changes: 2 additions & 2 deletions src/client/java/autumnvn/autumn/ButtonListWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import java.util.Map;

public class ButtonListWidget extends ElementListWidget<ButtonListWidget.ButtonEntry> {
public ButtonListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) {
super(client, width, height, y, itemHeight);
public ButtonListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);
}

void addOptionEntry(SimpleOption<?> options) {
Expand Down
39 changes: 13 additions & 26 deletions src/client/java/autumnvn/autumn/FreeCam.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,25 @@
import com.mojang.authlib.GameProfile;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.client.input.KeyboardInput;
import net.minecraft.client.network.ClientConnectionState;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.Packet;
import net.minecraft.server.ServerLinks;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;

import java.util.Collections;
import java.util.Objects;
import java.util.UUID;

public class FreeCam extends ClientPlayerEntity {

static final ClientPlayNetworkHandler networkHandler = new ClientPlayNetworkHandler(
AutumnClient.client,
AutumnClient.client.currentScreen,
Objects.requireNonNull(AutumnClient.client.getNetworkHandler()).getConnection(),
new ClientConnectionState(
new GameProfile(UUID.randomUUID(), "FreeCam"),
AutumnClient.client.getTelemetryManager().createWorldSession(false, null, null),
AutumnClient.client.getNetworkHandler().getRegistryManager(),
AutumnClient.client.getNetworkHandler().getEnabledFeatures(),
AutumnClient.client.getNetworkHandler().getBrand(),
AutumnClient.client.getCurrentServerEntry(),
AutumnClient.client.currentScreen,
Collections.emptyMap(),
AutumnClient.client.inGameHud.getChatHud().toChatState(),
Collections.emptyMap(),
ServerLinks.EMPTY
)
AutumnClient.client.getCurrentServerEntry(),
new GameProfile(UUID.randomUUID(), "FreeCam"),
AutumnClient.client.getTelemetryManager().createWorldSession(false, null, null)
) {

@Override
Expand All @@ -52,7 +40,6 @@ public FreeCam() {
false
);
setId(-1);
setLoaded(true);
getAbilities().flying = true;
input = new KeyboardInput(AutumnClient.client.options);
refreshPositionAndAngles(
Expand All @@ -66,7 +53,7 @@ public FreeCam() {

public void spawn() {
if (clientWorld != null) {
clientWorld.addEntity(this);
clientWorld.addEntity(getId(), this);
}
}

Expand Down Expand Up @@ -111,27 +98,27 @@ public void tickMovement() {
Vec3d forward = Vec3d.fromPolar(0, getYaw());
Vec3d side = Vec3d.fromPolar(0, getYaw() + 90);

input.tick();
input.tick(false, 0);

if (input.playerInput.forward() || input.playerInput.backward()) {
double direction = input.playerInput.forward() ? 1 : -1;
if (input.pressingForward || input.pressingBack) {
double direction = input.pressingForward ? 1 : -1;
x += forward.x * horizontalSpeed * direction;
z += forward.z * horizontalSpeed * direction;
}

if (input.playerInput.right() || input.playerInput.left()) {
double direction = input.playerInput.right() ? 1 : -1;
if (input.pressingRight || input.pressingLeft) {
double direction = input.pressingRight ? 1 : -1;
z += side.z * horizontalSpeed * direction;
x += side.x * horizontalSpeed * direction;
}

if ((input.playerInput.forward() || input.playerInput.backward()) && (input.playerInput.right() || input.playerInput.left())) {
if ((input.pressingForward || input.pressingBack) && (input.pressingRight || input.pressingLeft)) {
x *= sin45;
z *= sin45;
}

if (input.playerInput.jump()) y += verticalSpeed;
if (input.playerInput.sneak()) y -= verticalSpeed;
if (input.jumping) y += verticalSpeed;
if (input.sneaking) y -= verticalSpeed;
setVelocity(x, y, z);

super.tickMovement();
Expand Down
2 changes: 1 addition & 1 deletion src/client/java/autumnvn/autumn/SettingsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public SettingsScreen(Screen parent) {

@Override
protected void init() {
this.list = new ButtonListWidget(this.client, this.width, this.height - 64, 32, 25);
this.list = new ButtonListWidget(this.client, this.width, this.height - 64, 32, this.height - 32, 25);
for (int i = 0; i < options.length; i += 2) {
if (i + 1 < options.length) {
this.list.addOptionEntry(options[i], options[i + 1]);
Expand Down
5 changes: 2 additions & 3 deletions src/client/java/autumnvn/autumn/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileUtil;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
Expand All @@ -30,11 +29,11 @@ public static Entity getTargetedEntity() {
if (cameraEntity == null) return null;

double maxDistance = 128;
float tickDelta = AutumnClient.client.getRenderTickCounter().getTickDelta(true);
float tickDelta = AutumnClient.client.getTickDelta();
Vec3d vec3d = cameraEntity.getEyePos();
Vec3d vec3d2 = cameraEntity.getRotationVec(tickDelta).multiply(maxDistance);
Box box = cameraEntity.getBoundingBox().stretch(vec3d2).expand(1.0);
EntityHitResult entityHitResult = ProjectileUtil.raycast(cameraEntity, vec3d, vec3d.add(vec3d2), box, EntityPredicates.CAN_HIT, maxDistance * maxDistance);
EntityHitResult entityHitResult = ProjectileUtil.raycast(cameraEntity, vec3d, vec3d.add(vec3d2), box, Entity::canHit, maxDistance * maxDistance);

if (entityHitResult != null) {
recentTargetedEntity = new TimedEntity(entityHitResult.getEntity());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package autumnvn.autumn.mixin.client;

import autumnvn.autumn.AutumnClient;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.render.BackgroundRenderer;
import net.minecraft.client.render.BackgroundRenderer.FogType;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Fog;
import org.joml.Vector4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(BackgroundRenderer.class)
public class BackgroundRendererMixin {

// NoFog
@Inject(method = "applyFog", at = @At("TAIL"), cancellable = true)
private static void applyFog(Camera camera, FogType fogType, Vector4f color, float viewDistance, boolean thickenFog, float tickDelta, CallbackInfoReturnable<Fog> cir) {
@Inject(method = "applyFog", at = @At("TAIL"))
private static void applyFog(Camera camera, FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) {
if (AutumnClient.options.noFog.getValue() && fogType == FogType.FOG_TERRAIN) {
cir.setReturnValue(Fog.DUMMY);
RenderSystem.setShaderFogStart(Float.MAX_VALUE);
RenderSystem.setShaderFogEnd(Float.MAX_VALUE);
}
}
}
4 changes: 2 additions & 2 deletions src/client/java/autumnvn/autumn/mixin/client/CameraMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class CameraMixin {

// ThirdPersonNoClip
@Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true)
private void clipToSpace(float f, CallbackInfoReturnable<Float> cir) {
private void clipToSpace(double desiredCameraDistance, CallbackInfoReturnable<Double> cir) {
if (AutumnClient.options.thirdPersonNoClip.getValue()) {
cir.setReturnValue(f);
cir.setReturnValue(desiredCameraDistance);
}
}

Expand Down
11 changes: 3 additions & 8 deletions src/client/java/autumnvn/autumn/mixin/client/ChatHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@
public class ChatHudMixin {

// BetterChat
@ModifyConstant(method = "addVisibleMessage", constant = @Constant(intValue = 100))
private int maxVisibleChatLength(int original) {
return AutumnClient.options.betterChat.getValue() ? 65536 : original;
}

@ModifyConstant(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", constant = @Constant(intValue = 100))
private int maxChatLength(int original) {
return AutumnClient.options.betterChat.getValue() ? 65536 : original;
@ModifyConstant(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", constant = @Constant(intValue = 100))
private int addMessage(int original) {
return AutumnClient.options.betterChat.getValue() ? 65535 : original;
}

@Inject(method = "clear", at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ClientPlayNetworkHandlerMixin {
// TPS
@Inject(method = "onWorldTimeUpdate", at = @At("HEAD"))
private void onWorldTimeUpdate(WorldTimeUpdateS2CPacket packet, CallbackInfo ci) {
long tick = packet.time();
long tick = packet.getTime();
long time = System.nanoTime();
if (lastTick != 0 && lastTime != 0) {
long passedTick = tick - lastTick;
Expand Down

This file was deleted.

Loading

0 comments on commit 2d97cbf

Please sign in to comment.