Skip to content

Commit

Permalink
Update to 1.21, fix #7
Browse files Browse the repository at this point in the history
  • Loading branch information
thecolonel63 committed Jun 30, 2024
1 parent 7bc2ee2 commit a75361f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
24 changes: 16 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
Expand All @@ -19,27 +23,31 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation(fabricApi.module("fabric-resource-loader-v0", "0.83.0+1.20"))
modImplementation(fabricApi.module("fabric-resource-loader-v0", "0.100.4+1.21"))
}

processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
filteringCharset "UTF-8"

filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"loader_version": project.loader_version
}
}

def targetJavaVersion = 17
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
it.options.release.set(targetJavaVersion)
}
}

Expand All @@ -48,7 +56,6 @@ java {
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
Expand All @@ -57,14 +64,15 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21
minecraft_version=1.21
yarn_mappings=1.21+build.7
loader_version=0.15.11
# Mod Properties
mod_version=1.0.4
mod_version=1.0.5
maven_group=com.thecolonel63
archives_base_name=technomodel

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,27 @@
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.Saddleable;
import net.minecraft.util.Identifier;

public class TechnoCrownFeatureRenderer<T extends Entity & Saddleable, M extends EntityModel<T>> extends FeatureRenderer<T, M> {
public class TechnoCrownFeatureRenderer<T extends Entity, M extends EntityModel<T>> extends FeatureRenderer<T, M> {

private final Identifier TEXTURE;
private final Identifier TEXTURE = Identifier.ofVanilla("textures/entity/pig/technocrown.png");
private final M model;

public TechnoCrownFeatureRenderer(FeatureRendererContext<T, M> context, M model, Identifier texture) {
public TechnoCrownFeatureRenderer(FeatureRendererContext<T, M> context, M model) {
super(context);
this.TEXTURE = texture;
this.model = model;
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("DataFlowIssue")
@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, T entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
if (entity.hasCustomName() && entity.getCustomName().getString().equals("Technoblade")) {
this.getContextModel().copyStateTo(this.model);
this.model.animateModel(entity, limbAngle, limbDistance, tickDelta);
this.model.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(this.TEXTURE));
this.model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
this.model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.render.entity.model.PigEntityModel;
import net.minecraft.util.Identifier;
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.CallbackInfo;

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({"unchecked", "rawtypes"})
@Mixin(PigEntityRenderer.class)
public abstract class PigEntityRendererMixin extends LivingEntityRenderer {
public PigEntityRendererMixin(EntityRendererFactory.Context ctx, EntityModel model, float shadowRadius) {
Expand All @@ -22,6 +21,6 @@ public PigEntityRendererMixin(EntityRendererFactory.Context ctx, EntityModel mod

@Inject(method = "<init>(Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;)V", at = @At("TAIL"))
private void addTechnoCrownFeature(EntityRendererFactory.Context context, CallbackInfo ci) {
this.addFeature(new TechnoCrownFeatureRenderer(((PigEntityRenderer) (Object) this), new PigEntityModel(context.getPart(EntityModelLayers.PIG_SADDLE)), new Identifier("textures/entity/pig/technocrown.png")));
this.addFeature(new TechnoCrownFeatureRenderer(((PigEntityRenderer) (Object) this), new PigEntityModel(context.getPart(EntityModelLayers.PIG_SADDLE))));
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"technomodel.mixins.json"
],
"depends": {
"minecraft": ">=1.19.3",
"minecraft": ">=1.21",
"fabric-resource-loader-v0": "*"
}
}

0 comments on commit a75361f

Please sign in to comment.