Skip to content

Commit

Permalink
Initial port to 1.20.1
Browse files Browse the repository at this point in the history
Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock committed Jan 8, 2024
1 parent 8d24a94 commit df3f435
Show file tree
Hide file tree
Showing 72 changed files with 703 additions and 403 deletions.
35 changes: 17 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ version = project.version
group = project.maven_group

repositories {
// publishing
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven"
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}

// CCA, Requiem
chenille.repositories.ladysnake()

Expand All @@ -30,8 +20,18 @@ repositories {
// MialeeMisc
maven { url 'https://maven.willbl.dev/releases/' }

maven { url 'https://jitpack.io' }
// Publishing
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven"
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}

mavenCentral()
maven { url 'https://jitpack.io' }
mavenLocal()
}

Expand All @@ -47,25 +47,24 @@ dependencies {
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${quilted_fabric_api_version}-${minecraft_version}"

// SHEA
modImplementation include("com.github.emilyploszaj:step-height-entity-attribute:v1.0.1")
modImplementation include("com.github.emilyploszaj:step-height-entity-attribute:${project.shea_version}")

// Mod Menu
modLocalImplementation("com.terraformersmc:modmenu:${mod_menu_version}") { transitive = false }

// MixinExtras
implementation include("com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}")
annotationProcessor("com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}")

// MialeeMisc
modImplementation include("xyz.amymialee:mialeemisc:${project.mialeemisc_version}")
//modImplementation include("xyz.amymialee:mialeemisc:${project.mialeemisc_version}")

// CCA
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}")

// Requiem
//modCompileOnly("io.github.ladysnake:PlayerAbilityLib:${project.pal_version}")
//modImplementation("io.github.ladysnake:requiem-api:${project.requiem_version}")
//modImplementation("io.github.ladysnake:requiem-core:${project.requiem_version}")
//modImplementation include("io.github.ladysnake:requiem-lite:${project.requiem_version}")

// trinkets
// Trinkets
modImplementation ("dev.emi:trinkets:${project.trinkets_version}")
}

Expand Down
26 changes: 12 additions & 14 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@ version = 2.0.1
maven_group = ladysnake
archives_base_name = ratsmischief

minecraft_version=1.19.2
quilt_mappings=22
minecraft_version = 1.20.1
quilt_mappings = 23

loader_version=0.21.2
loader_version = 0.23.0

# QSL
qsl_version = 3.0.0-beta.29
qsl_version = 6.1.2

# Quilted Fabric API
quilted_fabric_api_version = 4.0.0-beta.30+0.76.0
quilted_fabric_api_version = 7.4.0+0.90.0

#Mod Depencencies
mod_menu_version=4.1.2
cca_version=5.0.2
geckolib_version=geckolib-quilt-1.19:3.1.41
mixin_extras_version=0.2.0-beta.4
mialeemisc_version=1.0.39
pal_version = 1.6.0
requiem_version = 2.0.0-beta.16.stripped
trinkets_version=3.4.1
elegantarmour_version=1.0-SNAPSHOT
mod_menu_version = 7.2.2
cca_version = 5.2.2
geckolib_version = geckolib-fabric-1.20.1:4.3.1
mialeemisc_version = 1.0.38
pal_version = 1.8.0
shea_version = v1.2.0
trinkets_version = 3.7.1

# Release metadata
modrinth_id = Jjc1149h
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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ pluginManagement {
name = 'Quilt'
url = 'https://maven.quiltmc.org/repository/release'
}
// Currently needed for Intermediary and other temporary dependencies
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
mavenCentral()
}
}
27 changes: 10 additions & 17 deletions src/main/java/ladysnake/ratsmischief/client/RatsMischiefClient.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
package ladysnake.ratsmischief.client;

import ladysnake.ratsmischief.client.render.entity.RatEntityRenderer;
import ladysnake.ratsmischief.client.render.item.RatItemRenderer;
import ladysnake.ratsmischief.client.render.item.RatMasterMaskItemRenderer;
import ladysnake.ratsmischief.common.RatsMischief;
import ladysnake.ratsmischief.common.init.ModEntities;
import ladysnake.ratsmischief.common.init.ModItems;
import ladysnake.ratsmischief.common.init.ModParticles;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.model.Dilation;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.registry.Registries;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import software.bernie.geckolib3.renderers.geo.GeoItemRenderer;
import xyz.amymialee.mialeemisc.MialeeMiscClient;
import org.quiltmc.qsl.resource.loader.api.ResourceLoader;

