Skip to content

Commit

Permalink
Updated to Palladium 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucraft committed Apr 24, 2024
1 parent 618220b commit 8419d9c
Show file tree
Hide file tree
Showing 380 changed files with 48,537 additions and 64,960 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id 'io.github.juuxel.loom-quiltflower' version '1.7.2' apply false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.world.entity.LivingEntity;
import net.threetag.palladium.client.dynamictexture.DynamicTexture;
import net.threetag.palladium.client.renderer.renderlayer.ModelLookup;
import net.threetag.palladium.client.dynamictexture.DynamicTextureManager;
import net.threetag.palladium.client.renderer.renderlayer.ModelTypes;
import net.threetag.palladium.compat.curiostinkets.CuriosTrinketsUtil;
import net.threetag.palladium.event.PalladiumClientEvents;
import net.threetag.palladiumcore.event.LifecycleEvents;
Expand Down Expand Up @@ -49,11 +49,11 @@ public static void init() {
EntityRendererRegistry.addRenderLayerToAll(renderLayerParent -> new EyeOfHorusRenderer((RenderLayerParent<LivingEntity, EntityModel<LivingEntity>>) renderLayerParent));

// Model Types
ModelLookup.register(PantheonSent.id("moon_knight_suit"), new ModelLookup.Model(MoonKnightSuitModel::new, (en, model) -> model instanceof HumanoidModel));
ModelLookup.register(PantheonSent.id("moon_knight_cape"), new ModelLookup.Model(MoonKnightCapeModel::new, (en, model) -> model instanceof HumanoidModel));
ModelTypes.register(PantheonSent.id("moon_knight_suit"), new ModelTypes.Model(MoonKnightSuitModel::new, (en, model) -> model instanceof HumanoidModel));
ModelTypes.register(PantheonSent.id("moon_knight_cape"), new ModelTypes.Model(MoonKnightCapeModel::new, (en, model) -> model instanceof HumanoidModel));

// Dynamic Texture Variables
DynamicTexture.registerVariable(new MoonKnightCapeTextureVariable.Serializer());
DynamicTextureManager.registerVariable(new MoonKnightCapeTextureVariable.Serializer());

// Animations
PalladiumClientEvents.REGISTER_ANIMATIONS.register(registry -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.world.phys.Vec3;
import net.threetag.palladium.power.IPowerHolder;
import net.threetag.palladium.power.ability.Ability;
import net.threetag.palladium.power.ability.AbilityEntry;
import net.threetag.palladium.power.ability.AbilityInstance;
import net.threetag.palladium.util.property.IntegerProperty;
import net.threetag.palladium.util.property.PalladiumProperty;
import net.threetag.palladium.util.property.PropertyManager;
Expand All @@ -30,19 +30,19 @@ public void registerUniqueProperties(PropertyManager manager) {
}

@Override
public void tick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, boolean enabled) {
public void tick(LivingEntity entity, AbilityInstance instance, IPowerHolder holder, boolean enabled) {
if (enabled && !entity.level().isClientSide && entity instanceof Player player) {
int timer = entry.getProperty(TIMER);
int timer = instance.getProperty(TIMER);

if (timer == 0) {
Khonshu khonshu = new Khonshu(entity.level(), player, Khonshu.Mode.STALKING);
var pos = Khonshu.findRandomPos(entity.getOnPos(), khonshu, player, entity.level(), 20, 35, 20);
khonshu.setPos(new Vec3(pos.x(), pos.y(), pos.z()));
entity.level().addFreshEntity(khonshu);
player.playSound(SoundEvents.AMBIENT_CAVE.value(), 1F, 1F);
entry.setUniqueProperty(TIMER, getRandomMinutes());
instance.setUniqueProperty(TIMER, getRandomMinutes());
} else {
entry.setUniqueProperty(TIMER, timer - 1);
instance.setUniqueProperty(TIMER, timer - 1);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ public void registerUniqueProperties(PropertyManager manager) {
}

@Override
public void tick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, boolean enabled) {
public void tick(LivingEntity entity, AbilityInstance instance, IPowerHolder holder, boolean enabled) {
if (entity.level().isClientSide) {
int timer = entry.getProperty(TIMER);
entry.setUniqueProperty(PREV_TIMER, timer);
int timer = instance.getProperty(TIMER);
instance.setUniqueProperty(PREV_TIMER, timer);

if (enabled && timer < 5) {
entry.setUniqueProperty(TIMER, timer + 1);
instance.setUniqueProperty(TIMER, timer + 1);
} else if (!enabled && timer > 0) {
entry.setUniqueProperty(TIMER, timer - 1);
instance.setUniqueProperty(TIMER, timer - 1);
}
}
}

@Override
public void firstTick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, boolean enabled) {
public void firstTick(LivingEntity entity, AbilityInstance instance, IPowerHolder holder, boolean enabled) {
if (enabled) {
entity.level().playLocalSound(entity.getX(), entity.getEyeY(), entity.getZ(), PSSoundEvents.CAPE.get(), SoundSource.PLAYERS, 1F, 1F, false);
}
}

@Override
public void lastTick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, boolean enabled) {
public void lastTick(LivingEntity entity, AbilityInstance instance, IPowerHolder holder, boolean enabled) {
if (enabled) {
entity.level().playLocalSound(entity.getX(), entity.getEyeY(), entity.getZ(), PSSoundEvents.CAPE.get(), SoundSource.PLAYERS, 1F, 1F, false);
}
Expand All @@ -69,15 +69,15 @@ public EventResult livingEntityAttack(LivingEntity entity, DamageSource damageSo
}

@Override
public float getAnimationValue(AbilityEntry entry, float partialTick) {
return Mth.lerp(partialTick, entry.getProperty(PREV_TIMER), entry.getProperty(TIMER)) / 5F;
public float getAnimationValue(AbilityInstance instance, float partialTick) {
return Mth.lerp(partialTick, instance.getProperty(PREV_TIMER), instance.getProperty(TIMER)) / 5F;
}

@Override
public float getAnimationTimer(AbilityEntry entry, float partialTick, boolean maxedOut) {
public float getAnimationTimer(AbilityInstance instance, float partialTick, boolean maxedOut) {
if (maxedOut) {
return 5;
}
return entry.getProperty(TIMER);
return instance.getProperty(TIMER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.threetag.palladium.power.IPowerHolder;
import net.threetag.palladium.power.ability.Ability;
import net.threetag.palladium.power.ability.AbilityEntry;
import net.threetag.palladium.power.ability.AbilityUtil;
import net.threetag.palladium.power.ability.AnimationTimer;
import net.threetag.palladium.power.ability.*;
import net.threetag.palladium.util.property.IntegerProperty;
import net.threetag.palladium.util.property.PalladiumProperty;
import net.threetag.palladium.util.property.PropertyManager;
Expand All @@ -27,15 +24,15 @@ public void registerUniqueProperties(PropertyManager manager) {
}

@Override
public void tick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, boolean enabled) {
public void tick(LivingEntity entity, AbilityInstance instance, IPowerHolder holder, boolean enabled) {
if (entity.level().isClientSide) {
int timer = entry.getProperty(TIME_IN_AIR);
entry.setUniqueProperty(PREV_TIME_IN_AIR, timer);
int timer = instance.getProperty(TIME_IN_AIR);
instance.setUniqueProperty(PREV_TIME_IN_AIR, timer);

if ((entity.onGround() || entity.isInWater() || entity.isColliding(entity.blockPosition(), entity.level().getBlockState(entity.blockPosition().below(2)))) && timer > 0) {
entry.setUniqueProperty(TIME_IN_AIR, timer = timer - 1);
instance.setUniqueProperty(TIME_IN_AIR, timer = timer - 1);
} else if (enabled && !entity.onGround() && timer < 10) {
entry.setUniqueProperty(TIME_IN_AIR, timer = timer + 1);
instance.setUniqueProperty(TIME_IN_AIR, timer = timer + 1);
}

if (timer == 1) {
Expand All @@ -58,12 +55,12 @@ public void tick(LivingEntity entity, AbilityEntry entry, IPowerHolder holder, b
}

@Override
public float getAnimationValue(AbilityEntry entry, float partialTick) {
return Mth.lerp(partialTick, entry.getProperty(PREV_TIME_IN_AIR), entry.getProperty(TIME_IN_AIR)) / 10F;
public float getAnimationValue(AbilityInstance instance, float partialTick) {
return Mth.lerp(partialTick, instance.getProperty(PREV_TIME_IN_AIR), instance.getProperty(TIME_IN_AIR)) / 10F;
}

@Override
public float getAnimationTimer(AbilityEntry entry, float partialTick, boolean maxedOut) {
public float getAnimationTimer(AbilityInstance entry, float partialTick, boolean maxedOut) {
if (maxedOut) {
return 10;
}
Expand All @@ -72,13 +69,13 @@ public float getAnimationTimer(AbilityEntry entry, float partialTick, boolean ma

public static float getProgress(LivingEntity entity, float partialTicks) {
float max = 0;
var entries = AbilityUtil.getEntries(entity, PSAbilities.MOON_KNIGHT_GLIDING.get());
var instances = AbilityUtil.getInstances(entity, PSAbilities.MOON_KNIGHT_GLIDING.get());

if (entries.isEmpty()) {
if (instances.isEmpty()) {
return 0F;
}

for (AbilityEntry entry : entries) {
for (AbilityInstance entry : instances) {
float timeInAir = ((MoonKnightGlidingAbility) PSAbilities.MOON_KNIGHT_GLIDING.get()).getAnimationValue(entry, partialTicks);

if (timeInAir > max) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.threetag.palladium.client.model.animation.PalladiumAnimation;
import net.threetag.palladium.power.ability.AbilityEntry;
import net.threetag.palladium.power.ability.AbilityInstance;
import net.threetag.palladium.power.ability.AbilityUtil;
import net.threetag.palladium.util.Easing;
import net.threetag.pantheonsent.ability.MoonKnightBlockingAbility;
Expand All @@ -21,13 +21,13 @@ public BlockingAnimation() {

public float getProgress(LivingEntity entity, float partialTicks) {
float max = 0;
var entries = AbilityUtil.getEntries(entity, PSAbilities.MOON_KNIGHT_BLOCKING.get());
var instances = AbilityUtil.getInstances(entity, PSAbilities.MOON_KNIGHT_BLOCKING.get());

if (entries.isEmpty()) {
if (instances.isEmpty()) {
return 0F;
}

for (AbilityEntry entry : entries) {
for (AbilityInstance entry : instances) {
float timer = ((MoonKnightBlockingAbility) PSAbilities.MOON_KNIGHT_BLOCKING.get()).getAnimationValue(entry, partialTicks);

if (timer > max) {
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"depends": {
"fabric": "*",
"minecraft": ">=1.20.1",
"palladium": ">=4.0.6"
"palladium": ">=4.1.0"
},
"suggests": {
"flamingo": "*"
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ side = "BOTH"
[[dependencies.pantheonsent]]
modId = "palladium"
mandatory = true
versionRange = "[4.0.6,)"
versionRange = "[4.1.0,)"
ordering = "AFTER"
side = "BOTH"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod_author=Lucraft
maven_group=net.threetag

# Common Dependencies
palladium_version=4.0.6+1.20.1
palladium_version=4.1.0+1.20.1
sherds_api_version=4.0.4
jei_version=15.2.0.27
rei_version=12.0.684
Expand Down
Loading

0 comments on commit 8419d9c

Please sign in to comment.