Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,233 changes: 1,233 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

72 changes: 52 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import net.darkhax.curseforgegradle.TaskPublishCurseForge

import java.nio.charset.StandardCharsets

Expand All @@ -26,6 +27,7 @@ plugins {
id "com.modrinth.minotaur" version "2.+"
id 'org.spongepowered.mixin' version '0.7.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'net.darkhax.curseforgegradle' version '1.1.15'
}

version = "${version}"
Expand Down Expand Up @@ -103,7 +105,7 @@ repositories {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
maven { url = "https://maven.komaru.ru/repository/maven-releases" }
maven { url = "https://repo.komaru.studio/releases" }
maven { url "https://maven.theillusivec4.top/"}
maven { url "https://cursemaven.com"}
maven { url "https://maven.blamejared.com"}
Expand Down Expand Up @@ -218,17 +220,11 @@ tasks.withType(GenerateModuleMetadata) {
enabled = false
}

//lightweight version
task apiJar(type: Jar) {
archiveClassifier.set('api')
from sourceSets.main.allSource
from sourceSets.main.output
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

task noSounds(type: Jar) {
archiveClassifier.set('nosounds')
from sourceSets.main.output
exclude("assets/valoria/sounds/**")
exclude("assets/valoria/**")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

Expand All @@ -251,27 +247,21 @@ task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
}

artifacts {
archives sourcesJar
}

processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
artifact noMusicJar
artifact sourcesJar
artifact apiJar
artifact sourcesJar
}
}

