Replace Achievements with Advancements
- Advancements are now in JSON files, converted by the included migration script. - WizardryAdvancementTrigger is a generic achievement trigger that can be reused throughout the code to trigger custom advancements not covered by the JSON conditions. - Plus some other small and obvious fixes.
This commit is contained in:
@@ -8,6 +8,7 @@ import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.entity.living.EntityWizard;
|
||||
import electroblob.wizardry.event.SpellCastEvent;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
@@ -44,7 +45,7 @@ public class ArcaneJammer extends Spell {
|
||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||
|
||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||
if(entity instanceof EntityWizard) { AdvancementHelper.grantAdvancement(caster, EnumAdvancement.jam_wizard); }
|
||||
if(entity instanceof EntityWizard) WizardryAdvancementTriggers.jam_wizard.triggerFor(caster);
|
||||
|
||||
if(!world.isRemote){
|
||||
entity.addPotionEffect(new PotionEffect(WizardryPotions.arcane_jammer,
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package electroblob.wizardry.spell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.advancement.AdvancementHelper;
|
||||
import electroblob.wizardry.advancement.AdvancementHelper.EnumAdvancement;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
@@ -24,6 +21,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class IceAge extends Spell {
|
||||
|
||||
private static final int baseDuration = 1200;
|
||||
@@ -59,7 +58,7 @@ public class IceAge extends Spell {
|
||||
target.extinguish();
|
||||
}
|
||||
|
||||
if(target instanceof EntityBlaze) { AdvancementHelper.grantAdvancement(caster, EnumAdvancement.freeze_blaze); }
|
||||
if(target instanceof EntityBlaze) WizardryAdvancementTriggers.freeze_blaze.triggerFor(caster);
|
||||
|
||||
if(target instanceof EntityLiving){
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import electroblob.wizardry.advancement.AdvancementHelper.EnumAdvancement;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
@@ -53,7 +54,7 @@ public class IceStatue extends Spell {
|
||||
// Stops the entity looking red while frozen and the resulting z-fighting
|
||||
target.hurtTime = 0;
|
||||
|
||||
if(target instanceof EntityBlaze) { AdvancementHelper.grantAdvancement(caster, EnumAdvancement.freeze_blaze); }
|
||||
if(target instanceof EntityBlaze) WizardryAdvancementTriggers.freeze_blaze.triggerFor(caster);
|
||||
|
||||
// Short mobs such as spiders and pigs
|
||||
if((target.height < 1.2 || target.isChild()) && WizardryUtilities.canBlockBeReplaced(world, pos)){
|
||||
|
||||
@@ -5,6 +5,7 @@ import electroblob.wizardry.advancement.AdvancementHelper.EnumAdvancement;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -110,11 +111,11 @@ public class LightningBolt extends Spell {
|
||||
event.getLightning().getEntityData().getUniqueId("summoningPlayer"));
|
||||
|
||||
if(event.getEntity() instanceof EntityCreeper){
|
||||
AdvancementHelper.grantAdvancement(player, EnumAdvancement.charge_creeper);
|
||||
WizardryAdvancementTriggers.charge_creeper.triggerFor(player);
|
||||
}
|
||||
|
||||
if(event.getEntity() instanceof EntityPig){
|
||||
AdvancementHelper.grantAdvancement(player, EnumAdvancement.frankenstein);
|
||||
WizardryAdvancementTriggers.frankenstein.triggerFor(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.entity.living.EntityMagicSlime;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
@@ -49,7 +50,7 @@ public class Slime extends Spell {
|
||||
this.getNameForTranslationFormatted()));
|
||||
}else if(!(target instanceof EntityMagicSlime)){
|
||||
|
||||
if(target instanceof EntitySkeleton) { AdvancementHelper.grantAdvancement(caster, EnumAdvancement.slime_skeleton); }
|
||||
if(target instanceof EntitySkeleton) WizardryAdvancementTriggers.slime_skeleton.triggerFor(caster);
|
||||
|
||||
if(!world.isRemote){
|
||||
EntityMagicSlime slime = new EntityMagicSlime(world, caster, target,
|
||||
|
||||
Reference in New Issue
Block a user