Search in sources :

Example 61 with ItemSword

use of net.minecraft.item.ItemSword in project Lands-of-Icaria by Axanthic-Game-Studios.

the class CommonProxy method onToolBreaksOffhand.

public void onToolBreaksOffhand(PlayerInteractEvent event) {
    EntityPlayer player = event.getEntityPlayer();
    for (int slot = 0; slot < 9; slot++) {
        ItemStack totem = player.inventory.getStackInSlot(slot);
        if (totem.getItem().equals(Resources.totem_unshattering)) {
            ItemStack tools = player.getHeldItemOffhand();
            if (tools.getItem() instanceof ItemTool || tools.getItem() instanceof ItemHoe || tools.getItem() instanceof ItemSword || tools.getItem() instanceof ItemBow || tools.getItem() instanceof ItemFishingRod || tools.getItem() instanceof ItemFlintAndSteel || tools.getItem() instanceof ItemShield) {
                if (tools.getItem().getMaxDamage(tools) - tools.getItem().getDamage(tools) < tools.getItem().getMaxDamage(tools) * 0.1) {
                    tools.setItemDamage((int) (tools.getItem().getMaxDamage(tools) * 0.1));
                    totem.shrink(1);
                }
            }
        }
    }
}
Also used : ItemSword(net.minecraft.item.ItemSword) ItemHoe(net.minecraft.item.ItemHoe) ItemTool(net.minecraft.item.ItemTool) ItemShield(net.minecraft.item.ItemShield) ItemFishingRod(net.minecraft.item.ItemFishingRod) ItemFlintAndSteel(net.minecraft.item.ItemFlintAndSteel) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) ItemBow(net.minecraft.item.ItemBow)

Example 62 with ItemSword

use of net.minecraft.item.ItemSword in project VapuLite by VapuClient.

the class AutoClicker method onTick.

