Route blink effect through the proxies and make the blink spell check for the first-person player, fixes #280

This commit is contained in:
Electroblob77
2019-12-16 15:25:15 +00:00
parent 3a67388ff3
commit 2b89a890d0
5 changed files with 16 additions and 8 deletions
@@ -7,6 +7,7 @@ import electroblob.wizardry.spell.Spell;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
@@ -238,6 +239,9 @@ public class CommonProxy {
+ "of sound events, but the given array contained less than 3 sound events!");
playSpellSoundLoop(world, x, y, z, spell, sounds[0], sounds[1], sounds[2], category, volume, pitch, duration);
}
/** Starts the first-person blink overlay effect for the specified player. */
public void playBlinkEffect(EntityPlayer player){}
/**
* Gets the client side world using Minecraft.getMinecraft().world. <b>Only to be called client side!</b> Returns
@@ -190,6 +190,11 @@ public class ClientProxy extends CommonProxy {
}
}
@Override
public void playBlinkEffect(EntityPlayer player){
if(Minecraft.getMinecraft().player == player) WizardryClientEventHandler.playBlinkEffect();
}
@Override
public Set<String> getSpellHUDSkins(){
return GuiSpellDisplay.getSkinKeys();
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
@@ -7,6 +8,7 @@ import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
@@ -78,9 +80,7 @@ public class Banish extends SpellRay {
world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5);
}
// Can't be bothered to route this through the proxies!
if(entity == net.minecraft.client.Minecraft.getMinecraft().player)
electroblob.wizardry.client.WizardryClientEventHandler.playBlinkEffect();
if(entity instanceof EntityPlayer) Wizardry.proxy.playBlinkEffect((EntityPlayer)entity);
}
if(y != null){
@@ -1,5 +1,6 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.SpellModifiers;
@@ -41,9 +42,8 @@ public class Blink extends Spell {
world.spawnParticle(EnumParticleTypes.PORTAL, dx, dy, dz, world.rand.nextDouble() - 0.5,
world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5);
}
// Can't be bothered to route this through the proxies!
electroblob.wizardry.client.WizardryClientEventHandler.playBlinkEffect();
Wizardry.proxy.playBlinkEffect(caster);
}
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
@@ -43,8 +43,7 @@ public class PhaseStep extends Spell {
world.rand.nextDouble() - 0.5, world.rand.nextDouble() - 0.5);
}
// Can't be bothered to route this through the proxies!
electroblob.wizardry.client.WizardryClientEventHandler.playBlinkEffect();
Wizardry.proxy.playBlinkEffect(caster);
}
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){