Merge branch '1.12.2' into 1.12.2-dev
This commit is contained in:
@@ -66,9 +66,9 @@ import net.minecraft.util.EntityDamageSource;
|
||||
public class MagicDamage extends EntityDamageSource implements IElementalDamage {
|
||||
|
||||
/** The name of the damagesource for direct magic damage from the wizardry mod. */
|
||||
public static final String DIRECT_MAGIC_DAMAGE = "wizardryMagic";
|
||||
public static final String DIRECT_MAGIC_DAMAGE = "wizardry_magic";
|
||||
/** The name of the damagesource for indirect magic damage from the wizardry mod. */
|
||||
public static final String INDIRECT_MAGIC_DAMAGE = "indirectWizardryMagic";
|
||||
public static final String INDIRECT_MAGIC_DAMAGE = "indirect_wizardry_magic";
|
||||
// Technically, I don't need to specify that the classes in this map must extend entity, but it's good practice to.
|
||||
private static final Map<Class<? extends Entity>, DamageType[]> immunityMapping = new HashMap<Class<? extends Entity>, DamageType[]>();
|
||||
|
||||
@@ -171,7 +171,7 @@ public class MagicDamage extends EntityDamageSource implements IElementalDamage
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DamageSource called "wizardryMagic" with the given entity as the caster. Use in preference to vanilla
|
||||
* Returns a DamageSource called "wizardry_magic" with the given entity as the caster. Use in preference to vanilla
|
||||
* types to allow things to distinguish between magic and regular melee/swords. Unlike DamageSource.MAGIC, it does
|
||||
* not bypass armour and has a player as the source (rather than nothing). It is still classed as magic damage (for
|
||||
* the record, all this does in vanilla is make witches 85% resistant to it - but that seems kinda right anyway).
|
||||
@@ -192,7 +192,7 @@ public class MagicDamage extends EntityDamageSource implements IElementalDamage
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DamageSource called "wizardryMagic" with the given entity as the caster. Use in preference to vanilla
|
||||
* Returns a DamageSource called "wizardry_magic" with the given entity as the caster. Use in preference to vanilla
|
||||
* types to allow things to distinguish between magic and regular melee/swords. Unlike DamageSource.MAGIC, it does
|
||||
* not bypass armour and has a player as the source (rather than nothing). It is still classed as magic damage (for
|
||||
* the record, all this does in vanilla is make witches 85% resistant to it - but that seems kinda right anyway).
|
||||
@@ -214,7 +214,7 @@ public class MagicDamage extends EntityDamageSource implements IElementalDamage
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DamageSource called "indirectWizardryMagic" with the player as the caster. Use in preference to vanilla
|
||||
* Returns a DamageSource called "indirect_wizardry_magic" with the player as the caster. Use in preference to vanilla
|
||||
* types to allow things to distinguish between magic and regular arrows/throwables. Unlike
|
||||
* DamageSource.causeIndirectMagicDamage, it does not bypass armour. It is still classed as magic damage (for the
|
||||
* record, all this does in vanilla is make witches 85% resistant to it - but that seems kinda right anyway).
|
||||
@@ -236,7 +236,7 @@ public class MagicDamage extends EntityDamageSource implements IElementalDamage
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DamageSource called "indirectWizardryMagic" with the player as the caster. Use in preference to vanilla
|
||||
* Returns a DamageSource called "indirect_wizardry_magic" with the player as the caster. Use in preference to vanilla
|
||||
* types to allow things to distinguish between magic and regular arrows/throwables. Unlike
|
||||
* DamageSource.causeIndirectMagicDamage, it does not bypass armour. It is still classed as magic damage (for the
|
||||
* record, all this does in vanilla is make witches 85% resistant to it - but that seems kinda right anyway).
|
||||
|
||||
@@ -101,6 +101,26 @@ public final class WizardryUtilities {
|
||||
// SECTION Block/Entity/World Utilities
|
||||
// ===============================================================================================================
|
||||
|
||||
/**
|
||||
* Returns the actual light level, taking natural light (skylight) and artificial light (block light) into account.
|
||||
* This uses the same logic as mob spawning.
|
||||
*
|
||||
* @return The light level, from 0 (pitch darkness) to 15 (full daylight/at a torch).
|
||||
*/
|
||||
public static int getLightLevel(World world, BlockPos pos){
|
||||
|
||||
int i = world.getLightFromNeighbors(pos);
|
||||
|
||||
if(world.isThundering()){
|
||||
int j = world.getSkylightSubtracted();
|
||||
world.setSkylightSubtracted(10);
|
||||
i = world.getLightFromNeighbors(pos);
|
||||
world.setSkylightSubtracted(j);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the block at the given coordinates can be replaced by another one (works as if a block is being
|
||||
* placed by a player). True for air, liquids, vines, tall grass and snow layers but not for flowers, signs etc.
|
||||
@@ -945,7 +965,7 @@ public final class WizardryUtilities {
|
||||
*
|
||||
* @return False under any of the following circumstances, true otherwise:
|
||||
* <p>
|
||||
* - Either entity is null
|
||||
* - The target is null
|
||||
* <p>
|
||||
* - The target is the attacker (this isn't as stupid as it sounds - anything with an AoE might cause this
|
||||
* to be true, as can summoned creatures)
|
||||
@@ -954,10 +974,18 @@ public final class WizardryUtilities {
|
||||
* attacker need not be an ally of the target)
|
||||
* <p>
|
||||
* - The target is a creature that was summoned/controlled by the attacker or by an ally of the attacker.
|
||||
* <p>
|
||||
* <i>As of wizardry 4.1.2, this method now returns <b>true</b> instead of false if the attacker is null. This
|
||||
* is because in the vast majority of cases, it makes more sense this way: if a construct has no caster, it
|
||||
* should affect all entities; if a minion has no caster is should target all entities; etc.</i>
|
||||
*/
|
||||
public static boolean isValidTarget(Entity attacker, Entity target){
|
||||
|
||||
if(attacker == null || target == null) return false;
|
||||
// Always return true if the attacker is null
|
||||
if(attacker == null) return true;
|
||||
|
||||
// Always return false if the target is null
|
||||
if(target == null) return false;
|
||||
|
||||
// Tests whether the target is the attacker
|
||||
if(target == attacker) return false;
|
||||
|
||||
Reference in New Issue
Block a user