Compare commits

..

No commits in common. "2c8a6159880ad7f5226447e86fbc46befc4a319f" and "8a984911f61012cf786f1e9117a5ee370feb289c" have entirely different histories.

11 changed files with 41 additions and 107 deletions

View file

@ -3,12 +3,12 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Clone Repository - name: Clone repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '21' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
- name: Cache - name: Cache
uses: actions/cache@v4 uses: actions/cache@v4
@ -16,7 +16,7 @@ jobs:
path: | path: |
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }} key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties') }}
- name: Build - name: Build
run: | run: |
chmod +x ./gradlew chmod +x ./gradlew
@ -25,4 +25,4 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Mod Jar name: Mod Jar
path: build/libs/**.jar path: build/libs/**.jar

View file

@ -1,39 +0,0 @@
on:
push:
tags: ["*"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }}
- name: Grab Changelog from Commit Message Body
run: |
changelog=$(echo -e "$MESSAGE" | sed -n '/^$/,$p' | sed '1d')
echo -e "$changelog"
{
echo 'CHANGELOG<<EOF'
echo -e "$changelog"
echo EOF
} >> "$GITHUB_ENV"
env:
MESSAGE: ${{ github.event.head_commit.message }}
- name: Release
run: |
chmod +x ./gradlew
./gradlew publishMods --no-daemon
env:
MR_TOKEN: ${{ secrets.MR_TOKEN }}
CF_TOKEN: ${{ secrets.CF_TOKEN }}

View file

@ -4,7 +4,6 @@ plugins {
id 'idea' id 'idea'
id 'maven-publish' id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.163' id 'net.neoforged.gradle.userdev' version '7.0.163'
id 'me.modmuss50.mod-publish-plugin' version "0.7.4"
} }
tasks.named('wrapper', Wrapper).configure { tasks.named('wrapper', Wrapper).configure {
@ -167,30 +166,3 @@ idea {
downloadJavadoc = true downloadJavadoc = true
} }
} }
publishMods {
def cfToken = providers.environmentVariable("CF_TOKEN")
def mrToken = providers.environmentVariable("MR_TOKEN")
dryRun = !cfToken.isPresent() || !mrToken.isPresent()
changelog = providers.environmentVariable("CHANGELOG").orElse("")
version = mod_version
type = me.modmuss50.mpp.ReleaseType.valueOf(mod_release_state)
file = jar.archiveFile
modLoaders.add("neoforge")
modrinth {
accessToken = mrToken
projectId = "4cJkN3aF"
minecraftVersions.add(minecraft_version)
requires("patchouli")
optional("curios-continuation")
}
curseforge {
accessToken = cfToken
projectId = "306626"
minecraftVersions.add(minecraft_version)
requires("patchouli")
optional("curios-continuation")
}
}

View file

@ -31,8 +31,7 @@ mod_name=NaturesAura
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT mod_license=MIT
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=41.4 mod_version=41.3
mod_release_state=BETA
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -285,7 +285,7 @@ public final class Helper {
} }
// This is how @ObjectHolder SHOULD work... // This is how @ObjectHolder SHOULD work...
public static <T> void populateObjectHolders(Class<?> clazz, Registry<T> registry, boolean useHolders) { public static <T> void populateObjectHolders(Class<?> clazz, Registry<T> registry) {
for (var entry : clazz.getFields()) { for (var entry : clazz.getFields()) {
if (!Modifier.isStatic(entry.getModifiers())) if (!Modifier.isStatic(entry.getModifiers()))
continue; continue;
@ -295,7 +295,7 @@ public final class Helper {
continue; continue;
} }
try { try {
entry.set(null, useHolders ? registry.getHolder(location).orElseThrow() : registry.get(location)); entry.set(null, registry.get(location));
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
NaturesAura.LOGGER.error(e); NaturesAura.LOGGER.error(e);
} }

View file

@ -63,7 +63,7 @@ public class BreathlessEffect implements IDrainSpotEffect {
return; return;
var entities = level.getEntitiesOfClass(LivingEntity.class, this.bb); var entities = level.getEntitiesOfClass(LivingEntity.class, this.bb);
for (var entity : entities) for (var entity : entities)
entity.addEffect(new MobEffectInstance(ModPotions.BREATHLESS, 300, this.amp)); entity.addEffect(new MobEffectInstance(Holder.direct(ModPotions.BREATHLESS), 300, this.amp));
} }
@Override @Override

View file

@ -1,11 +1,21 @@
/*package de.ellpeck.naturesaura.enchant; package de.ellpeck.naturesaura.enchant;
import net.minecraft.core.Holder; import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.server.ReloadableServerRegistries; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlotGroup;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantment;
public final class ModEnchantments { public final class ModEnchantments {
public static Holder<Enchantment> AURA_MENDING; public static final Enchantment AURA_MENDING = Enchantment.enchantment(
Enchantment.definition(
HolderSet.direct(BuiltInRegistries.ITEM.holders().filter(i -> new ItemStack(i).getCapability(NaturesAuraAPI.AURA_RECHARGE_CAPABILITY) == null).toList()),
// same values as unbreaking, except for the max level
5, 1, Enchantment.dynamicCost(5, 8), Enchantment.dynamicCost(55, 8), 2, EquipmentSlotGroup.ANY)
).build(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mending"));
}*/ }