@SubscribeEvent
public void onTick(TickEvent event) {
    int key = mc.gameSettings.keyBindAttack.getKeyCode();
    if (mc.gameSettings.keyBindAttack.isKeyDown()) {
        float delays = new Random().nextInt(this.cps.getValue().intValue()) + 2;
        if (timer.delay(delays * 10)) {
            mc.thePlayer.swingItem();
            KeyBinding.onTick(key);
            try {
                if (mc.objectMouseOver.entityHit != null) {
                    mc.playerController.attackEntity(mc.thePlayer, Minecraft.getMinecraft().objectMouseOver.entityHit);
                    if (this.doBlock) {
                        this.doBlock = !this.doBlock;
                    } else {
                        this.doBlock = true;
                    }
                    if (this.doBlock) {
                        if (mc.thePlayer.getCurrentEquippedItem() == null) {
                            return;
                        }
                        if (!(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword)) {
                            return;
                        }
                        mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            timer.reset();
        }
    }
}
Also used : ItemSword(net.minecraft.item.ItemSword) Random(java.util.Random) C08PacketPlayerBlockPlacement(net.minecraft.network.play.client.C08PacketPlayerBlockPlacement) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 63 with ItemSword

use of net.minecraft.item.ItemSword in project VapuLite by VapuClient.

the class Reach method onMove.

@SubscribeEvent
public void onMove(final MouseEvent ev) {
    if (true) {
        if (this.weaponOnly.getValue()) {
            if (mc.thePlayer.getCurrentEquippedItem() == null) {
                return;
            }
            if (!(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword) && !(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemAxe)) {
                return;
            }
        }
        if (this.movingOnly.getValue() && mc.thePlayer.moveForward == 0.0 && mc.thePlayer.moveStrafing == 0.0) {
            return;
        }
        if (this.sprintOnly.getValue() && !mc.thePlayer.isSprinting()) {
            return;
        }
        if (!this.hitThroughBlocks.getValue() && mc.objectMouseOver != null) {
            final BlockPos zzzzz = mc.objectMouseOver.getBlockPos();
            if (zzzzz != null && mc.theWorld.getBlockState(zzzzz).getBlock() != Blocks.air) {
                return;
            }
        }
        if (false) {
            double zzzzzD2 = 3.0 + this.rand.nextDouble() * (this.MinReach.getValue() - 3.0);
            final Object[] zzzzzN = Reaching(zzzzzD2, 0.0, 0.0f);
            if (zzzzzN == null) {
                return;
            }
            mc.objectMouseOver = new MovingObjectPosition((Entity) zzzzzN[0], (Vec3) zzzzzN[1]);
            mc.pointedEntity = (Entity) zzzzzN[0];
        } else {
            double Reach = this.MinReach.getValue();
            final Object[] zzzzzN = Reaching(Reach, 0.0, 0.0f);
            if (zzzzzN == null) {
                return;
            }
            mc.objectMouseOver = new MovingObjectPosition((Entity) zzzzzN[0], (Vec3) zzzzzN[1]);
            mc.pointedEntity = (Entity) zzzzzN[0];
        }
    }
}
Also used : ItemSword(net.minecraft.item.ItemSword) ItemAxe(net.minecraft.item.ItemAxe) Entity(net.minecraft.entity.Entity) MovingObjectPosition(net.minecraft.util.MovingObjectPosition) Vec3(net.minecraft.util.Vec3) BlockPos(net.minecraft.util.BlockPos) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 64 with ItemSword

use of net.minecraft.item.ItemSword in project VapuLite by VapuClient.

the class Killaura method onTick.

@SubscribeEvent
public void onTick(TickEvent event) {
    float delays = new Random().nextInt(this.cps.getValue().intValue()) + 5;
    if (timer.delay(delays * 10)) {
        if (!Client.nullCheck()) {
            this.updateTarget();
        } else {
            return;
        }
        if (target == null)
            return;
        if (AntiBot.isServerBot(target))
            return;
        if (Teams.isOnSameTeam(target))
            return;
        if (FriendManager.isFriend(target.getName()))
            return;
        if (target.getHealth() == 0)
            return;
        assistFaceEntity(target, this.yaw.getValue().floatValue(), (float) 20.0);
        Object[] objects = mc.theWorld.loadedEntityList.stream().filter(entity -> entity instanceof EntityLivingBase && entity != mc.thePlayer && ((EntityLivingBase) entity).getHealth() > 0F && entity.getDistanceToEntity(mc.thePlayer) <= rangeValue.getValue()).sorted(Comparator.comparingDouble(entity -> entity.getDistanceToEntity(mc.thePlayer))).toArray();
        if (objects.length > 0)
            target = (EntityLivingBase) objects[0];
        if (ModuleManager.getModule("Criticals").getState() && Criticals.canJump() && mc.thePlayer.onGround)
            mc.thePlayer.jump();
        if (this.swing.getValue()) {
            mc.thePlayer.swingItem();
        }
        mc.getNetHandler().addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
        if ((Boolean) this.autoblock.getValue()) {
            if (mc.thePlayer.getCurrentEquippedItem() == null) {
                return;
            }
            if (!(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword)) {
                return;
            }
            if (target != null && (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && this.autoblock.getValue() || mc.thePlayer.isBlocking())) {
                mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
                mc.thePlayer.getCurrentEquippedItem().useItemRightClick(mc.theWorld, mc.thePlayer);
            }
        }
        target = null;
        timer.reset();
    }
}
Also used : ItemSword(net.minecraft.item.ItemSword) Random(java.util.Random) C08PacketPlayerBlockPlacement(net.minecraft.network.play.client.C08PacketPlayerBlockPlacement) EntityLivingBase(net.minecraft.entity.EntityLivingBase) C02PacketUseEntity(net.minecraft.network.play.client.C02PacketUseEntity) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 65 with ItemSword

use of net.minecraft.item.ItemSword in project CumServerPro by MCUmbrella.

the class TileEntityFurnace method getItemBurnTime.

public static int getItemBurnTime(ItemStack stack) {
    if (stack.isEmpty()) {
        return 0;
    } else {
        int burnTime = net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack);
        if (burnTime >= 0)
            return burnTime;
        Item item = stack.getItem();
        if (item == Item.getItemFromBlock(Blocks.WOODEN_SLAB)) {
            return 150;
        } else if (item == Item.getItemFromBlock(Blocks.WOOL)) {
            return 100;
        } else if (item == Item.getItemFromBlock(Blocks.CARPET)) {
            return 67;
        } else if (item == Item.getItemFromBlock(Blocks.LADDER)) {
            return 300;
        } else if (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON)) {
            return 100;
        } else if (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD) {
            return 300;
        } else if (item == Item.getItemFromBlock(Blocks.COAL_BLOCK)) {
            return 16000;
        } else if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName())) {
            return 200;
        } else if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName())) {
            return 200;
        } else if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName())) {
            return 200;
        } else if (item == Items.STICK) {
            return 100;
        } else if (item != Items.BOW && item != Items.FISHING_ROD) {
            if (item == Items.SIGN) {
                return 200;
            } else if (item == Items.COAL) {
                return 1600;
            } else if (item == Items.LAVA_BUCKET) {
                return 20000;
            } else if (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL) {
                if (item == Items.BLAZE_ROD) {
                    return 2400;
                } else if (item instanceof ItemDoor && item != Items.IRON_DOOR) {
                    return 200;
                } else {
                    return item instanceof ItemBoat ? 400 : 0;
                }
            } else {
                return 100;
            }
        } else {
            return 300;
        }
    }
}
Also used : ItemSword(net.minecraft.item.ItemSword) Item(net.minecraft.item.Item) ItemHoe(net.minecraft.item.ItemHoe) ItemTool(net.minecraft.item.ItemTool) ItemBoat(net.minecraft.item.ItemBoat) ItemDoor(net.minecraft.item.ItemDoor)

Aggregations

ItemSword (net.minecraft.item.ItemSword)76 ItemStack (net.minecraft.item.ItemStack)53 Item (net.minecraft.item.Item)25 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)23 EntityPlayer (net.minecraft.entity.player.EntityPlayer)22 ItemTool (net.minecraft.item.ItemTool)21 ItemHoe (net.minecraft.item.ItemHoe)18 IBlockState (net.minecraft.block.state.IBlockState)17 ItemBow (net.minecraft.item.ItemBow)15 Entity (net.minecraft.entity.Entity)13 Block (net.minecraft.block.Block)9 EntityLivingBase (net.minecraft.entity.EntityLivingBase)8 ItemAxe (net.minecraft.item.ItemAxe)8 ItemBlock (net.minecraft.item.ItemBlock)8 World (net.minecraft.world.World)7 ItemArmor (net.minecraft.item.ItemArmor)6 ItemFishingRod (net.minecraft.item.ItemFishingRod)6 DamageSource (net.minecraft.util.DamageSource)6 ItemDoor (net.minecraft.item.ItemDoor)5 ItemShield (net.minecraft.item.ItemShield)5