Skip to content

Commit

Permalink
update to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Sep 16, 2023
1 parent c3a79ff commit b86dc34
Show file tree
Hide file tree
Showing 19 changed files with 205 additions and 183 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,26 @@ PurpurClient is designed to work together with [Purpur](https://github.com/Purpu

</div>

### Current Features in 1.19:
### Current Features in 1.20.1:

* Customizable mob passenger offsets
* Adds bee counts inside beehives to debug screen¹
* Prevent client from preemptively removing item entities from the world
* 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

### Past Features (to get an idea of what this mod has done and will do in the future):

* Asynchronous chat processing (not updating this to 1.19 because Mojang's new chat system confuses me)
* Asynchronous chat processing (removed since Mojang's new chat system is confusing)
* Fix rain particles appearing under water [MC-131770](https://bugs.mojang.com/browse/MC-131770)
* Fix sky darkening when riding minecart not on tracks [MC-51150](https://bugs.mojang.com/browse/MC-51150)
* Fix chat stutter [MC-218167](https://bugs.mojang.com/browse/MC-218167)
* 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-???)

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
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
}

Expand Down Expand Up @@ -55,6 +55,7 @@ jar {

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

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

minecraft_version=1.19.3
yarn_mappings=1.19.3+build.1
loader_version=0.14.11
fabric_version=0.68.1+1.19.3
modmenu_version=5.0.2
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.22
fabric_version=0.88.1+1.20.1
modmenu_version=7.2.2
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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 14 additions & 11 deletions src/main/java/org/purpurmc/purpur/client/PurpurClient.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package org.purpurmc.purpur.client;

import com.google.common.io.ByteArrayDataOutput;
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.ClientPlayNetworking;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.Icons;
import net.minecraft.client.util.Window;
import net.minecraft.resource.DefaultResourcePack;
import net.minecraft.resource.InputSupplier;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import org.purpurmc.purpur.client.config.Config;
Expand All @@ -22,6 +28,8 @@ public static PurpurClient instance() {
return instance;
}

public static List<InputSupplier<InputStream>> ICON_LIST = Arrays.asList(() -> PurpurClient.class.getResourceAsStream("/assets/icon16.png"), () -> PurpurClient.class.getResourceAsStream("/assets/icon32.png"));

private final ConfigManager configManager;

public PurpurClient() {
Expand Down Expand Up @@ -65,16 +73,11 @@ public void updateTitle() {
MinecraftClient client = MinecraftClient.getInstance();
Window window = client.getWindow();
client.updateWindowTitle();
if (getConfig().useWindowTitle) {
window.setIcon(
() -> PurpurClient.class.getResourceAsStream("/assets/icon16.png"),
() -> PurpurClient.class.getResourceAsStream("/assets/icon32.png"));
} else {
DefaultResourcePack pack = client.getDefaultResourcePack();
window.setIcon(
pack.open(ResourceType.CLIENT_RESOURCES, new Identifier("icons/icon_16x16.png")),
pack.open(ResourceType.CLIENT_RESOURCES, new Identifier("icons/icon_32x32.png"))
);
}
DefaultResourcePack pack = client.getDefaultResourcePack();
try {
window.setIcon(pack, Icons.RELEASE);
} catch (IOException e) {
// ignore
};
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.purpurmc.purpur.client.gui.screen;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ClickableWidget;
Expand Down Expand Up @@ -30,18 +31,18 @@ public void init() {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
renderBackground(matrixStack);
drawCenteredText(matrixStack, this.textRenderer, this.title, this.centerX, 15, 0xFFFFFFFF);
super.render(matrixStack, mouseX, mouseY, delta);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
renderBackground(context);
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.centerX, 15, 0xFFFFFFFF);
super.render(context, mouseX, mouseY, delta);
}

@Override
public void renderBackground(MatrixStack matrixStack, int vOffset) {
public void renderBackground(DrawContext context) {
if (this.client != null && this.client.world != null) {
this.fillGradient(matrixStack, 0, 0, this.width, this.height, 0xF00F4863, 0xF0370038);
context.fillGradient(0, 0, this.width, this.height, 0xF00F4863, 0xF0370038);
} else {
this.renderBackgroundTexture(vOffset);
this.renderBackgroundTexture(context);
}
}

Expand All @@ -53,19 +54,21 @@ public void close() {
PurpurClient.instance().getConfigManager().save();
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_TAB) {
for (Drawable drawable : this.options) {
if (drawable instanceof DoubleButton option) {
if (option.tab()) {
return false;
}
}
}
}
return super.keyPressed(keyCode, scanCode, modifiers);
}
// TODO: fix keyboard accessibility in mob settings
//
// @Override
// public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
// if (keyCode == GLFW.GLFW_KEY_TAB) {
// for (Drawable drawable : this.options) {
// if (drawable instanceof DoubleButton option) {
// if (option.tab()) {
// return false;
// }
// }
// }
// }
// return super.keyPressed(keyCode, scanCode, modifiers);
// }

@Override
public void tick() {
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
Expand Down Expand Up @@ -139,8 +140,8 @@ public void init() {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
renderBackground(matrixStack);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
renderBackground(context);

RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
Expand All @@ -149,21 +150,22 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta)
if (this.fakePlayer != null && this.fakeEntity != null) {
drawPreviewModel(this.fakePlayer, this.fakeEntity);
} else {
drawCenteredText(matrixStack, this.textRenderer, this.noPreview, this.centerX - 80, 125, 0xFFFFFFFF);
context.drawCenteredTextWithShadow(this.textRenderer, this.noPreview, this.centerX - 80, 125, 0xFFFFFFFF);
}

matrixStack.push();
matrixStack.translate(0, 0, 900);
drawCenteredText(matrixStack, this.textRenderer, this.title, this.centerX, 15, 0xFFFFFFFF);
drawCenteredText(matrixStack, this.textRenderer, this.subtitle, this.centerX, 30, 0xFFFFFFFF);
MatrixStack matrices = context.getMatrices();
matrices.push();
matrices.translate(0, 0, 900);
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.centerX, 15, 0xFFFFFFFF);
context.drawCenteredTextWithShadow(this.textRenderer, this.subtitle, this.centerX, 30, 0xFFFFFFFF);
if (this.options == null || this.options.isEmpty()) {
drawCenteredText(matrixStack, this.textRenderer, this.notImplemented, this.centerX + 120, 125, 0xFFFFFFFF);
context.drawCenteredTextWithShadow(this.textRenderer, this.notImplemented, this.centerX + 120, 125, 0xFFFFFFFF);
} else {
for (Drawable drawable : this.options) {
drawable.render(matrixStack, mouseX, mouseY, delta);
drawable.render(context, mouseX, mouseY, delta);
}
}
matrixStack.pop();
matrices.pop();
}

public void drawPreviewModel(FakePlayer player, Entity vehicle) {
Expand Down Expand Up @@ -246,8 +248,8 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double del
return false;
}
if (button == 0) {
this.previewYaw -= (mouseX - this.mouseDownX);
this.previewPitch -= (mouseY - this.mouseDownY);
this.previewYaw -= (float) (mouseX - this.mouseDownX);
this.previewPitch -= (float) (mouseY - this.mouseDownY);
clampYawPitch();
} else if (button == 1) {
this.previewX += (mouseX - this.mouseDownX);
Expand All @@ -260,7 +262,7 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double del

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
this.previewZoom += amount;
this.previewZoom += (float) amount;
clampZoom();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.purpurmc.purpur.client.gui.screen;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.recipebook.SmokerRecipeBookScreen;
import net.minecraft.client.util.math.MatrixStack;
Expand Down Expand Up @@ -33,8 +34,8 @@ public void init() {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float delta) {
super.render(matrixStack, mouseX, mouseY, delta);
drawCenteredText(matrixStack, this.textRenderer, OptionsScreen.MOBS_BTN, this.centerX, 30, 0xFFFFFFFF);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
context.drawCenteredTextWithShadow(this.textRenderer, OptionsScreen.MOBS_BTN, this.centerX, 30, 0xFFFFFFFF);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.purpurmc.purpur.client.gui.screen.widget;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.ButtonWidget;
Expand All @@ -17,25 +18,20 @@ public BooleanButton(int x, int y, int width, int height, BooleanOption option)
this.option = option;
}

public void renderTooltip(MatrixStack matrixStack, int mouseX, int mouseY) {
public void renderTooltip(DrawContext context, int mouseX, int mouseY) {
if (this.hovered && this.tooltipDelay > 15 && MinecraftClient.getInstance().currentScreen != null) {
MinecraftClient.getInstance().currentScreen.renderOrderedTooltip(matrixStack, this.option.tooltip(), mouseX, mouseY);
context.drawOrderedTooltip(MinecraftClient.getInstance().textRenderer, this.option.tooltip(), mouseX, mouseY);
}
}

@Override
public void appendClickableNarrations(NarrationMessageBuilder builder) {
this.appendDefaultNarrations(builder);
}

@Override
public Text getMessage() {
return this.option.text();
}

@Override
public void tick() {
if (this.isHovered() && this.active) {
if (this.isSelected() && this.active) {
this.tooltipDelay++;
} else if (this.tooltipDelay > 0) {
this.tooltipDelay = 0;
Expand Down
Loading

0 comments on commit b86dc34

Please sign in to comment.