View file

@ -2,12 +2,15 @@ package de.ellpeck.naturesaura.items;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
import de.ellpeck.naturesaura.reg.ICustomCreativeTab; import de.ellpeck.naturesaura.reg.ICustomCreativeTab;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -38,14 +41,12 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem, ICustomCrea
if (recharge != null) { if (recharge != null) {
if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i)) if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i))
break; break;
} } else if (stack.getEnchantmentLevel(Holder.direct(ModEnchantments.AURA_MENDING)) > 0) {
// TODO fix enchantments, https://gist.github.com/ChampionAsh5357/d895a7b1a34341e19c80870720f9880f#the-enchantment-datapack-object
/*else if (stack.getEnchantmentLevel(ModEnchantments.AURA_MENDING) > 0) {
var mainSize = player.getInventory().items.size(); var mainSize = player.getInventory().items.size();
var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size(); var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size();
if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000)) if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000))
break; break;
}*/ }
} }
} }

View file

@ -1,11 +1,10 @@
package de.ellpeck.naturesaura.potion; package de.ellpeck.naturesaura.potion;
import net.minecraft.core.Holder;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
@SuppressWarnings("NonConstantFieldWithUpperCaseName") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModPotions { public final class ModPotions {
public static Holder<MobEffect> BREATHLESS; public static MobEffect BREATHLESS;
} }

View file

