Skip to content

Commit

Permalink
Update to 1.21.3 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Onako2 authored Nov 28, 2024
1 parent a963a01 commit 1790880
Show file tree
Hide file tree
Showing 21 changed files with 116 additions and 71 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PurpurClient is designed to work together with [Purpur](https://github.com/Purpu

</div>

### Current Features in 1.20.6:
### Current Features in 1.21.3:

* Customizable mob passenger offsets
* Adds bee counts inside beehives to debug screen¹
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
}

Expand Down Expand Up @@ -35,9 +35,9 @@ dependencies {
// this is dumb as hell. bloats jar way too much. todo: switch to a different config provider
include(modImplementation("org.spongepowered:configurate-hocon:${project.configurate_version}"))
include("org.spongepowered:configurate-core:${project.configurate_version}")
include("com.google.guava:guava:31.1-jre")
include("com.typesafe:config:1.4.2")
include("io.leangen.geantyref:geantyref:1.3.12")
include("com.google.guava:guava:33.3-jre")
include("com.typesafe:config:1.4.3")
include("io.leangen.geantyref:geantyref:1.3.16")
}

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

minecraft_version=1.21
loader_version=0.15.11
minecraft_version=1.21.3
loader_version=0.16.7
#parchment_version=2024.05.01 # TODO: update when available
fabric_version=0.100.1+1.21
modmenu_version=11.0.0-beta.1
fabric_version=0.106.1+1.21.3
modmenu_version=12.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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/purpurmc/purpur/client/config/Seats.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Seats {
public Seat cod = new Seat(0.0D, 0.0D, 0.0D);
public Seat cow = new Seat(0.0D, 0.0D, 0.0D);
public Seat creeper = new Seat(0.0D, 0.0D, 0.0D);
public Seat creaking = new Seat(0.0D, 0.0D, 0.0D);
public Seat dolphin = new Seat(0.0D, 0.0D, 0.0D);
public Seat donkey = new Seat(0.0D, 0.0D, 0.0D);
public Seat drowned = new Seat(0.0D, 0.0D, 0.0D);
Expand Down Expand Up @@ -105,6 +106,7 @@ public void setAllSeats(double x, double y, double z) {
cod.setSeat(z, y, z);
cow.setSeat(z, y, z);
creeper.setSeat(z, y, z);
creaking.setSeat(z, y, z);
dolphin.setSeat(z, y, z);
donkey.setSeat(z, y, z);
drowned.setSeat(z, y, z);
Expand Down Expand Up @@ -190,6 +192,7 @@ public Seat getSeat(Mob mob) {
case COD -> this.cod;
case COW -> this.cow;
case CREEPER -> this.creeper;
case CREAKING -> this.creaking;
case DOLPHIN -> this.dolphin;
case DONKEY -> this.donkey;
case DROWNED -> this.drowned;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/purpurmc/purpur/client/entity/Mob.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum Mob {
COD(EntityType.COD, 7, 0),
COW(EntityType.COW, 8, 0),
CREEPER(EntityType.CREEPER, 9, 0),
CREAKING(EntityType.CREAKING, 1, 5),
DOLPHIN(EntityType.DOLPHIN, 10, 0),
DONKEY(EntityType.DONKEY, 11, 0),
DROWNED(EntityType.DROWNED, 12, 0),
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/purpurmc/purpur/client/entity/Seat.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.purpurmc.purpur.client.entity;

import org.purpurmc.purpur.client.util.Constants;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
Expand Down
37 changes: 23 additions & 14 deletions src/main/java/org/purpurmc/purpur/client/gui/screen/MobScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.CoreShaders;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.world.entity.EntitySpawnReason;
import org.joml.Matrix4fStack;
import org.joml.Quaternionf;
import org.purpurmc.purpur.client.PurpurClient;
Expand All @@ -19,13 +23,11 @@
import org.purpurmc.purpur.client.mixin.accessor.AccessSlime;

import java.util.ArrayList;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Renderable;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -63,6 +65,7 @@ public class MobScreen extends AbstractScreen {

private final Component noPreview = Component.translatable("purpurclient.options.no-preview");
private final Component notImplemented = Component.translatable("purpurclient.options.not-implemented");
private final Component experimentDisabled = Component.translatable("purpurclient.options.experiment-disabled");

public MobScreen(Screen parent, Mob mob) {
super(parent);
Expand Down Expand Up @@ -98,7 +101,7 @@ public void init() {
}

this.fakePlayer = new FakePlayer(this.minecraft.level, this.minecraft.player);
this.fakeEntity = this.mob.getType().create(this.minecraft.level);
this.fakeEntity = this.mob.getType().create(this.minecraft.level, EntitySpawnReason.NATURAL);
if (this.fakeEntity == null) {
// we need an entity to ride
this.fakePlayer = null;
Expand Down Expand Up @@ -146,16 +149,23 @@ protected void addOptions() {

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

RenderSystem.setShader(GameRenderer::getPositionTexShader);
if (this.minecraft.level == null) {
super.renderPanorama(context, delta);
} else {
super.renderBlurredBackground();
}
RenderSystem.setShader(CoreShaders.POSITION_TEX);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, AbstractContainerScreen.INVENTORY_LOCATION);

if (this.fakePlayer != null && this.fakeEntity != null) {
drawPreviewModel(this.fakePlayer, this.fakeEntity);
} else {
context.drawCenteredString(this.font, this.noPreview, this.centerX - 80, 125, 0xFFFFFFFF);
if (this.minecraft.level != null) {
context.drawCenteredString(this.font, this.experimentDisabled, this.centerX - 80, 125, 0xFFFFFFFF);
} else {
context.drawCenteredString(this.font, this.noPreview, this.centerX - 80, 125, 0xFFFFFFFF);
}
}

PoseStack matrices = context.pose();
Expand All @@ -171,6 +181,7 @@ public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
}
}
matrices.popPose();
context.fillGradient(0, 0, this.width, this.height, 0x800F4863, 0x80370038);
}

public void drawPreviewModel(FakePlayer player, Entity vehicle) {
Expand All @@ -179,13 +190,13 @@ public void drawPreviewModel(FakePlayer player, Entity vehicle) {
matrixStack.translate((float) (this.centerX + this.previewX), (float) this.previewY, 1500);
matrixStack.scale(1.0F, 1.0F, -1.0F);

RenderSystem.applyModelViewMatrix();

PoseStack matrixStack2 = new PoseStack();
matrixStack2.translate(0.0D, 0.0D, 1000.0D);
float zoom = this.previewZoom * this.previewZoomMultiplier;
matrixStack2.scale(zoom, zoom, zoom);

Quaternionf quaternion = Axis.ZP.rotationDegrees(180.0F);
Quaternionf quaternion = Axis.ZP.rotationDegrees(-180.0F);
Quaternionf quaternion2 = Axis.XP.rotationDegrees(this.previewPitch);
Quaternionf quaternion3 = Axis.YP.rotationDegrees(-this.previewYaw);
quaternion2.mul(quaternion3);
Expand All @@ -199,17 +210,15 @@ public void drawPreviewModel(FakePlayer player, Entity vehicle) {
renderer.setRenderShadow(false);
MultiBufferSource.BufferSource immediate = Minecraft.getInstance().renderBuffers().bufferSource();

//noinspection deprecation
Minecraft.getInstance().execute(() -> {
fixEntityRender(vehicle, matrixStack2, () -> renderer.render(vehicle, vehicle.getX(), vehicle.getY(), vehicle.getZ(), 0.0F, 1.0F, matrixStack2, immediate, 0xF000F0));
renderer.render(player, player.getX(), player.getY(), player.getZ(), 0.0F, 1.0F, matrixStack2, immediate, 0xF000F0);
fixEntityRender(vehicle, matrixStack2, () -> renderer.render(vehicle, vehicle.getX(), vehicle.getY(), vehicle.getZ(), 0.0F, matrixStack2, immediate, 0xF000F0));
renderer.render(player, player.getX(), player.getY(), player.getZ(), 0.0F, matrixStack2, immediate, 0xF000F0);
});

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

RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
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.options.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;
import org.purpurmc.purpur.client.gui.screen.widget.MobsList;

public class MobsScreen extends OptionsSubScreen {
public final static MutableComponent MOBS_BTN = Component.translatable("purpurclient.options.mobs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.WidgetSprites;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
Expand Down Expand Up @@ -58,9 +59,9 @@ public void renderWidget(GuiGraphics context, int mouseX, int mouseY, float delt

private void drawButton(GuiGraphics context, Component text, int x, boolean i) {
RenderSystem.enableDepthTest();
context.setColor(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.enableBlend();
context.blitSprite(TEXTURES.get(this.active, i), x, this.getY(), this.height, this.height);
context.blitSprite(RenderType::guiTextured, TEXTURES.get(this.active, i), x, this.getY(), this.height, this.height);
context.drawCenteredString(Minecraft.getInstance().font, text, x + this.height / 2, this.getY() + (this.height - 8) / 2, (this.active ? 0xFFFFFF : 0xA0A0A0) | Mth.ceil(this.alpha * 255.0f) << 24);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.gui.components.SpriteIconButton;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import org.purpurmc.purpur.client.entity.Mob;
import org.purpurmc.purpur.client.gui.screen.MobScreen;
Expand All @@ -29,6 +30,7 @@ public MobButton(Minecraft client, Screen screen, Mob mob) {
public void renderWidget(GuiGraphics context, int mouseX, int mouseY, float delta) {
super.renderWidget(context, mouseX, mouseY, delta);
context.blit(
RenderType::guiTextured,
MOBS_TEXTURE,
this.getX(),
this.getY(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package net.minecraft.client.gui.components;
package org.purpurmc.purpur.client.gui.screen.widget;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import java.util.List;
import java.util.Map;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.OptionInstance;
import net.minecraft.client.Options;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratableEntry;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.OptionsList;
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;

@Environment(EnvType.CLIENT)
public class MobsList extends OptionsList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@

import com.mojang.serialization.Codec;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(ItemEnchantments.class)
public class MixinItemEnchantments {
@Shadow @Final
@Shadow
private static final Codec<Integer> LEVEL_CODEC = Codec.intRange(0, Integer.MAX_VALUE);

@ModifyConstant(method = "<init>", constant = @Constant(intValue = 255))
private static int injectConstructor(int constant) {
private int injectConstructor(int constant) {
return Integer.MAX_VALUE;
}

@Mixin(ItemEnchantments.Mutable.class)
public static class MixinItemEnchantmentsMutable {
@ModifyConstant(method = "set", constant = @Constant(intValue = 255))
private static int injectSet(int constant) {
private int injectSet(int constant) {
return Integer.MAX_VALUE;
}

@ModifyConstant(method = "upgrade", constant = @Constant(intValue = 255))
private static int injectUpgrade(int constant) {
private int injectUpgrade(int constant) {
return Integer.MAX_VALUE;
}
}
Expand Down
Loading

0 comments on commit 1790880

Please sign in to comment.