mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-23 20:28:35 +01:00
Compare commits
12 commits
8a984911f6
...
2c8a615988
Author | SHA1 | Date | |
---|---|---|---|
2c8a615988 | |||
86adb22987 | |||
9436fc38d6 | |||
042710137f | |||
2e8e9c1016 | |||
044cd861a5 | |||
f3c7f87733 | |||
a20b857727 | |||
a4dd617bcf | |||
70995f4388 | |||
b3701fbada | |||
7ac1c3d66d |
11 changed files with 107 additions and 41 deletions
|
@ -3,12 +3,12 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
|
@ -16,7 +16,7 @@ jobs:
|
|||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties') }}
|
||||
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }}
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x ./gradlew
|
||||
|
@ -25,4 +25,4 @@ jobs:
|
|||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Mod Jar
|
||||
path: build/libs/**.jar
|
||||
path: build/libs/**.jar
|
39
.github/workflows/release.yml
vendored
Normal file
39
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
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 }}
|
28
build.gradle
28
build.gradle
|
@ -4,6 +4,7 @@ plugins {
|
|||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.163'
|
||||
id 'me.modmuss50.mod-publish-plugin' version "0.7.4"
|
||||
}
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
|
@ -166,3 +167,30 @@ idea {
|
|||
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")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ mod_name=NaturesAura
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=MIT
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=41.3
|
||||
mod_version=41.4
|
||||
mod_release_state=BETA
|
||||
# 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.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -285,7 +285,7 @@ public final class Helper {
|
|||
}
|
||||
|
||||
// This is how @ObjectHolder SHOULD work...
|
||||
public static <T> void populateObjectHolders(Class<?> clazz, Registry<T> registry) {
|
||||
public static <T> void populateObjectHolders(Class<?> clazz, Registry<T> registry, boolean useHolders) {
|
||||
for (var entry : clazz.getFields()) {
|
||||
if (!Modifier.isStatic(entry.getModifiers()))
|
||||
continue;
|
||||
|
@ -295,7 +295,7 @@ public final class Helper {
|
|||
continue;
|
||||
}
|
||||
try {
|
||||
entry.set(null, registry.get(location));
|
||||
entry.set(null, useHolders ? registry.getHolder(location).orElseThrow() : registry.get(location));
|
||||
} catch (IllegalAccessException e) {
|
||||
NaturesAura.LOGGER.error(e);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BreathlessEffect implements IDrainSpotEffect {
|
|||
return;
|
||||
var entities = level.getEntitiesOfClass(LivingEntity.class, this.bb);
|
||||
for (var entity : entities)
|
||||
entity.addEffect(new MobEffectInstance(Holder.direct(ModPotions.BREATHLESS), 300, this.amp));
|
||||
entity.addEffect(new MobEffectInstance(ModPotions.BREATHLESS, 300, this.amp));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
package de.ellpeck.naturesaura.enchant;
|
||||
/*package de.ellpeck.naturesaura.enchant;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
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.core.Holder;
|
||||
import net.minecraft.server.ReloadableServerRegistries;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
|
||||
public final class ModEnchantments {
|
||||
|
||||
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"));
|
||||
public static Holder<Enchantment> AURA_MENDING;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -2,15 +2,12 @@ package de.ellpeck.naturesaura.items;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
||||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||
import de.ellpeck.naturesaura.reg.ICustomCreativeTab;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -41,12 +38,14 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem, ICustomCrea
|
|||
if (recharge != null) {
|
||||
if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i))
|
||||
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 isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size();
|
||||
if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000))
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package de.ellpeck.naturesaura.potion;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
|
||||
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||
public final class ModPotions {
|
||||
|
||||
public static MobEffect BREATHLESS;
|
||||
public static Holder<MobEffect> BREATHLESS;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class PotionBreathless extends PotionImpl {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onHeal(LivingHealEvent event) {
|
||||
var effect = event.getEntity().getEffect(Holder.direct(this));
|
||||
var effect = event.getEntity().getEffect(ModPotions.BREATHLESS);
|
||||
if (effect == null)
|
||||
return;
|
||||
var chance = (effect.getAmplifier() + 1) / 15F;
|
||||
|
|
|
@ -12,7 +12,6 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
||||
import de.ellpeck.naturesaura.compat.Compat;
|
||||
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
||||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||
import de.ellpeck.naturesaura.entities.*;
|
||||
import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
|
||||
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
|
||||
|
@ -29,13 +28,16 @@ import de.ellpeck.naturesaura.recipes.ModRecipes;
|
|||
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.client.resources.PlayerSkin;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -150,7 +152,7 @@ public final class ModRegistry {
|
|||
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))
|
||||
);
|
||||
Helper.populateObjectHolders(ModBlocks.class, BuiltInRegistries.BLOCK);
|
||||
Helper.populateObjectHolders(ModBlocks.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.ITEM, h -> {
|
||||
|
@ -235,7 +237,7 @@ public final class ModRegistry {
|
|||
new ItemArmor("depth_pants", ModArmorMaterial.DEPTH, ArmorItem.Type.LEGGINGS),
|
||||
new ItemArmor("depth_shoes", ModArmorMaterial.DEPTH, ArmorItem.Type.BOOTS)
|
||||
);
|
||||
Helper.populateObjectHolders(ModItems.class, BuiltInRegistries.ITEM);
|
||||
Helper.populateObjectHolders(ModItems.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.BLOCK_ENTITY_TYPE, h -> {
|
||||
|
@ -246,12 +248,12 @@ public final class ModRegistry {
|
|||
if (item instanceof ModTileType<?> type)
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, type.getBaseName()), type.type);
|
||||
}
|
||||
Helper.populateObjectHolders(ModBlockEntities.class, BuiltInRegistries.BLOCK_ENTITY_TYPE);
|
||||
Helper.populateObjectHolders(ModBlockEntities.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.MOB_EFFECT, h -> {
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "breathless"), new PotionBreathless());
|
||||
Helper.populateObjectHolders(ModPotions.class, BuiltInRegistries.MOB_EFFECT);
|
||||
Helper.populateObjectHolders(ModPotions.class, event.getRegistry(), true);
|
||||
});
|
||||
|
||||
event.register(Registries.MENU, h -> {
|
||||
|
@ -267,12 +269,18 @@ public final class ModRegistry {
|
|||
IItemHandler handler = ILevelData.getOverworldData(inv.player.level()).getEnderStorage(data.readUtf());
|
||||
return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, inv.player, handler);
|
||||
}));
|
||||
Helper.populateObjectHolders(ModContainers.class, BuiltInRegistries.MENU);
|
||||
Helper.populateObjectHolders(ModContainers.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.ENCHANTMENT, h -> {
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_mending"), ModEnchantments.AURA_MENDING);
|
||||
});
|
||||
/* event.register(Registries.ENCHANTMENT, h -> {
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "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")));
|
||||
Helper.populateObjectHolders(ModEnchantments.class, event.getRegistry(), true);
|
||||
});*/
|
||||
|
||||
event.register(Registries.ENTITY_TYPE, h -> {
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "mover_cart"), EntityType.Builder
|
||||
|
@ -291,7 +299,7 @@ public final class ModRegistry {
|
|||
.of(EntityStructureFinder::new, MobCategory.MISC)
|
||||
.sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
|
||||
.setTrackingRange(64).setUpdateInterval(2).fireImmune().build(NaturesAura.MOD_ID + ":structure_finder"));
|
||||
Helper.populateObjectHolders(ModEntities.class, BuiltInRegistries.ENTITY_TYPE);
|
||||
Helper.populateObjectHolders(ModEntities.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.FEATURE, h -> {
|
||||
|
@ -302,7 +310,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, "ancient_tree"), new LevelGenAncientTree());
|
||||
h.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
|
||||
Helper.populateObjectHolders(ModFeatures.class, BuiltInRegistries.FEATURE);
|
||||
Helper.populateObjectHolders(ModFeatures.class, event.getRegistry(), false);
|
||||
});
|
||||
|
||||
event.register(Registries.RECIPE_TYPE, h -> {
|
||||
|
|
Loading…
Reference in a new issue