Skip to content

Commit

Permalink
Update to 1.20.6 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
granny authored May 3, 2024
1 parent f2942bc commit 4e0876d
Show file tree
Hide file tree
Showing 27 changed files with 373 additions and 255 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Import gradle properties
shell: bash
run: cat gradle.properties >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ PurpurClient is designed to work together with [Purpur](https://github.com/Purpu

</div>

### Current Features in 1.20.4:
### Current Features in 1.20.6:

* Customizable mob passenger offsets
* Adds bee counts inside beehives to debug screen¹
* Fancy Purpur-themed Loading Screen (can be disabled in the config)
* Fancy Window Title that changes based on what kind of server you're in ([translations can be PR'd](./src/main/resources/assets/purpurclient/lang/))
* Displays Custom Enchantments instead of stripping them from the client
* Removes the client-side limit of 255 levels

¹ only works when connected to [Purpur](https://github.com/PurpurMC/Purpur) servers
Expand All @@ -36,6 +35,7 @@ PurpurClient is designed to work together with [Purpur](https://github.com/Purpu
* Fix warnings in logs about invalid flying attributes [Purpur-744](https://github.com/PurpurMC/Purpur/pull/744)
* Fix debug markers ignoring the blue and red values that are set [MC-234030](https://bugs.mojang.com/browse/MC-234030) (Shows as Unresolved even though it's been fixed)
* Fix client preemptively removing item entities from the world (MC-???)
* Displays Custom Enchantments instead of stripping them from the client (1.20.5 - the Components Update)

Note: PurpurClient adds a fancy animated splash screen on game startup alongside a better window title message. Both of these can be disabled in the config if preferred.

Expand Down
21 changes: 15 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'fabric-loom' version '1.6-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
}

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

archivesBaseName = project.archives_base_name
project.build_num = System.getenv("GITHUB_RUN_NUMBER") ?: "SNAPSHOT"
Expand All @@ -16,12 +16,18 @@ repositories {
maven {
url = "https://maven.terraformersmc.com/"
}
maven {
url = 'https://maven.parchmentmc.org'
}
mavenCentral()
}

dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings(loom.officialMojangMappings())
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${minecraft_version}:${project.parchment_version}@zip")
}
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}")
Expand All @@ -36,6 +42,8 @@ dependencies {

processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.properties["minecraft_version"]
inputs.property "loader_version", project.properties["loader_version"]

filesMatching("fabric.mod.json") {
expand "version": project.version
Expand All @@ -44,7 +52,7 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release.set(17)
it.options.release.set(21)
}

jar {
Expand All @@ -55,6 +63,7 @@ jar {

loom {
mixin.defaultRefmapName = "purpurclient.refmap.json"
accessWidenerPath = file("src/main/resources/purpurclient.accesswidener")
}

modrinth {
Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
org.gradle.jvmargs=-Xmx2G

minecraft_version=1.20.4
loader_version=0.15.3
fabric_version=0.92.1+1.20.4
modmenu_version=9.0.0
minecraft_version=1.20.6
loader_version=0.15.10
parchment_version=2024.05.01
fabric_version=0.97.8+1.20.6
modmenu_version=10.0.0-beta.1
configurate_version=4.1.2

maven_group=org.purpurmc.purpur.client
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
27 changes: 14 additions & 13 deletions src/main/java/org/purpurmc/purpur/client/PurpurClient.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
package org.purpurmc.purpur.client;

import com.google.common.io.ByteArrayDataOutput;
import com.mojang.blaze3d.platform.IconSet;
import com.mojang.blaze3d.platform.Window;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientConfigurationConnectionEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientConfigurationNetworking;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.server.packs.VanillaPackResources;
import net.minecraft.server.packs.resources.IoSupplier;
import org.purpurmc.purpur.client.config.Config;
import org.purpurmc.purpur.client.config.ConfigManager;
import org.purpurmc.purpur.client.network.BeehivePacket;
import org.purpurmc.purpur.client.network.Packet;
import org.purpurmc.purpur.client.util.Constants;
import org.purpurmc.purpur.client.network.ClientboundBeehivePayload;
import org.purpurmc.purpur.client.network.ServerboundBeehivePayload;
import org.purpurmc.purpur.client.network.ServerboundPurpurClientHelloPayload;

public class PurpurClient implements ClientModInitializer {
private static PurpurClient instance;
Expand All @@ -43,16 +44,16 @@ public void onInitializeClient() {
return;
}

ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
BeehivePacket.numOfBees = null;
if (!client.isLocalServer()) {
ByteArrayDataOutput out = Packet.out();
out.writeInt(Constants.PROTOCOL);
Packet.send(Constants.HELLO, out);
}
PayloadTypeRegistry.configurationC2S().register(ServerboundPurpurClientHelloPayload.TYPE, ServerboundPurpurClientHelloPayload.STREAM_CODEC);
PayloadTypeRegistry.playC2S().register(ServerboundBeehivePayload.TYPE, ServerboundBeehivePayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(ClientboundBeehivePayload.TYPE, ClientboundBeehivePayload.STREAM_CODEC);

ClientPlayNetworking.registerGlobalReceiver(ClientboundBeehivePayload.TYPE, ClientboundBeehivePayload::handle);
ClientConfigurationConnectionEvents.READY.register((handler, client) -> {
ClientboundBeehivePayload.NUM_OF_BEES = null;
ClientConfigurationNetworking.send(new ServerboundPurpurClientHelloPayload());
});

ClientPlayNetworking.registerGlobalReceiver(Constants.BEEHIVE_S2C, BeehivePacket::receiveBeehiveData);

if (getConfig().useWindowTitle) {
Minecraft.getInstance().execute(this::updateTitle);
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/purpurmc/purpur/client/entity/Mob.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,23 @@ public enum Mob {
ZOMBIFIED_PIGLIN(EntityType.ZOMBIFIED_PIGLIN, 8, 4);

private final EntityType<? extends net.minecraft.world.entity.Mob> mob;
private final int u, v;
private final int spriteWidth, spriteHeight;

Mob(EntityType<? extends net.minecraft.world.entity.Mob> mob, int u, int v) {
Mob(EntityType<? extends net.minecraft.world.entity.Mob> mob, int spriteWidth, int spriteHeight) {
this.mob = mob;
this.u = u;
this.v = v;
this.spriteWidth = spriteWidth;
this.spriteHeight = spriteHeight;
}

public EntityType<? extends net.minecraft.world.entity.Mob> getType() {
return this.mob;
}

public int getU() {
return this.u;
public int getSpriteWidth() {
return this.spriteWidth;
}

public int getV() {
return this.v;
public int getSpriteHeight() {
return this.spriteHeight;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package org.purpurmc.purpur.client.gui.screen;

import org.lwjgl.glfw.GLFW;
import org.purpurmc.purpur.client.PurpurClient;
import org.purpurmc.purpur.client.gui.screen.widget.DoubleButton;
import org.purpurmc.purpur.client.gui.screen.widget.Tickable;

import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.screens.OptionsSubScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;

public abstract class AbstractScreen extends Screen {
public abstract class AbstractScreen extends OptionsSubScreen {
public static final Component TITLE = Component.translatable("purpurclient.options.title");

private final Screen parent;

protected List<AbstractWidget> options;
protected int centerX;

public AbstractScreen(Screen parent) {
super(Component.translatable("purpurclient.options.title"));
super(parent, Minecraft.getInstance().options, TITLE);
this.parent = parent;
}

Expand All @@ -28,19 +30,10 @@ public void init() {
this.centerX = (int) (this.width / 2F);
}

@Override
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
context.drawCenteredString(this.font, this.title, this.centerX, 15, 0xFFFFFFFF);
super.render(context, mouseX, mouseY, delta);
}

@Override
public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float delta) {
if (this.minecraft != null && this.minecraft.level != null) {
context.fillGradient(0, 0, this.width, this.height, 0xF00F4863, 0xF0370038);
} else {
this.renderDirtBackground(context);
}
super.renderBackground(context, mouseX, mouseY, delta);
context.fillGradient(0, 0, this.width, this.height, 0x800F4863, 0x80370038);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import org.joml.Matrix4fStack;
import org.joml.Quaternionf;
import org.purpurmc.purpur.client.PurpurClient;
import org.purpurmc.purpur.client.config.options.DoubleOption;
Expand Down Expand Up @@ -169,9 +170,9 @@ public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
}

public void drawPreviewModel(FakePlayer player, Entity vehicle) {
PoseStack matrixStack = RenderSystem.getModelViewStack();
matrixStack.pushPose();
matrixStack.translate(this.centerX + this.previewX, this.previewY, 1500);
Matrix4fStack matrixStack = RenderSystem.getModelViewStack();
matrixStack.pushMatrix();
matrixStack.translate((float) (this.centerX + this.previewX), (float) this.previewY, 1500);
matrixStack.scale(1.0F, 1.0F, -1.0F);

RenderSystem.applyModelViewMatrix();
Expand Down Expand Up @@ -202,7 +203,7 @@ public void drawPreviewModel(FakePlayer player, Entity vehicle) {

immediate.endBatch();
renderer.setRenderShadow(true);
matrixStack.popPose();
matrixStack.popMatrix();

RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
Expand Down
57 changes: 37 additions & 20 deletions src/main/java/org/purpurmc/purpur/client/gui/screen/MobsScreen.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
package org.purpurmc.purpur.client.gui.screen;

import org.purpurmc.purpur.client.entity.Mob;
import org.purpurmc.purpur.client.gui.screen.widget.MobButton;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.MobsList;
import net.minecraft.client.gui.components.OptionsList;
import net.minecraft.client.gui.screens.OptionsSubScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import org.purpurmc.purpur.client.entity.Mob;
import org.purpurmc.purpur.client.gui.screen.widget.MobButton;

public class MobsScreen extends OptionsSubScreen {
public final static MutableComponent MOBS_BTN = Component.translatable("purpurclient.options.mobs");

public class MobsScreen extends AbstractScreen {
public MobsScreen(Screen parent) {
super(parent);
protected OptionsList options;
protected int centerX;

public MobsScreen(Screen screen) {
super(screen, Minecraft.getInstance().options, MOBS_BTN);
}

@Override
public void init() {
super.init();
protected void init() {
MobsList widget = new MobsList(this.minecraft, this.height, this.height, this);

this.options = new ArrayList<>();
int x = -7, y = 80;
int amount = 15;
List<AbstractWidget> list = new ArrayList<>();
for (Mob mob : Mob.values()) {
this.options.add(new MobButton(this, mob, this.centerX + x * 21 - 8, y));
if (x++ >= 7) {
x = -7;
y += 20;
list.add(new MobButton(this.minecraft, this, mob));
if (list.size() == amount) {
widget.addEntry(list);
list.clear();
}
}
widget.addEntry(list);
this.options = this.addRenderableWidget(widget);
super.init();
}

this.options.forEach(this::addRenderableWidget);
@Override
public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float delta) {
super.renderBackground(context, mouseX, mouseY, delta);
context.fillGradient(0, 0, this.width, this.height, 0x800F4863, 0x80370038);
}

@Override
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
context.drawCenteredString(this.font, OptionsScreen.MOBS_BTN, this.centerX, 30, 0xFFFFFFFF);
protected void repositionElements() {
super.repositionElements();
this.options.updateSize(this.width, this.layout);
}
}
Loading

0 comments on commit 4e0876d

Please sign in to comment.