Cleanup
This commit is contained in:
@@ -171,7 +171,7 @@ public final class WizardryEventHandler {
|
||||
@SubscribeEvent
|
||||
public static void onLivingAttackEvent(LivingAttackEvent event){
|
||||
|
||||
// Prevents any damage to allies from magic if friendly fire is enabled
|
||||
// Prevents any damage to allies from magic if friendly fire is disabled
|
||||
if(!Wizardry.settings.friendlyFire && event.getSource() != null
|
||||
&& event.getSource().getTrueSource() instanceof EntityPlayer && event.getEntity() instanceof EntityPlayer
|
||||
&& event.getSource() instanceof IElementalDamage){
|
||||
|
||||
@@ -21,7 +21,8 @@ import net.minecraftforge.fml.common.registry.RegistryBuilder;
|
||||
// because it makes the text go bold, but also because it stops anyone fiddling with your fields). "Why would I want to
|
||||
// initialise things within the registry events?", I hear you ask - well, for one, custom registries don't like it if
|
||||
// you haven't created the registry before you start calling constructors of classes extending IForgeRegistryEntry.Impl,
|
||||
// and secondly,
|
||||
// and secondly, you might want to initialise objects based on certain conditions - perhaps a config option, or whether
|
||||
// another mod is installed. This, presumably, is why everyone at forge is encouraging us to use @ObjectHolder.
|
||||
@ObjectHolder(Wizardry.MODID)
|
||||
@Mod.EventBusSubscriber
|
||||
public final class Spells {
|
||||
|
||||
@@ -116,9 +116,9 @@ public class MindTrick extends Spell {
|
||||
if(event.getSource() != null && event.getSource().getTrueSource() instanceof EntityLivingBase){
|
||||
// Cancels the mind trick effect if the creature takes damage
|
||||
// This has been moved to within an (event.getSource().getEntity() instanceof EntityLivingBase) check so it
|
||||
// doesn't
|
||||
// crash the game with a ConcurrentModificationException. If you think about it, mind trick only ought to be
|
||||
// cancelled if something attacks the entity since potions, drowning, cacti etc. don't affect the targeting.
|
||||
// doesn't crash the game with a ConcurrentModificationException. If you think about it, mind trick only
|
||||
// ought to be cancelled if something attacks the entity since potions, drowning, cacti etc. don't affect the
|
||||
// targeting.
|
||||
if(event.getEntityLiving().isPotionActive(WizardryPotions.mind_trick)){
|
||||
event.getEntityLiving().removePotionEffect(WizardryPotions.mind_trick);
|
||||
}
|
||||
|
||||
@@ -119,8 +119,7 @@ public class Petrify extends Spell {
|
||||
}
|
||||
}
|
||||
caster.swingArm(hand);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_WITHER_SPAWN, 1.0F,
|
||||
world.rand.nextFloat() * 0.2F + 1.0F);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_WITHER_SPAWN, 1.0F, world.rand.nextFloat() * 0.2F + 1.0F);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,7 @@ public class PhaseStep extends Spell {
|
||||
|
||||
// The maximum wall thickness as determined by the range multiplier. The + 0.5f is so that
|
||||
// weird float processing doesn't incorrectly round it down.
|
||||
int maxThickness = 1
|
||||
+ (int)((modifiers.get(WizardryItems.range_upgrade) - 1) / Constants.RANGE_INCREASE_PER_LEVEL
|
||||
+ 0.5f);
|
||||
int maxThickness = 1 + (int)((modifiers.get(WizardryItems.range_upgrade) - 1) / Constants.RANGE_INCREASE_PER_LEVEL + 0.5f);
|
||||
|
||||
if(rayTrace.sideHit.getAxis().isHorizontal()){
|
||||
|
||||
@@ -49,8 +47,7 @@ public class PhaseStep extends Spell {
|
||||
|
||||
// Prevents the player from teleporting through unbreakable blocks, so they cannot cheat in other
|
||||
// mods' mazes and dungeons.
|
||||
if((WizardryUtilities.isBlockUnbreakable(world, pos1)
|
||||
|| WizardryUtilities.isBlockUnbreakable(world, pos1.up()))
|
||||
if((WizardryUtilities.isBlockUnbreakable(world, pos1) || WizardryUtilities.isBlockUnbreakable(world, pos1.up()))
|
||||
&& !Wizardry.settings.teleportThroughUnbreakableBlocks)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@Mod.EventBusSubscriber
|
||||
public interface IElementalDamage {
|
||||
|
||||
/** Returns the type of this damage, which determines how it interacts with different entities. */
|
||||
DamageType getType();
|
||||
|
||||
/** Returns true is this damage is from a retaliatory effect (i.e. in response to other damage). Used to avoid
|
||||
* infinite loops with retaliatory effects. */
|
||||
boolean isRetaliatory();
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -33,8 +33,8 @@ import net.minecraft.util.EntityDamageSource;
|
||||
|
||||
// A note on the use of the vanilla damagesources:
|
||||
// When using indirect damage sources, the SECOND argument is the original entity (i.e. the caster), and the
|
||||
// FIRST argument is the actual projectile or whatever that does the damage. getEntity() will return
|
||||
// the original entity, and getSourceOfDamage() will return the projectile.
|
||||
// FIRST argument is the actual projectile or whatever that does the damage. getTrueSource() will return
|
||||
// the original entity, and getImmediateSource() will return the projectile.
|
||||
|
||||
// The vanilla approach to damage types is inconsistent, to say the least. Poison is simply 'magic', and relies on
|
||||
// EntityLivingBase.isPotionApplicable to determine whether an entity is affected or not. Wither, on the other hand, is
|
||||
|
||||
@@ -344,8 +344,7 @@ public final class WizardryUtilities {
|
||||
* defaults to {@link SoundCategory#PLAYERS}.
|
||||
*/
|
||||
public static void playSoundAtPlayer(EntityPlayer player, SoundEvent sound, float volume, float pitch){
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, sound, SoundCategory.PLAYERS, volume,
|
||||
pitch);
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, sound, SoundCategory.PLAYERS, volume, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user