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);
}
}
}
}
}
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();
}
}
}
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];
}
}
}
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();
}
}
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;
}
}
}
Aggregations