repositories{
maven{
url "https://maven.komaru.ru/repository/maven-releases/"
url "https://repo.komaru.studio/releases"
credentials{
username "admin"
password System.getenv("maventoken")
Expand All @@ -284,14 +274,56 @@ tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

def getChangelogText() {
def changelogFile = file('CHANGELOG.md')
if (!changelogFile.exists()) return ""

def lines = changelogFile.readLines()
def currentLog = new StringBuilder()
def reading = false
def cleanVersion = version.toString().replace("1.20.1-", "")
for (line in lines) {
def trimmed = line.trim()
if (trimmed.startsWith("#") && !trimmed.contains("**")) {
if (trimmed.contains(cleanVersion)) {
reading = true
continue
}else if (reading) {
break
}
}

if (reading) {
currentLog.append(line).append('\n')
}
}

return currentLog.toString().trim()
}

task curseforge(type: TaskPublishCurseForge) {
apiToken = System.getenv("cursetoken")
def projectId = "698244"
def mainFile = upload(projectId, jar)
mainFile.displayName = "Valoria-${version}"
mainFile.changelog = getChangelogText()

mainFile.addRequirement("tridot")
mainFile.addRequirement("geckolib")
mainFile.addRequirement("curios")

mainFile.withAdditionalFile(noMusicJar)
}

modrinth {
token = System.getenv("modrinthtoken")
projectId = "valoria"
versionNumber = "${version}"
versionNumber = version.toString().replace("1.20.1-", "");
versionType = "release"
versionName = "${version}"
versionName = "Valoria-${version}"
changelog = getChangelogText()
uploadFile = tasks.jar
additionalFiles = [sourcesJar]
additionalFiles = [noMusicJar]
dependencies {
required.version "tridot", "${tridot_version}"
required.project "geckolib"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ forge_version=47.2.20
version=1.20.1-1.0.2.4
curios_version=5.10.0
geckolib_version=4.8.2
tridot_version=1.0.126
tridot_version=1.0.130
tridot_version_range=[1.20.1-1.0.122,)

# compat
Expand Down
44 changes: 34 additions & 10 deletions src/main/java/com/idark/valoria/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.idark.valoria.api.unlockable.*;
import com.idark.valoria.api.unlockable.types.*;
import com.idark.valoria.client.ui.screen.book.codex.*;
import com.idark.valoria.client.ui.screen.book.codex.checklist.*;
import com.idark.valoria.core.capability.*;
import com.idark.valoria.core.config.*;
import com.idark.valoria.core.interfaces.*;
Expand Down Expand Up @@ -179,7 +178,6 @@ public static void onMissingMappings(MissingMappingsEvent event){
public void onReload(AddReloadListenerEvent event){
Valoria.LOGGER.info("Reloading Codex Chapters...");
CodexEntries.initChapters();
event.addListener(BossEntryLoader.INSTANCE);
}

@SubscribeEvent
Expand Down Expand Up @@ -298,10 +296,10 @@ public void playerTick(TickEvent.PlayerTickEvent event){

Player player = event.player;
if(!player.level().isClientSide() && player instanceof ServerPlayer serverPlayer){
if(CommonConfig.NIHILITY.get()){
if(ServerConfig.ENABLE_NIHILITY.get()){
player.getCapability(INihilityLevel.INSTANCE).ifPresent(nihilityLevel -> {
if(!player.getAbilities().instabuild && !player.isSpectator()){
NihilityEvent.tick(event, nihilityLevel, player);
NihilityEvent.tick(event, nihilityLevel, serverPlayer);
}
});
}
Expand All @@ -312,7 +310,7 @@ public void playerTick(TickEvent.PlayerTickEvent event){
}
});

if(player.tickCount % 60 == 0){
if(player.tickCount % ServerConfig.CODEX_UPDATE_INTERVAL.get() * 20 == 0){
ArrayList<Unlockable> all = new ArrayList<>(Unlockables.get());
Set<Unlockable> unlocked = UnlockUtils.getUnlocked(serverPlayer);
if(unlocked != null) all.removeAll(unlocked);
Expand All @@ -322,15 +320,15 @@ public void playerTick(TickEvent.PlayerTickEvent event){
}
}

if(CommonConfig.NIHILITY.get()){
if(ServerConfig.ENABLE_NIHILITY.get()){
if(player.level().isClientSide()){
player.getCapability(INihilityLevel.INSTANCE).ifPresent(nihilityLevel -> NihilityEvent.clientTick(nihilityLevel, player));
}
}

if(CommonConfig.FOOD_ROT.get()){
if(ServerConfig.ENABLE_FOOD_ROT.get()){
if(player.level().dimension().equals(LevelGen.VALORIA_KEY)){
if(player.tickCount % 60 == 0){
if(player.tickCount % ServerConfig.FOOD_ROT_INTERVAL.get() * 20 == 0){
Inventory inv = player.getInventory();
for(int i = 0; i < inv.getContainerSize(); i++){
ItemStack stack = inv.getItem(i);
Expand Down Expand Up @@ -456,11 +454,28 @@ public void onEffectApply(MobEffectEvent.Applicable event){
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event){
if(event.getSource().is(DamageTypeTags.BYPASSES_ARMOR)) return;
var source = event.getSource();
Entity attackerEntity = source.getEntity();
LivingEntity target = event.getEntity();
ILivingEntityData data = (ILivingEntityData)target;
if (source.getDirectEntity() instanceof Player player) {
if (target instanceof IEffectiveWeaponEntity eff) {
if(eff.getEffective() == null) {
Valoria.LOGGER.debug("Effective weapon tag is null for {}", target);
return;
}

if (player.getMainHandItem().is(eff.getEffective())) {
float currentDamage = event.getAmount();
float newDamage = currentDamage * eff.scaleFactor();
event.setAmount(newDamage);
data.valoria$setLastDamageWithSource(event.getSource(), event.getAmount());
}
}
}

Entity attackerEntity = event.getSource().getEntity();
if (!(attackerEntity instanceof LivingEntity attacker)) return;

LivingEntity target = event.getEntity();
float totalBonus = 0f;
if(!(attacker instanceof Player && target instanceof Player)){
for(ElementalType type : ElementalTypes.ELEMENTALS){
Expand All @@ -473,6 +488,7 @@ public void onLivingHurt(LivingHurtEvent event){
}

event.setAmount(event.getAmount() + totalBonus);
data.valoria$setLastDamageWithSource(event.getSource(), event.getAmount());
}

private static float applyAttackBonus(AttributeInstance attackAttr, AttributeInstance resistAttr, LivingEntity target, float totalBonus){
Expand All @@ -495,6 +511,14 @@ public void onLivingAttack(LivingAttackEvent event){
var pSource = event.getSource();
var entity = event.getEntity();
var level = entity.level();
if (pSource.getDirectEntity() instanceof Player player && level.isClientSide()) {
if (entity instanceof IEffectiveWeaponEntity eff){
if(player.getMainHandItem().is(eff.getEffective())){
eff.spawnHitParticles(entity.level(), entity.blockPosition());
}
}
}

if(pSource.getEntity() instanceof LivingEntity attacker){
ILivingEntityData data = (ILivingEntityData)entity;
if(level instanceof ServerLevel s){
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/idark/valoria/Valoria.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class Valoria{
public static final GameRules.Key<GameRules.BooleanValue> TRAP_ACTIVATING = GameRules.register("valoria:trapActivating", Category.MISC, GameRules.BooleanValue.create(true));

public Valoria(){
ConfigMigrator.migrate();
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
EffectsRegistry.register(eventBus);
EnchantmentsRegistry.register(eventBus);
Expand All @@ -102,9 +103,9 @@ public Valoria(){
SoundsRegistry.register(eventBus);

IEventBus forgeBus = MinecraftForge.EVENT_BUS;
ModLoadingContext.get().registerConfig(Type.SERVER, ServerConfig.SPEC);
ModLoadingContext.get().registerConfig(Type.CLIENT, ClientConfig.SPEC);
ModLoadingContext.get().registerConfig(Type.COMMON, CommonConfig.SPEC);
ModLoadingContext.get().registerConfig(Type.SERVER, ServerConfig.SPEC, "valoria/server.toml");
ModLoadingContext.get().registerConfig(Type.CLIENT, ClientConfig.SPEC, "valoria/client.toml");
ModLoadingContext.get().registerConfig(Type.COMMON, CommonConfig.SPEC, "valoria/common.toml");
DistExecutor.unsafeCallWhenOn(Dist.CLIENT, () -> () -> {
forgeBus.addListener(KeyBindHandler::onInput);
forgeBus.addListener(Events::onTooltip);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.idark.valoria.client.model.animations;

import com.mojang.blaze3d.vertex.*;
import com.mojang.math.*;
import net.minecraft.client.model.*;
import net.minecraft.client.player.*;
import net.minecraft.client.renderer.*;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraft.world.entity.*;
import net.minecraft.world.item.*;
import net.minecraftforge.api.distmarker.*;
import pro.komaru.tridot.api.render.animation.*;

public class CardOpeningAnimation extends ItemAnimation{

@Override
@OnlyIn(Dist.CLIENT)
public void setupAnimRight(HumanoidModel model, Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
model.rightArm.xRot = -1.35F;
model.rightArm.yRot = -0.6F;
}

@Override
@OnlyIn(Dist.CLIENT)
public void setupAnimLeft(HumanoidModel model, Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
model.leftArm.xRot = -1.35F;
model.leftArm.yRot = 0.6F;
}

@Override
@OnlyIn(Dist.CLIENT)
public void renderArmWithItem(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack stack, float equippedProgress, PoseStack poseStack, MultiBufferSource buffer, int combinedLight) {
float time = player.tickCount + partialTicks;

poseStack.translate(-0.25F, -0.45, -0.75F);

poseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
poseStack.mulPose(Axis.ZP.rotationDegrees(-25.0F));
poseStack.mulPose(Axis.XP.rotationDegrees(25.0F));

float breathe = Mth.sin(time * 0.1F) * 0.05F;
poseStack.translate(0, breathe, 0);

float shakeIntensity = 0.015F;
float shakeX = (Mth.sin(time * 0.8F) * shakeIntensity);
float shakeY = (Mth.cos(time * 1.2F) * shakeIntensity);

poseStack.translate(shakeX, shakeY, 0);
poseStack.scale(1.5f, 1.5f, 1.5f);
}
}
Loading
Loading