diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java
index c1aacb55..6a7bbc39 100644
--- a/src/main/java/electroblob/wizardry/Settings.java
+++ b/src/main/java/electroblob/wizardry/Settings.java
@@ -198,6 +198,8 @@ public final class Settings {
public boolean blindnessTweak = true;
/** [Server-only] Whether using bonemeal on grass blocks has a chance to grow crystal flowers. */
public boolean bonemealGrowsCrystalFlowers = true;
+ /** [Server-only] Whether to enable Wizardry mob loot injection. Allows an easier switch instead of blacklisting all entities. */
+ public boolean injectMobDrops = true;
/**
* [Server-only] List of registry names of entities which summoned creatures are allowed to attack, in addition
* to the defaults.
@@ -807,6 +809,13 @@ public final class Settings {
blindnessTweak = property.getBoolean();
propOrder.add(property.getName());
+ property = config.get(TWEAKS_CATEGORY, "injectMobDrops", true,
+ "Whether to inject Wizardry loot to mobs, based on the loot table 'Mob Loot Table Whitelist' / 'Mob Loot Table Blacklist' settings. If disabled, the lists won't have any effect!");
+ property.setLanguageKey("config." + Wizardry.MODID + ".inject_mob_drops");
+ Wizardry.proxy.setToNamedBooleanEntry(property);
+ injectMobDrops = property.getBoolean();
+ propOrder.add(property.getName());
+
property = config.get(TWEAKS_CATEGORY, "mobLootTableWhitelist", new String[0], "Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.");
property.setLanguageKey("config." + Wizardry.MODID + ".mob_loot_table_whitelist");
property.setRequiresMcRestart(true);
diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java
index 5648a941..baa211f0 100644
--- a/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java
+++ b/src/main/java/electroblob/wizardry/entity/living/EntityEvilWizard.java
@@ -68,13 +68,15 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
/** Data parameter for the wizard's element. */
private static final DataParameter ELEMENT = EntityDataManager.createKey(EntityEvilWizard.class,
DataSerializers.VARINT);
+ /** Data parameters for the wizard's current continuous spell. */
+ private static final DataParameter CONTINUOUS_SPELL = EntityDataManager.createKey(EntityEvilWizard.class, DataSerializers.STRING);
+ private static final DataParameter SPELL_COUNTER = EntityDataManager.createKey(EntityEvilWizard.class, DataSerializers.VARINT);
+
/** The resource location for the evil wizard's loot table. */
private static final ResourceLocation LOOT_TABLE = new ResourceLocation(Wizardry.MODID, "entities/evil_wizard");
// Field implementations
private List spells = new ArrayList(4);
- private Spell continuousSpell;
- private int spellCounter;
public EntityEvilWizard(World world){
@@ -93,6 +95,8 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
super.entityInit();
this.dataManager.register(HEAL_COOLDOWN, -1);
this.dataManager.register(ELEMENT, -1);
+ this.dataManager.register(CONTINUOUS_SPELL, "ebwizardry:none");
+ this.dataManager.register(SPELL_COUNTER, 0);
}
@Override
@@ -168,23 +172,23 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
}
@Override
- public void setContinuousSpell(Spell spell){
- this.continuousSpell = spell;
+ public void setContinuousSpell(Spell spell) {
+ this.dataManager.set(CONTINUOUS_SPELL, spell.getRegistryName().toString());
}
@Override
- public Spell getContinuousSpell(){
- return this.continuousSpell;
+ public Spell getContinuousSpell() {
+ return Spell.get(this.dataManager.get(CONTINUOUS_SPELL));
}
@Override
- public void setSpellCounter(int count){
- spellCounter = count;
+ public void setSpellCounter(int count) {
+ this.dataManager.set(SPELL_COUNTER, count);
}
@Override
- public int getSpellCounter(){
- return spellCounter;
+ public int getSpellCounter() {
+ return this.dataManager.get(SPELL_COUNTER);
}
@Override
diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java
index 69893d82..c0e3c22f 100644
--- a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java
+++ b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java
@@ -81,11 +81,12 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
private static final DataParameter HEAL_COOLDOWN = EntityDataManager.createKey(EntityWizard.class, DataSerializers.VARINT);
/** Data parameter for the wizard's element. */
private static final DataParameter ELEMENT = EntityDataManager.createKey(EntityWizard.class, DataSerializers.VARINT);
+ /** Data parameters for the wizard's current continuous spell. */
+ private static final DataParameter CONTINUOUS_SPELL = EntityDataManager.createKey(EntityEvilWizard.class, DataSerializers.STRING);
+ private static final DataParameter SPELL_COUNTER = EntityDataManager.createKey(EntityEvilWizard.class, DataSerializers.VARINT);
// Field implementations
private List spells = new ArrayList(4);
- private Spell continuousSpell;
- private int spellCounter;
/** A set of the positions of the blocks that are part of this wizard's tower. */
private Set towerBlocks;
@@ -102,6 +103,8 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
super.entityInit();
this.dataManager.register(HEAL_COOLDOWN, -1);
this.dataManager.register(ELEMENT, 0);
+ this.dataManager.register(CONTINUOUS_SPELL, "ebwizardry:none");
+ this.dataManager.register(SPELL_COUNTER, 0);
}
@Override
@@ -182,23 +185,23 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
}
@Override
- public void setContinuousSpell(Spell spell){
- this.continuousSpell = spell;
+ public void setContinuousSpell(Spell spell) {
+ this.dataManager.set(CONTINUOUS_SPELL, spell.getRegistryName().toString());
}
@Override
- public Spell getContinuousSpell(){
- return this.continuousSpell;
+ public Spell getContinuousSpell() {
+ return Spell.get(this.dataManager.get(CONTINUOUS_SPELL));
}
@Override
- public void setSpellCounter(int count){
- spellCounter = count;
+ public void setSpellCounter(int count) {
+ this.dataManager.set(SPELL_COUNTER, count);
}
@Override
- public int getSpellCounter(){
- return spellCounter;
+ public int getSpellCounter() {
+ return this.dataManager.get(SPELL_COUNTER);
}
@Override
diff --git a/src/main/java/electroblob/wizardry/potion/PotionFrost.java b/src/main/java/electroblob/wizardry/potion/PotionFrost.java
index 3ce17d8a..15b44b25 100644
--- a/src/main/java/electroblob/wizardry/potion/PotionFrost.java
+++ b/src/main/java/electroblob/wizardry/potion/PotionFrost.java
@@ -5,6 +5,7 @@ import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@@ -50,4 +51,18 @@ public class PotionFrost extends PotionMagicEffect implements ICustomPotionParti
}
}
+ @Override
+ public void performEffect(EntityLivingBase entitylivingbase, int strength) {
+ if (entitylivingbase.isBurning()) {
+ if (entitylivingbase.isPotionActive(WizardryPotions.frost)) {
+ entitylivingbase.removePotionEffect(WizardryPotions.frost);
+ entitylivingbase.extinguish();
+ }
+ }
+ }
+
+ @Override
+ public boolean isReady(int duration, int amplifier) {
+ return true;
+ }
}
diff --git a/src/main/java/electroblob/wizardry/registry/WizardryLoot.java b/src/main/java/electroblob/wizardry/registry/WizardryLoot.java
index a0df5807..15442715 100644
--- a/src/main/java/electroblob/wizardry/registry/WizardryLoot.java
+++ b/src/main/java/electroblob/wizardry/registry/WizardryLoot.java
@@ -6,7 +6,11 @@ import electroblob.wizardry.loot.RandomSpell;
import electroblob.wizardry.loot.WizardSpell;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.storage.loot.*;
+import net.minecraft.world.storage.loot.LootEntry;
+import net.minecraft.world.storage.loot.LootEntryTable;
+import net.minecraft.world.storage.loot.LootPool;
+import net.minecraft.world.storage.loot.LootTableList;
+import net.minecraft.world.storage.loot.RandomValueRange;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
import net.minecraftforge.event.LootTableLoadEvent;
@@ -90,23 +94,27 @@ public final class WizardryLoot {
event.getTable().addPool(getAdditive(Wizardry.MODID + ":chests/jungle_dispenser_additions", Wizardry.MODID + "_additional_dispenser_loot"));
}
// Mob drops
- // Let's hope mods will play nice and store their entity loot tables under 'entities' or 'entity'
- // If not, packmakers will have to sort it out themselves using the whitelist/blacklist
- if(Arrays.asList(Wizardry.settings.mobLootTableWhitelist).contains(event.getName())){
- event.getTable().addPool(getAdditive(Wizardry.MODID + ":entities/mob_additions", Wizardry.MODID + "_additional_mob_drops"));
-
- }else if(!Arrays.asList(Wizardry.settings.mobLootTableBlacklist).contains(event.getName())
- && event.getName().getPath().contains("entities") || event.getName().getPath().contains("entity")){
- // Get the filename of the loot table json, for well-behaved mods this will be the entity name
- String[] split = event.getName().getPath().split("/");
- String entityName = split[split.length - 1];
-
- EntityEntry entry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entityName));
- if(entry == null) return; // If this is true it didn't work :(
- Class entityClass = entry.getEntityClass();
-
- if(EnumCreatureType.MONSTER.getCreatureClass().isAssignableFrom(entityClass)){
+ if (Wizardry.settings.injectMobDrops) {
+ // Let's hope mods will play nice and store their entity loot tables under 'entities' or 'entity'
+ // If not, packmakers will have to sort it out themselves using the whitelist/blacklist
+ if (Arrays.asList(Wizardry.settings.mobLootTableWhitelist).contains(event.getName())) {
event.getTable().addPool(getAdditive(Wizardry.MODID + ":entities/mob_additions", Wizardry.MODID + "_additional_mob_drops"));
+
+ } else if (!Arrays.asList(Wizardry.settings.mobLootTableBlacklist).contains(event.getName())
+ && event.getName().getPath().contains("entities") || event.getName().getPath().contains("entity")) {
+ // Get the filename of the loot table json, for well-behaved mods this will be the entity name
+ String[] split = event.getName().getPath().split("/");
+ String entityName = split[split.length - 1];
+
+ EntityEntry entry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entityName));
+ if (entry == null) {
+ return; // If this is true it didn't work :(
+ }
+ Class entityClass = entry.getEntityClass();
+
+ if (EnumCreatureType.MONSTER.getCreatureClass().isAssignableFrom(entityClass)) {
+ event.getTable().addPool(getAdditive(Wizardry.MODID + ":entities/mob_additions", Wizardry.MODID + "_additional_mob_drops"));
+ }
}
}
// Fishing loot
diff --git a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java
index d9956466..8cd399ea 100644
--- a/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java
+++ b/src/main/java/electroblob/wizardry/spell/CurseOfSoulbinding.java
@@ -53,7 +53,7 @@ public class CurseOfSoulbinding extends SpellRay {
@Override
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
-
+
if(EntityUtils.isLiving(target) && caster instanceof EntityPlayer){
WizardData data = WizardData.get((EntityPlayer)caster);
if(data != null){
@@ -66,7 +66,7 @@ public class CurseOfSoulbinding extends SpellRay {
}
}
}
-
+
return true;
}
@@ -79,7 +79,7 @@ public class CurseOfSoulbinding extends SpellRay {
protected boolean onMiss(World world, EntityLivingBase caster, Vec3d origin, Vec3d direction, int ticksInUse, SpellModifiers modifiers){
return true;
}
-
+
@Override
protected void spawnParticle(World world, double x, double y, double z, double vx, double vy, double vz){
ParticleBuilder.create(Type.DARK_MAGIC).pos(x, y, z).clr(0.4f, 0, 0).spawn(world);
@@ -103,9 +103,9 @@ public class CurseOfSoulbinding extends SpellRay {
Entity entity = EntityUtils.getEntityByUUID(player.world, iterator.next());
- if(entity == null) iterator.remove();
-
- if(entity instanceof EntityLivingBase){
+ if (entity == null || (entity instanceof EntityLivingBase && !((EntityLivingBase) entity).isPotionActive(WizardryPotions.curse_of_soulbinding))) {
+ iterator.remove();
+ } else if (entity instanceof EntityLivingBase) {
// Retaliatory effect
if(DamageSafetyChecker.attackEntitySafely(entity, MagicDamage.causeDirectMagicDamage(player,
MagicDamage.DamageType.MAGIC, true), event.getAmount(), event.getSource().getDamageType(),
diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang
index 7a123df4..7821d9fc 100644
--- a/src/main/resources/assets/ebwizardry/lang/en_us.lang
+++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang
@@ -1580,6 +1580,8 @@ config.ebwizardry.mob_loot_table_whitelist=Mob Loot Table Whitelist
config.ebwizardry.mob_loot_table_whitelist.tooltip=Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.
config.ebwizardry.mob_loot_table_blacklist=Mob Loot Table Blacklist
config.ebwizardry.mob_loot_table_blacklist.tooltip=Blacklist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually exclude them.
+config.ebwizardry.inject_mob_drops=Allow Wizardry Mob Loot
+config.ebwizardry.inject_mob_drops.tooltip=Whether to inject Wizardry loot to mobs, based on the loot table 'Mob Loot Table Whitelist' / 'Mob Loot Table Blacklist' settings. If disabled, the lists won't have any effect!
config.ebwizardry.mob_spawn_dimensions=Mob Spawning Dimensions
config.ebwizardry.mob_spawn_dimensions.tooltip=List of ids of dimensions in which wizardry's hostile mobs can spawn.
config.ebwizardry.mob_spawn_biome_blacklist=Mob Spawning Biome Blacklist