Skip to content

Commit

Permalink
Support AzureLib Armor 3.X
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMolnarrr committed Jan 18, 2025
1 parent 0d4b497 commit 9094bd5
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 73 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 2.3.0

- Support Spell Engine 1.4
- Support AzureLib Armor 3.X
- Frost Nova freeze no longer works on any bosses
- Frost spells deal +30% damage against `#minecraft:freeze_hurts_extra_types`
- Frost spells deal -30% damage against `#minecraft:freeze_immune_entity_types`
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3

# Loader
fabric_loader_version=0.16.3
fabric_loader_version=0.16.5
fabric_api_version=0.102.0+1.21.1

# Mod
Expand All @@ -17,7 +17,7 @@ minecraft_compat_version=1.21

# Dependencies
azure_mc_version=1.21.1
azure_lib_version=2.3.3
azure_lib_version=3.0.1
tiny_config_version=2.3.2
runes_version=1.0.3+1.21.1
structure_pool_api_version=1.1.3+1.21.1
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/net/wizards/client/WizardsClientMod.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package net.wizards.client;

import mod.azure.azurelibarmor.rewrite.render.armor.AzArmorRenderer;
import mod.azure.azurelibarmor.rewrite.render.armor.AzArmorRendererRegistry;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.util.Identifier;
import net.spell_engine.api.effect.CustomModelStatusEffect;
import net.spell_engine.api.effect.CustomParticleStatusEffect;
import net.spell_engine.api.item.armor.Armor;
import net.spell_engine.api.render.CustomModels;
import net.wizards.WizardsMod;
import net.wizards.client.armor.WizardArmorRenderer;
import net.wizards.client.effect.FrostShieldRenderer;
import net.wizards.client.effect.FrozenParticles;
import net.wizards.client.effect.FrozenRenderer;
import net.wizards.client.effect.ArcaneChargeRenderer;
import net.wizards.effect.Effects;
import net.wizards.item.Armors;

import java.util.List;
import java.util.function.Supplier;

public class WizardsClientMod implements ClientModInitializer {
@Override
Expand All @@ -36,5 +42,16 @@ public void onInitializeClient() {
CustomParticleStatusEffect.register(Effects.frozen.effect, new FrozenParticles(2));
CustomModelStatusEffect.register(Effects.frozen.effect, new FrozenRenderer());
CustomModelStatusEffect.register(Effects.frostShield.effect, new FrostShieldRenderer());
registerArmorRenderer(Armors.wizardRobeSet, WizardArmorRenderer::wizard);
registerArmorRenderer(Armors.arcaneRobeSet, WizardArmorRenderer::arcane);
registerArmorRenderer(Armors.fireRobeSet, WizardArmorRenderer::fire);
registerArmorRenderer(Armors.frostRobeSet, WizardArmorRenderer::frost);
registerArmorRenderer(Armors.netherite_arcane, WizardArmorRenderer::netheriteArcane);
registerArmorRenderer(Armors.netherite_fire, WizardArmorRenderer::netheriteFire);
registerArmorRenderer(Armors.netherite_frost, WizardArmorRenderer::netheriteFrost);
}

private static void registerArmorRenderer(Armor.Set set, Supplier<AzArmorRenderer> armorRendererSupplier) {
AzArmorRendererRegistry.register(armorRendererSupplier, set.head, set.chest, set.legs, set.feet);
}
}
24 changes: 0 additions & 24 deletions src/main/java/net/wizards/client/armor/WizardArmorModel.java

This file was deleted.

39 changes: 33 additions & 6 deletions src/main/java/net/wizards/client/armor/WizardArmorRenderer.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
package net.wizards.client.armor;

import mod.azure.azurelibarmor.common.api.client.renderer.GeoArmorRenderer;
import net.wizards.item.WizardArmor;
import mod.azure.azurelibarmor.rewrite.render.armor.AzArmorRenderer;
import mod.azure.azurelibarmor.rewrite.render.armor.AzArmorRendererConfig;
import net.minecraft.util.Identifier;
import net.wizards.WizardsMod;

public class WizardArmorRenderer extends GeoArmorRenderer<WizardArmor> {
public WizardArmorRenderer() {
super(new WizardArmorModel());
public class WizardArmorRenderer extends AzArmorRenderer {
public static WizardArmorRenderer wizard() {
return new WizardArmorRenderer("wizard_robes", "wizard_robe");
}
}
public static WizardArmorRenderer arcane() {
return new WizardArmorRenderer("wizard_robes", "arcane_robe");
}
public static WizardArmorRenderer fire() {
return new WizardArmorRenderer("wizard_robes", "fire_robe");
}
public static WizardArmorRenderer frost() {
return new WizardArmorRenderer("wizard_robes", "frost_robe");
}
public static WizardArmorRenderer netheriteArcane() {
return new WizardArmorRenderer("wizard_robes", "netherite_arcane_robe");
}
public static WizardArmorRenderer netheriteFire() {
return new WizardArmorRenderer("wizard_robes", "netherite_fire_robe");
}
public static WizardArmorRenderer netheriteFrost() {
return new WizardArmorRenderer("wizard_robes", "netherite_frost_robe");
}

public WizardArmorRenderer(String modelName, String textureName) {
super(AzArmorRendererConfig.builder(
Identifier.of(WizardsMod.ID, "geo/" + modelName + ".geo.json"),
Identifier.of(WizardsMod.ID, "textures/armor/" + textureName + ".png")
).build());
}
}
42 changes: 1 addition & 41 deletions src/main/java/net/wizards/item/WizardArmor.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,11 @@
package net.wizards.item;

import mod.azure.azurelibarmor.common.api.client.renderer.GeoArmorRenderer;
import mod.azure.azurelibarmor.common.api.common.animatable.GeoItem;
import mod.azure.azurelibarmor.common.internal.client.RenderProvider;
import mod.azure.azurelibarmor.common.internal.common.util.AzureLibUtil;
import mod.azure.azurelibarmor.core.animatable.instance.AnimatableInstanceCache;
import mod.azure.azurelibarmor.core.animation.AnimatableManager;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.spell_engine.api.item.armor.Armor;
import net.wizards.client.armor.WizardArmorRenderer;

import java.util.function.Consumer;

public class WizardArmor extends Armor.CustomItem implements GeoItem {
public class WizardArmor extends Armor.CustomItem {
public WizardArmor(RegistryEntry<ArmorMaterial> material, Type slot, Settings settings) {
super(material, slot, settings);
}

// MARK: GeoItem

@Override
public void createRenderer(Consumer<RenderProvider> consumer) {
consumer.accept(new RenderProvider() {
private GeoArmorRenderer<?> renderer;
@Override
public BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) {
if (this.renderer == null) {
this.renderer = new WizardArmorRenderer();
}
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);
return this.renderer;
}
});
}

@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { }

private final AnimatableInstanceCache cache = AzureLibUtil.createInstanceCache(this);

@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return cache;
}
}

0 comments on commit 9094bd5

Please sign in to comment.