Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auto] Update to Minecraft 1.21.3 #11

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ The versioning scheme is listed in the README.

Minecraft 1.x.x

## v1.1.3 - 2024-12-20

Minecraft 1.21.3

### Updated

- Updated to Minecraft 1.21.3
- This release is otherwise identical to v1.1.2

## v1.1.2 - 2024-08-09

Minecraft 1.21.1
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ java_version=21

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.1
loader_version=0.16.0
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.8

# Mod Properties
# Note: this version number is updated during release
Expand All @@ -17,4 +17,4 @@ maven_group=co.secretonline.clientsidepaintingvariants
archives_base_name=client-side-painting-variants

# Dependencies
fabric_version=0.102.0+1.21.1
fabric_version=0.106.1+1.21.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;

Expand All @@ -15,14 +16,12 @@
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.profiler.Profiler;

public class PaintingVariantsDataListener implements IdentifiableResourceReloadListener {
private static Logger LOGGER = ClientSidePaintingVariants.LOGGER;

@Override
public CompletableFuture<Void> reload(Synchronizer synchronizer, ResourceManager resourceManager,
Profiler propareProfiler, Profiler applyProfiler,
Executor prepareExecutor, Executor applyExecutor) {
return CompletableFuture
.supplyAsync(
Expand Down Expand Up @@ -57,7 +56,8 @@ private Map<Identifier, PaintingVariant> getPaintingsFromData(ResourceManager re

Identifier assetId = Identifier.of(data.get("asset_id").getAsString());

paintings.put(identifier, new PaintingVariant(width, height, assetId));
// TODO: Read text components
paintings.put(identifier, new PaintingVariant(width, height, assetId, Optional.empty(), Optional.empty()));
} catch (IOException ex) {
LOGGER.warn("Failed to read data for registry painting variant " + identifier.toString() + ". Skipping");
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;

Expand All @@ -15,14 +16,12 @@
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.profiler.Profiler;

public class PaintingVariantsResourceListener implements IdentifiableResourceReloadListener {
private static Logger LOGGER = ClientSidePaintingVariants.LOGGER;

@Override
public CompletableFuture<Void> reload(Synchronizer synchronizer, ResourceManager resourceManager,
Profiler propareProfiler, Profiler applyProfiler,
Executor prepareExecutor, Executor applyExecutor) {
return CompletableFuture
.supplyAsync(
Expand Down Expand Up @@ -57,7 +56,8 @@ private Map<Identifier, PaintingVariant> getPaintingsFromResources(ResourceManag

Identifier assetId = Identifier.of(data.get("asset_id").getAsString());

paintings.put(identifier, new PaintingVariant(width, height, assetId));
// TODO: Read text components
paintings.put(identifier, new PaintingVariant(width, height, assetId, Optional.empty(), Optional.empty()));
} catch (IOException ex) {
LOGGER.warn("Failed to read data for resource painting variant " + identifier.toString() + ". Skipping");
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,38 @@

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import co.secretonline.clientsidepaintingvariants.PaintingsInfo;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.PaintingEntityRenderer;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.render.entity.state.PaintingEntityRenderState;
import net.minecraft.entity.decoration.painting.PaintingEntity;
import net.minecraft.util.Identifier;
import net.minecraft.entity.decoration.painting.PaintingVariant;

@Mixin(PaintingEntityRenderer.class)
public class PaintingEntityRendererMixin {
private static final int ARG_PAINTING_ENTITY = 2;
private static final int ARG_PAINTING_SPRITE = 5;

private Sprite getPaintingSprite(Identifier identifier) {
var paintingManager = MinecraftClient.getInstance().getPaintingManager();

return paintingManager.getSprite(identifier);
}

@ModifyArgs(method = "render(Lnet/minecraft/entity/decoration/painting/PaintingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/PaintingEntityRenderer;renderPainting(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/entity/decoration/painting/PaintingEntity;IILnet/minecraft/client/texture/Sprite;Lnet/minecraft/client/texture/Sprite;)V"))
private void switchRenderedPainting(Args args) {
var entity = (PaintingEntity) args.get(ARG_PAINTING_ENTITY);
var paintingVariant = entity.getVariant().value();
@Inject(method = "updateRenderState", at = @At("RETURN"))
private void injectUpdateRenderState(PaintingEntity paintingEntity,
PaintingEntityRenderState paintingEntityRenderState, float f, CallbackInfo ci) {
PaintingVariant paintingVariant = (PaintingVariant) paintingEntity.getVariant().value();

PaintingsInfo paintingInfo = PaintingsInfo.getInstance();
var registryPaintings = paintingInfo.getRegistryPaintingsForSize(paintingVariant.width(), paintingVariant.height());
var resourcePaintings = paintingInfo.getResourcePaintingsForSize(paintingVariant.width(), paintingVariant.height());
var registryPaintings = paintingInfo.getRegistryPaintingsForSize(paintingVariant.width(),
paintingVariant.height());
var resourcePaintings = paintingInfo.getResourcePaintingsForSize(paintingVariant.width(),
paintingVariant.height());

if (registryPaintings == null || resourcePaintings == null || resourcePaintings.isEmpty()) {
if (registryPaintings == null || resourcePaintings == null ||
resourcePaintings.isEmpty()) {
return;
}
int numRegistered = registryPaintings.size();
int numAdded = resourcePaintings.size();
int numTotal = numRegistered + numAdded;

// Use the hash of the UUID as a stable random value for this entity.
int hash = entity.getUuid().hashCode();
int hash = paintingEntity.getUuid().hashCode();

// % can be negative, so add the total and % again for the proper modulo.
int modulo = ((hash % (numTotal)) + numTotal) % numTotal;
Expand All @@ -55,8 +48,6 @@ private void switchRenderedPainting(Args args) {
return;
}

// Yay!
var newSprite = getPaintingSprite(newVariant.assetId());
args.set(ARG_PAINTING_SPRITE, newSprite);
paintingEntityRenderState.variant = newVariant;
}
}
8 changes: 3 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"version": "${version}",
"name": "Client side painting variants",
"description": "Add your own painting variants, but completely client-side",
"authors": [
"secret_online"
],
"authors": ["secret_online"],
"license": "MPL-2.0",
"icon": "assets/client-side-painting-variants/icon.png",
"environment": "client",
Expand All @@ -30,8 +28,8 @@
"fabric-api": "*"
},
"recommends": {
"fabricloader": ">=0.16.0",
"minecraft": "1.21.1"
"fabricloader": ">=0.16.8",
"minecraft": "1.21.3"
},
"custom": {
"mc-publish": {
Expand Down
Loading