Skip to content

Commit

Permalink
Fix #25
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamDman committed Dec 9, 2016
1 parent 6eaebbc commit 24258fd
Showing 1 changed file with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemBlock;
Expand All @@ -18,6 +19,8 @@
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.lang.reflect.Field;

Expand All @@ -33,10 +36,13 @@ public ItemStack getStackToUse(EnumHand hand, EntityPlayer player) {
return hand == EnumHand.MAIN_HAND ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
}



@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
super.onSigilUpdate(stack, world, player, itemSlot, isSelected);
ItemSigilBuilder.removeDelay();
@SideOnly(Side.CLIENT)
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (getActivated(stack))
ItemSigilBuilder.removeDelay();
}

@Override
Expand All @@ -46,18 +52,18 @@ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, En

NBTTagCompound comp = NBTHelper.checkNBT(stack).getTagCompound();
boolean activated = getActivated(stack);
// if (activated) {
// if (comp.getInteger("debounce") < 5) {
// comp.setInteger("debounce", comp.getInteger("debounce") + 1);
// } else {
// comp.setBoolean(Constants.NBT.ACTIVATED, !activated);
// comp.setInteger("debounce", 0);
// }
// } else {
comp.setBoolean(Constants.NBT.ACTIVATED, !activated);
// }
// if (activated) {
// if (comp.getInteger("debounce") < 5) {
// comp.setInteger("debounce", comp.getInteger("debounce") + 1);
// } else {
// comp.setBoolean(Constants.NBT.ACTIVATED, !activated);
// comp.setInteger("debounce", 0);
// }
// } else {
comp.setBoolean(Constants.NBT.ACTIVATED, !activated);
// }
} else {
ItemStack _stack = getStackToUse(hand,player);
ItemStack _stack = getStackToUse(hand, player);
if (_stack != null) {
BlockPos air = player.getPosition().offset(player.getHorizontalFacing(), 2).up();
if (world.isAirBlock(air)) {
Expand Down Expand Up @@ -86,19 +92,19 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World wo
for (int radius = 1; radius <= Math.sqrt(AnimusConfig.builderRange); radius++) {
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
switch(side.getAxis()) {
switch (side.getAxis()) {
case X:
air=pos.add(0,x,z);
air = pos.add(0, x, z);
break;
case Y:
air=pos.add(x,0,z);
air = pos.add(x, 0, z);
break;
case Z:
air=pos.add(x,z,0);
air = pos.add(x, z, 0);
break;
}
if (world.isAirBlock(air)) {
ItemStack _stack = getStackToUse(hand,player);
ItemStack _stack = getStackToUse(hand, player);
if (_stack == null)
return EnumActionResult.SUCCESS;
ItemBlock _item = (ItemBlock) _stack.getItem();
Expand All @@ -122,7 +128,7 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World wo
return EnumActionResult.SUCCESS;
} while (!world.isAirBlock(air) || air.getY() <= 0);

ItemStack _stack = getStackToUse(hand,player);
ItemStack _stack = getStackToUse(hand, player);
if (_stack == null)
return EnumActionResult.SUCCESS;
ItemBlock _item = (ItemBlock) _stack.getItem();
Expand Down

0 comments on commit 24258fd

Please sign in to comment.