@ -20,7 +20,7 @@ public class PotionBreathless extends PotionImpl {
@SubscribeEvent @SubscribeEvent
public void onHeal(LivingHealEvent event) { public void onHeal(LivingHealEvent event) {
var effect = event.getEntity().getEffect(ModPotions.BREATHLESS); var effect = event.getEntity().getEffect(Holder.direct(this));
if (effect == null) if (effect == null)
return; return;
var chance = (effect.getAmplifier() + 1) / 15F; var chance = (effect.getAmplifier() + 1) / 15F;

View file

@ -12,6 +12,7 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities; import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat; import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
import de.ellpeck.naturesaura.entities.*; import de.ellpeck.naturesaura.entities.*;
import de.ellpeck.naturesaura.gen.LevelGenAncientTree; import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom; import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
@ -28,16 +29,13 @@ import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets; import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.client.resources.PlayerSkin; import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlotGroup;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.item.*; import net.minecraft.world.item.*;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -152,7 +150,7 @@ public final class ModRegistry {
new BlockImpl("sky_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(4F)), new BlockImpl("sky_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(4F)),
new BlockImpl("depth_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(6F)) new BlockImpl("depth_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(6F))
); );
Helper.populateObjectHolders(ModBlocks.class, event.getRegistry(), false); Helper.populateObjectHolders(ModBlocks.class, BuiltInRegistries.BLOCK);
}); });
event.register(Registries.ITEM, h -> { event.register(Registries.ITEM, h -> {
@ -237,7 +235,7 @@ public final class ModRegistry {
new ItemArmor("depth_pants", ModArmorMaterial.DEPTH, ArmorItem.Type.LEGGINGS), new ItemArmor("depth_pants", ModArmorMaterial.DEPTH, ArmorItem.Type.LEGGINGS),
new ItemArmor("depth_shoes", ModArmorMaterial.DEPTH, ArmorItem.Type.BOOTS) new ItemArmor("depth_shoes", ModArmorMaterial.DEPTH, ArmorItem.Type.BOOTS)
); );
Helper.populateObjectHolders(ModItems.class, event.getRegistry(), false); Helper.populateObjectHolders(ModItems.class, BuiltInRegistries.ITEM);
}); });
event.register(Registries.BLOCK_ENTITY_TYPE, h -> { event.register(Registries.BLOCK_ENTITY_TYPE, h -> {
@ -248,12 +246,12 @@ public final class ModRegistry {
if (item instanceof ModTileType<?> type) if (item instanceof ModTileType<?> type)
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, type.getBaseName()), type.type); h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, type.getBaseName()), type.type);
} }
Helper.populateObjectHolders(ModBlockEntities.class, event.getRegistry(), false); Helper.populateObjectHolders(ModBlockEntities.class, BuiltInRegistries.BLOCK_ENTITY_TYPE);
}); });
event.register(Registries.MOB_EFFECT, h -> { event.register(Registries.MOB_EFFECT, h -> {
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "breathless"), new PotionBreathless()); h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "breathless"), new PotionBreathless());
Helper.populateObjectHolders(ModPotions.class, event.getRegistry(), true); Helper.populateObjectHolders(ModPotions.class, BuiltInRegistries.MOB_EFFECT);
}); });
event.register(Registries.MENU, h -> { event.register(Registries.MENU, h -> {
@ -269,18 +267,12 @@ public final class ModRegistry {
IItemHandler handler = ILevelData.getOverworldData(inv.player.level()).getEnderStorage(data.readUtf()); IItemHandler handler = ILevelData.getOverworldData(inv.player.level()).getEnderStorage(data.readUtf());
return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, inv.player, handler); return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, inv.player, handler);
})); }));
Helper.populateObjectHolders(ModContainers.class, event.getRegistry(), false); Helper.populateObjectHolders(ModContainers.class, BuiltInRegistries.MENU);
}); });
/* event.register(Registries.ENCHANTMENT, h -> { event.register(Registries.ENCHANTMENT, h -> {
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mending"), Enchantment.enchantment( h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mending"), ModEnchantments.AURA_MENDING);
Enchantment.definition( });
HolderSet.direct(BuiltInRegistries.ITEM.holders().filter(i -> new ItemStack(i).getCapability(NaturesAuraAPI.AURA_RECHARGE_CAPABILITY) == null).toList()),
// same values as unbreaking, except for the max level
5, 1, Enchantment.dynamicCost(5, 8), Enchantment.dynamicCost(55, 8), 2, EquipmentSlotGroup.ANY)
).build(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mending")));
Helper.populateObjectHolders(ModEnchantments.class, event.getRegistry(), true);
});*/
event.register(Registries.ENTITY_TYPE, h -> { event.register(Registries.ENTITY_TYPE, h -> {
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "mover_cart"), EntityType.Builder h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "mover_cart"), EntityType.Builder
@ -299,7 +291,7 @@ public final class ModRegistry {
.of(EntityStructureFinder::new, MobCategory.MISC) .of(EntityStructureFinder::new, MobCategory.MISC)
.sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true) .sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
.setTrackingRange(64).setUpdateInterval(2).fireImmune().build(NaturesAura.MOD_ID + ":structure_finder")); .setTrackingRange(64).setUpdateInterval(2).fireImmune().build(NaturesAura.MOD_ID + ":structure_finder"));
Helper.populateObjectHolders(ModEntities.class, event.getRegistry(), false); Helper.populateObjectHolders(ModEntities.class, BuiltInRegistries.ENTITY_TYPE);
}); });
event.register(Registries.FEATURE, h -> { event.register(Registries.FEATURE, h -> {
@ -310,7 +302,7 @@ public final class ModRegistry {
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mushroom"), new LevelGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false)); h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mushroom"), new LevelGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false));
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "ancient_tree"), new LevelGenAncientTree()); h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "ancient_tree"), new LevelGenAncientTree());
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom()); h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
Helper.populateObjectHolders(ModFeatures.class, event.getRegistry(), false); Helper.populateObjectHolders(ModFeatures.class, BuiltInRegistries.FEATURE);
}); });
event.register(Registries.RECIPE_TYPE, h -> { event.register(Registries.RECIPE_TYPE, h -> {