Skip to content

Commit

Permalink
fixes?
Browse files Browse the repository at this point in the history
Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock committed Feb 28, 2024
1 parent df3f435 commit 3088266
Show file tree
Hide file tree
Showing 43 changed files with 172 additions and 120 deletions.
42 changes: 31 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@ archivesBaseName = project.archives_base_name
version = project.version
group = project.maven_group

loom {
mods {
"ratsmischief" {
sourceSet sourceSets.main
}
}
}

repositories {
mavenLocal()

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

// Mod Menu
maven { url 'https://maven.terraformersmc.com/'}
maven { url = "https://maven.terraformersmc.com/" }

// GeckoLib
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
maven { url = "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/" }

// MialeeMisc
maven { url 'https://maven.willbl.dev/releases/' }
maven { url = "https://maven.willbl.dev/releases/" }

// Publishing
maven {
Expand All @@ -31,32 +41,39 @@ repositories {
}

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

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${quilt_mappings}:intermediary-v2"

modImplementation "software.bernie.geckolib:${project.geckolib_version}"

modImplementation "org.quiltmc:quilt-loader:${project.loader_version}"
modImplementation "org.quiltmc:qsl:${qsl_version}+${minecraft_version}"

modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${quilted_fabric_api_version}-${minecraft_version}"

modImplementation("software.bernie.geckolib:${project.geckolib_version}") {
exclude group: 'net.fabricmc'
exclude group: 'net.fabricmc.fabric-api'
}

// SHEA
modImplementation include("com.github.emilyploszaj:step-height-entity-attribute:${project.shea_version}")
modImplementation include("com.github.emilyploszaj:step-height-entity-attribute:${project.shea_version}") {
exclude group: 'net.fabricmc'
exclude group: 'net.fabricmc.fabric-api'
}

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

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

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

// Requiem
//modCompileOnly("io.github.ladysnake:PlayerAbilityLib:${project.pal_version}")
Expand All @@ -65,7 +82,10 @@ dependencies {
//modImplementation include("io.github.ladysnake:requiem-lite:${project.requiem_version}")

// Trinkets
modImplementation ("dev.emi:trinkets:${project.trinkets_version}")
modImplementation("dev.emi:trinkets:${project.trinkets_version}") {
exclude group: 'net.fabricmc'
exclude group: 'net.fabricmc.fabric-api'
}
}

chenille {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ archives_base_name = ratsmischief
minecraft_version = 1.20.1
quilt_mappings = 23

loader_version = 0.23.0
loader_version = 0.24.0-beta.8

# QSL
qsl_version = 6.1.2

# Quilted Fabric API
quilted_fabric_api_version = 7.4.0+0.90.0
quilted_fabric_api_version = 7.5.0+0.91.0

#Mod Depencencies
mod_menu_version = 7.2.2
cca_version = 5.2.2
geckolib_version = geckolib-fabric-1.20.1:4.3.1
geckolib_version = geckolib-fabric-1.20.1:4.4.2
mialeemisc_version = 1.0.38
pal_version = 1.8.0
shea_version = v1.2.0
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.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public void onInitializeClient(ModContainer mod) {
BuiltinItemRendererRegistry.INSTANCE.register(ModItems.RAT_MASTER_MASK, inventoryItemRenderer);
ModelLoadingPlugin.register(pluginContext -> {
pluginContext.addModels(new ModelIdentifier(itemId, "inventory"));
pluginContext.addModels(new ModelIdentifier(new Identifier(itemId + "_worn"), "inventory"));
pluginContext.addModels(new ModelIdentifier(new Identifier(itemId.getNamespace(), itemId.getPath() + "_worn"), "inventory"));
});

// model predicates
ModelPredicateProviderRegistry.register(new Identifier(RatsMischief.MOD_ID + ":filled"), (itemStack, world, livingEntity, seed) -> itemStack.getOrCreateSubNbt(RatsMischief.MOD_ID).getFloat("filled"));
ModelPredicateProviderRegistry.register(RatsMischief.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.ratsmischief$shouldBringItems();
return playerRatOwner.mischief$shouldBringItems();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import software.bernie.geckolib.model.GeoModel;

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");
private static final Identifier MODEL = RatsMischief.id("geo/entity/rat.geo.json");
private static final Identifier ANIMATION = RatsMischief.id("animations/entity/rat.animation.json");

@Override
public Identifier getModelResource(RatEntity rat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import software.bernie.geckolib.model.GeoModel;

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");
private static final Identifier MODEL = RatsMischief.id("geo/item/rat.geo.json");
private static final Identifier DEFAULT_TEXTURE = RatsMischief.id("textures/entity/wild.png");
private static final Identifier ANIMATION = RatsMischief.id("animations/item/rat.animation.json");

@Override
public Identifier getModelResource(RatItem rat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;

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

private final EnderEyeEntityRenderer enderEyeEntityRenderer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void render(MatrixStack matrixStackIn, RatEntity ratEntity, BakedGeoModel
if (TEXTURES == null) {
TEXTURES = new Identifier[RatEntity.PartyHat.values().length];
for (RatEntity.PartyHat hat : RatEntity.PartyHat.values()) {
TEXTURES[hat.ordinal()] = new Identifier(RatsMischief.MOD_ID, "textures/entity/birthday_hats/" + hat.toString().toLowerCase() + ".png");
TEXTURES[hat.ordinal()] = RatsMischief.id("textures/entity/birthday_hats/" + hat.toString().toLowerCase() + ".png");
}
}
Identifier hatTexture = TEXTURES[ratEntity.getPartyHat().ordinal()];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ladysnake.ratsmischief.client.render.item;

import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
Expand All @@ -14,24 +13,26 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.Unit;
import net.minecraft.util.profiler.Profiler;
import org.jetbrains.annotations.NotNull;
import org.quiltmc.qsl.resource.loader.api.reloader.IdentifiableResourceReloader;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;

public class RatMasterMaskItemRenderer implements BuiltinItemRendererRegistry.DynamicItemRenderer, IdentifiableResourceReloadListener {
public class RatMasterMaskItemRenderer implements BuiltinItemRendererRegistry.DynamicItemRenderer, IdentifiableResourceReloader {
private final Identifier rendererId;
private final Identifier itemId;
private ItemRenderer itemRenderer;
private BakedModel inventoryModel;
private BakedModel wornModel;

public RatMasterMaskItemRenderer(Identifier itemId) {
this.rendererId = new Identifier(itemId.getNamespace(), itemId.getPath() + "_renderer");
this.rendererId = Identifier.tryParse(itemId + "_renderer");
this.itemId = itemId;
}

@Override
public Identifier getFabricId() {
public @NotNull Identifier getQuiltId() {
return this.rendererId;
}

Expand All @@ -43,7 +44,7 @@ public CompletableFuture<Void> reload(Synchronizer synchronizer, ResourceManager
final MinecraftClient client = MinecraftClient.getInstance();
this.itemRenderer = client.getItemRenderer();
this.inventoryModel = client.getBakedModelManager().getModel(new ModelIdentifier(this.itemId, "inventory"));
this.wornModel = client.getBakedModelManager().getModel(new ModelIdentifier(new Identifier(this.itemId + "_worn"), "inventory"));
this.wornModel = client.getBakedModelManager().getModel(new ModelIdentifier(new Identifier(this.itemId.getNamespace(), this.itemId.getPath() + "_worn"), "inventory"));
applyProfiler.pop();
applyProfiler.endTick();
}, applyExecutor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ItemStack craft(RecipeInputInventory inventory, DynamicRegistryManager re
for (int i = 6; i < 9; ++i) {
ItemStack ratStack = inventory.getStack(i);
if (!ratStack.isEmpty()) {
if (ratStack.getItem() instanceof RatItem
if (ratStack.isOf(ModItems.RAT)
&& ratStack.getNbt() != null
&& ratStack.getNbt().contains(RatsMischief.MOD_ID)
&& ratStack.getNbt().getCompound(RatsMischief.MOD_ID).contains("rat")
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/ladysnake/ratsmischief/common/RatsMischief.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import ladysnake.ratsmischief.common.init.ModLootTables;
import ladysnake.ratsmischief.common.init.ModSoundEvents;
import ladysnake.ratsmischief.common.init.ModStatusEffects;
import ladysnake.ratsmischief.common.init.ModTags;
import ladysnake.ratsmischief.common.world.RatSpawner;
import ladysnake.ratsmischief.mialeemisc.MialeeMisc;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
Expand All @@ -17,6 +18,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTables;
import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
Expand All @@ -35,7 +37,6 @@ public class RatsMischief implements ModInitializer {
public static final SpecialRecipeSerializer<SpyRatCraftingRecipe> SPY_RAT_RECIPE = RecipeSerializer.register(
"ratsmischief:crafting_special_spy_rat", new SpecialRecipeSerializer<>(SpyRatCraftingRecipe::new)
);
public static final Identifier ANCIENT_CITY_CHESTS = new Identifier("minecraft", "chests/ancient_city");

public static Identifier id(String path) {
return new Identifier(MOD_ID, path);
Expand All @@ -48,10 +49,11 @@ public void onInitialize(ModContainer mod) {
ModBlocks.initialize();
// ModItemGroup.initialize();
ModItems.initialize();
ModSoundEvents.initialize();
ModEnchantments.initialize();
ModLootTables.initialize();
ModSoundEvents.initialize();
ModStatusEffects.initialize();
ModTags.initialize();

// custom rat spawner in abandoned villages
RatSpawner ratSpawner = new RatSpawner();
Expand All @@ -61,12 +63,12 @@ public void onInitialize(ModContainer mod) {
});

// rat kid painting
Registry.register(Registries.PAINTING_VARIANT, new Identifier(MOD_ID, "a_rat_in_time"), new PaintingVariant(64, 48));
Registry.register(Registries.PAINTING_VARIANT, RatsMischief.id("a_rat_in_time"), new PaintingVariant(64, 48));

// clothed ingots and rat curse books spawning in ancient city chests
UniformLootNumberProvider lootTableRange = UniformLootNumberProvider.create(1, 1);
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, supplier, setter) -> {
if (ANCIENT_CITY_CHESTS.equals(id)) {
if (LootTables.ANCIENT_CITY_CHEST.equals(id)) {
{ // clothed ingot
LootPool lootPool = LootPool.builder()
.rolls(lootTableRange)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RatsMischiefUtils {
// DATES
public static final boolean IS_WORLD_RAT_DAY = DateTimeFormatter.ofPattern("dd/MM").format(LocalDateTime.now()).equals("04/04");
// RENDER
public static final Identifier REMY_TEXTURE = new Identifier(RatsMischief.MOD_ID, "textures/entity/named/remy.png");
public static final Identifier REMY_TEXTURE = RatsMischief.id("textures/entity/named/remy.png");
private static final LocalDate today = LocalDate.now();
public static final boolean IS_RAT_BIRTHDAY = LocalDate.of(today.getYear(), 7, 19).compareTo(today) * today.compareTo(LocalDate.of(today.getYear(), 7, 25)) >= 0;
public static final boolean IS_MISCHIEF_BIRTHDAY = (LocalDate.of(today.getYear(), 12, 28).compareTo(today) * today.compareTo(LocalDate.of(today.getYear(), 12, 31)) >= 0)
Expand All @@ -26,7 +26,7 @@ public static Identifier getRatTexture(RatEntity.Type ratType, DyeColor ratColor
if (RAT_KID_TEXTURES == null) {
RAT_KID_TEXTURES = new Identifier[16];
for (DyeColor color : DyeColor.values()) {
RAT_KID_TEXTURES[color.getId()] = new Identifier(RatsMischief.MOD_ID, "textures/entity/rat_kid/rat_kid_" + color.getName().toLowerCase(Locale.ROOT) + ".png");
RAT_KID_TEXTURES[color.getId()] = RatsMischief.id("textures/entity/rat_kid/rat_kid_" + color.getName().toLowerCase(Locale.ROOT) + ".png");
}
}

Expand Down
Loading

0 comments on commit 3088266

Please sign in to comment.