Add check for wand before sending control packets, prevents unnecessary packets being sent

This commit is contained in:
Electroblob77
2019-01-04 21:04:06 +00:00
parent a7a48cd32b
commit 7bda8db86f
@@ -1,5 +1,8 @@
package electroblob.wizardry;
import electroblob.wizardry.item.ItemWand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
import electroblob.wizardry.client.ClientProxy;
@@ -25,6 +28,15 @@ public class WizardryKeyHandler {
if(Wizardry.proxy instanceof ClientProxy){
EntityPlayer player = Minecraft.getMinecraft().player;
ItemStack wand = player.getHeldItemMainhand();
if(!(wand.getItem() instanceof ItemWand)){
wand = player.getHeldItemOffhand();
// If the player isn't holding a wand, then nothing else needs to be done.
if(!(wand.getItem() instanceof ItemWand)) return;
}
if(ClientProxy.NEXT_SPELL.isPressed() && Minecraft.getMinecraft().inGameHasFocus){
if(!NkeyPressed){
NkeyPressed = true;