public class RatsMischiefClient implements ClientModInitializer {
public static final EntityModelLayer RAT_MASTER_ARMOR_INNER_LAYER = new EntityModelLayer(RatsMischief.id("rat_master_inner_layer"), "main");
Expand All @@ -46,21 +42,18 @@ public void onInitializeClient(ModContainer mod) {
ModParticles.init();

EntityRendererRegistry.register(ModEntities.RAT, RatEntityRenderer::new);
GeoItemRenderer.registerItemRenderer(ModItems.RAT, new RatItemRenderer());

Identifier itemId = Registry.ITEM.getId(ModItems.RAT_MASTER_MASK);
Identifier itemId = Registries.ITEM.getId(ModItems.RAT_MASTER_MASK);
RatMasterMaskItemRenderer inventoryItemRenderer = new RatMasterMaskItemRenderer(itemId);
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(inventoryItemRenderer);
ResourceLoader.get(ResourceType.CLIENT_RESOURCES).registerReloader(inventoryItemRenderer);
BuiltinItemRendererRegistry.INSTANCE.register(ModItems.RAT_MASTER_MASK, inventoryItemRenderer);
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> {
out.accept(new ModelIdentifier(itemId, "inventory"));
out.accept(new ModelIdentifier(itemId + "_worn", "inventory"));
});
MialeeMiscClient.INVENTORY_ITEMS.add(ModItems.RAT_MASTER_MASK);
ModelLoadingPlugin.register(pluginContext -> {
pluginContext.addModels(new ModelIdentifier(itemId, "inventory"));
pluginContext.addModels(new ModelIdentifier(new Identifier(itemId + "_worn"), "inventory"));
});

// model predicates
FabricModelPredicateProviderRegistry.register(new Identifier(RatsMischief.MOD_ID + ":filled"), (itemStack, world, livingEntity, seed) -> itemStack.getOrCreateSubNbt(RatsMischief.MOD_ID).getFloat("filled"));

ModelPredicateProviderRegistry.register(new Identifier(RatsMischief.MOD_ID + ":filled"), (itemStack, world, livingEntity, seed) -> itemStack.getOrCreateSubNbt(RatsMischief.MOD_ID).getFloat("filled"));

// // block render layer map
// BlockRenderLayerMap.put(RenderLayer.getCutout(), ModBlock.MOD_BLOCK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void addSetBonus(List<Text> tooltip) {
public static boolean shouldRatsBringItems() {
PlayerEntity player = MinecraftClient.getInstance().player;
if (player instanceof PlayerRatOwner playerRatOwner) {
return playerRatOwner.shouldBringItems();
return playerRatOwner.ratsmischief$shouldBringItems();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import ladysnake.ratsmischief.common.entity.RatEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
import software.bernie.geckolib3.core.processor.IBone;
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel;

public class RatEntityModel extends AnimatedGeoModel<RatEntity> {
public class RatEntityModel extends GeoModel<RatEntity> {
private static final Identifier MODEL = new Identifier(RatsMischief.MOD_ID, "geo/entity/rat.geo.json");
private static final Identifier ANIMATION = new Identifier(RatsMischief.MOD_ID, "animations/entity/rat.animation.json");

Expand All @@ -29,32 +29,32 @@ public Identifier getAnimationResource(RatEntity rat) {
}

@Override
public void setCustomAnimations(RatEntity ratEntity, int instanceId, AnimationEvent animationEvent) {
super.setCustomAnimations(ratEntity, instanceId, animationEvent);
public void setCustomAnimations(RatEntity ratEntity, long instanceId, AnimationState<RatEntity> animationState) {
super.setCustomAnimations(ratEntity, instanceId, animationState);

IBone head = this.getAnimationProcessor().getBone("head");
IBone leftEar = this.getAnimationProcessor().getBone("leftear");
IBone rightEar = this.getAnimationProcessor().getBone("rightear");
CoreGeoBone head = this.getAnimationProcessor().getBone("head");
CoreGeoBone leftEar = this.getAnimationProcessor().getBone("leftear");
CoreGeoBone rightEar = this.getAnimationProcessor().getBone("rightear");

if (head != null && !ratEntity.isSniffing() && !ratEntity.isEating() && !ratEntity.isFlying()) {
head.setRotationX(MathHelper.clamp(-ratEntity.getPitch(), 0, 90) * ((float) Math.PI / 180F));
leftEar.setRotationX(MathHelper.clamp(ratEntity.getPitch(), -90, 0) * 1.4f * ((float) Math.PI / 180F));
rightEar.setRotationX(MathHelper.clamp(ratEntity.getPitch(), -90, 0) * 1.4f * ((float) Math.PI / 180F));
head.setRotX(MathHelper.clamp(-ratEntity.getPitch(), 0, 90) * ((float) Math.PI / 180F));
leftEar.setRotX(MathHelper.clamp(ratEntity.getPitch(), -90, 0) * 1.4f * ((float) Math.PI / 180F));
rightEar.setRotX(MathHelper.clamp(ratEntity.getPitch(), -90, 0) * 1.4f * ((float) Math.PI / 180F));

// head.setRotationY(ratEntity.getHeadYaw() * ((float) Math.PI / 180F));
}

// sexually aroused rat
if (ratEntity.isAroused()) {
software.bernie.geckolib3.core.processor.IBone tail = this.getAnimationProcessor().getBone("tail");
software.bernie.geckolib3.core.processor.IBone tailend = this.getAnimationProcessor().getBone("tailend");
CoreGeoBone tail = this.getAnimationProcessor().getBone("tail");
CoreGeoBone tailend = this.getAnimationProcessor().getBone("tailend");

tail.setRotationX((float) (-45 * Math.PI / 180));
tailend.setRotationX((float) (-30 * Math.PI / 180));
tail.setRotX((float) (-45 * Math.PI / 180));
tailend.setRotX((float) (-30 * Math.PI / 180));
}

if (ratEntity.isBaby()) {
IBone root = this.getAnimationProcessor().getBone("root");
CoreGeoBone root = this.getAnimationProcessor().getBone("root");
if (root != null) {
root.setScaleX(0.5f);
root.setScaleY(0.5f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import ladysnake.ratsmischief.common.RatsMischief;
import ladysnake.ratsmischief.common.item.RatItem;
import net.minecraft.util.Identifier;
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib.model.GeoModel;

public class RatItemModel extends AnimatedGeoModel<RatItem> {
public class RatItemModel extends GeoModel<RatItem> {
private static final Identifier MODEL = new Identifier(RatsMischief.MOD_ID, "geo/item/rat.geo.json");
private static final Identifier DEFAULT_TEXTURE = new Identifier(RatsMischief.MOD_ID, "textures/entity/wild.png");
private static final Identifier ANIMATION = new Identifier(RatsMischief.MOD_ID, "animations/item/rat.animation.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import ladysnake.ratsmischief.common.entity.RatEntity;
import net.minecraft.client.render.entity.EntityRendererFactory;
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;

public class EnderEyeEntityRenderer extends GeoEntityRenderer<RatEntity> {
protected EnderEyeEntityRenderer(EntityRendererFactory.Context ctx, AnimatedGeoModel<RatEntity> modelProvider) {
protected EnderEyeEntityRenderer(EntityRendererFactory.Context ctx, GeoModel<RatEntity> modelProvider) {
super(ctx, modelProvider);
}
}
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
package ladysnake.ratsmischief.client.render.entity;

import com.mojang.blaze3d.vertex.VertexConsumer;
import ladysnake.ratsmischief.common.RatsMischief;
import ladysnake.ratsmischief.common.entity.RatEntity;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import software.bernie.geckolib3.renderers.geo.GeoLayerRenderer;
import software.bernie.geckolib3.renderers.geo.IGeoRenderer;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;

public class EnderEyeFeatureRenderer extends GeoLayerRenderer<RatEntity> {
public class EnderEyeFeatureRenderer extends GeoRenderLayer<RatEntity> {
public static final Identifier TEXTURE = new Identifier(RatsMischief.MOD_ID, "textures/entity/ender_eye.png");

private final EnderEyeEntityRenderer enderEyeEntityRenderer;

public EnderEyeFeatureRenderer(IGeoRenderer<RatEntity> entityRendererIn, EnderEyeEntityRenderer enderEyeEntityRenderer) {
public EnderEyeFeatureRenderer(GeoEntityRenderer<RatEntity> entityRendererIn, EnderEyeEntityRenderer enderEyeEntityRenderer) {
super(entityRendererIn);
this.enderEyeEntityRenderer = enderEyeEntityRenderer;
}

@Override
public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, RatEntity ratEntity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
public void render(MatrixStack matrixStackIn, RatEntity ratEntity, BakedGeoModel bakedModel, RenderLayer renderType, VertexConsumerProvider bufferSourceIn, VertexConsumer bufferIn, float partialTicks, int packedLightIn, int packedOverlayIn) {
if (ratEntity.isSpy() && !ratEntity.isInvisible()) {
this.enderEyeEntityRenderer.render(this.getEntityModel().getModel(this.getEntityModel().getModelResource(ratEntity)),
this.enderEyeEntityRenderer.defaultRender(
matrixStackIn,
ratEntity,
partialTicks,
bufferSourceIn,
RenderLayer.getEntityCutout(TEXTURE),
matrixStackIn,
bufferIn,
bufferIn.getBuffer(RenderLayer.getEntityCutout(TEXTURE)),
packedLightIn, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
0.0F,
partialTicks,
packedLightIn
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import ladysnake.ratsmischief.common.entity.RatEntity;
import net.minecraft.client.render.entity.EntityRendererFactory;
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;

public class PartyHatEntityRenderer extends GeoEntityRenderer<RatEntity> {
protected PartyHatEntityRenderer(EntityRendererFactory.Context ctx, AnimatedGeoModel<RatEntity> modelProvider) {
protected PartyHatEntityRenderer(EntityRendererFactory.Context ctx, GeoModel<RatEntity> modelProvider) {
super(ctx, modelProvider);
}
}
Loading

0 comments on commit df3f435

Please sign in to comment.