Re-add FakePlayer check to sigils (#970)

whar did dey go?
This commit is contained in:
Nicholas Ignoffo 2016-11-11 16:57:50 -08:00
parent 1f31268669
commit b0007a1d36
25 changed files with 121 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IActivatable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -46,6 +47,9 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote && !isUnusable(stack))
{
if (player.isSneaking())

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
@ -7,6 +8,7 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.Vec3d;
@ -26,6 +28,9 @@ public class ItemSigilAir extends ItemSigilBase implements ISentientSwordEffectP
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
boolean unusable = isUnusable(stack);
if (world.isRemote && !unusable)
{

View file

@ -1,9 +1,11 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@ -31,6 +33,9 @@ public class ItemSigilBloodLight extends ItemSigilBase
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
RayTraceResult mop = this.rayTrace(world, player, false);
if (getCooldownRemainder(stack) > 0)

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
@ -16,6 +17,9 @@ public class ItemSigilBounce extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.addPotionEffect(new PotionEffect(ModPotions.bounce, 2, 0, true, false));
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
@ -16,6 +17,9 @@ public class ItemSigilClaw extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.addPotionEffect(new PotionEffect(ModPotions.cling, 2, 0, true, false));
}
}

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -20,6 +21,9 @@ public class ItemSigilCompression extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory, world);
if (compressedStack != null)

View file

@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
@ -46,6 +47,9 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
// world.spawnEntityInWorld(fred);
// }
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote)
{
super.onItemRightClick(stack, world, player, hand);

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
@ -16,6 +17,9 @@ public class ItemSigilElementalAffinity extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.fallDistance = 0;
player.extinguish();
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 2, 1, true, false));

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
@ -21,6 +22,9 @@ public class ItemSigilEnderSeverance extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new net.minecraft.util.math.AxisAlignedBB(player.posX - 4.5, player.posY - 4.5, player.posZ - 4.5, player.posX + 4.5, player.posY + 4.5, player.posZ + 4.5));
for (Entity entity : entityList)
{

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
@ -21,6 +22,8 @@ public class ItemSigilFastMiner extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 2, 0, true, false));
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -15,6 +16,8 @@ public class ItemSigilFilledHand extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
GenericHandler.filledHandMap.put(player, 4);
}
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.enchantment.EnchantmentFrostWalker;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -15,6 +16,9 @@ public class ItemSigilFrost extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
EnchantmentFrostWalker.freezeNearby(player, world, player.getPosition(), 1);
}
}

View file

@ -1,10 +1,13 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -24,6 +27,9 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
@Override
public boolean onSigilUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (PlayerHelper.isFakePlayer(player))
return false;
if (applyBonemeal(world, blockPos, player))
{
if (!world.isRemote)
@ -39,6 +45,9 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World worldIn, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
int range = 3;
int verticalRange = 2;
int posX = (int) Math.round(player.posX - 0.5f);

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.registry.ModPotions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -17,6 +18,9 @@ public class ItemSigilHaste extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.addPotionEffect(new PotionEffect(ModPotions.boost, 2, 0, true, false));
}
}

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.Collections;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.client.key.KeyBindings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -99,6 +100,9 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (PlayerHelper.isFakePlayer(playerIn))
return EnumActionResult.FAIL;
int currentSlot = getCurrentItemOrdinal(stack);
ItemStack[] inv = getInternalInventory(stack);
@ -119,6 +123,9 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable, IAl
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
int currentSlot = getCurrentItemOrdinal(stack);
ItemStack[] inv = getInternalInventory(stack);

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -29,6 +30,9 @@ public class ItemSigilLava extends ItemSigilBase
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote && !isUnusable(stack))
{
RayTraceResult rayTrace = this.rayTrace(world, player, false);

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
@ -19,6 +20,9 @@ public class ItemSigilMagnetism extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
int range = 5;
int verticalRange = 5;
float posX = Math.round(player.posX);

View file

@ -3,8 +3,11 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.HashMap;
import java.util.Map;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -26,6 +29,9 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
if (!prevPositionMap.containsKey(player))
{
prevPositionMap.put(player, Pair.of(player.posX, player.posZ));

View file

@ -9,6 +9,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
@ -32,6 +33,9 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote)
{
super.onItemRightClick(stack, world, player, hand);

View file

@ -1,10 +1,13 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
@ -22,6 +25,9 @@ public class ItemSigilSuppression extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
int x = (int) player.posX;
int y = (int) player.posY;
int z = (int) player.posZ;

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -48,6 +49,9 @@ public class ItemSigilTeleposition extends ItemSigilBase
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote && NBTHelper.checkNBT(stack) != null && stack.getTagCompound().hasKey(Constants.NBT.DIMENSION_ID) && stack.getTagCompound().hasKey(Constants.NBT.X_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Y_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Z_COORD))
{
BlockPos blockPos = new BlockPos(getValue(stack.getTagCompound(), Constants.NBT.X_COORD), getValue(stack.getTagCompound(), Constants.NBT.Y_COORD), getValue(stack.getTagCompound(), Constants.NBT.Z_COORD)).up();
@ -65,6 +69,9 @@ public class ItemSigilTeleposition extends ItemSigilBase
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (PlayerHelper.isFakePlayer(player))
return EnumActionResult.FAIL;
if (!world.isRemote && player.isSneaking() && NBTHelper.checkNBT(stack) != null)
{
if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileTeleposer)

View file

@ -2,16 +2,14 @@ package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@ -70,6 +68,9 @@ public class ItemSigilTransposition extends ItemSigilBase
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (PlayerHelper.isFakePlayer(player))
return EnumActionResult.FAIL;
stack = NBTHelper.checkNBT(stack);
IBlockState state = world.getBlockState(blockPos);

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -27,6 +28,9 @@ public class ItemSigilVoid extends ItemSigilBase
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote && !isUnusable(stack))
{
RayTraceResult rayTrace = this.rayTrace(world, player, true);
@ -77,6 +81,9 @@ public class ItemSigilVoid extends ItemSigilBase
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (PlayerHelper.isFakePlayer(player))
return EnumActionResult.FAIL;
if (world.isRemote || player.isSneaking() || isUnusable(stack))
{
return EnumActionResult.FAIL;

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.BlockCauldron;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -32,6 +33,9 @@ public class ItemSigilWater extends ItemSigilBase
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
if (!world.isRemote && !isUnusable(stack))
{
RayTraceResult rayTrace = this.rayTrace(world, player, false);

View file

@ -1,10 +1,13 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.registry.ModPotions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.world.World;
public class ItemSigilWhirlwind extends ItemSigilToggleableBase
@ -17,6 +20,9 @@ public class ItemSigilWhirlwind extends ItemSigilToggleableBase
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
if (PlayerHelper.isFakePlayer(player))
return;
player.addPotionEffect(new PotionEffect(ModPotions.whirlwind, 2, 0, true, false));
}
}