Port attack event

This commit is contained in:
ThisIsALegitUsername 2022-12-29 03:08:19 +00:00
parent f940f5c04f
commit d127a2996a
12 changed files with 69148 additions and 69121 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,7 @@ public class ModManager {
public static SmoothCamera smoothCamera; public static SmoothCamera smoothCamera;
public FPSB fpsb = new FPSB(); public FPSB fpsb = new FPSB();
public static FakeArray fakeArray; public static FakeArray fakeArray;
public static Animations animations; public static Animations animations = new Animations();
public MinimalViewBobbing minimalViewBobbing = new MinimalViewBobbing(); public MinimalViewBobbing minimalViewBobbing = new MinimalViewBobbing();
public static Watermark watermark; public static Watermark watermark;
public static NoSwingDelay noSwingDelay; public static NoSwingDelay noSwingDelay;
@ -130,7 +130,7 @@ public class ModManager {
register(clearChat = new ClearChat()); register(clearChat = new ClearChat());
register(tooltips = new Tooltips()); register(tooltips = new Tooltips());
register(smoothCamera = new SmoothCamera()); register(smoothCamera = new SmoothCamera());
register(animations = new Animations()); register(animations);
} }

View File

@ -4,15 +4,17 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import dev.resent.module.base.ModManager;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.BaseAttributeMap; import net.minecraft.entity.ai.attributes.BaseAttributeMap;
@ -886,6 +888,11 @@ public abstract class EntityLivingBase extends Entity {
* account. * account.
*/ */
private int getArmSwingAnimationEnd() { private int getArmSwingAnimationEnd() {
if(ModManager.animations.isEnabled() && Minecraft.getMinecraft().theWorld != null){
return 10;
}
return this.isPotionActive(Potion.digSpeed) return this.isPotionActive(Potion.digSpeed)
? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1
: (this.isPotionActive(Potion.digSlowdown) : (this.isPotionActive(Potion.digSlowdown)

View File

@ -2,11 +2,13 @@ package net.minecraft.entity.player;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.resent.Resent;
import dev.resent.event.impl.EventAttack;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile; import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBed; import net.minecraft.block.BlockBed;
@ -1018,6 +1020,10 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
* Args: targetEntity * Args: targetEntity
*/ */
public void attackTargetEntityWithCurrentItem(Entity entity) { public void attackTargetEntityWithCurrentItem(Entity entity) {
EventAttack event = new EventAttack(entity);
Resent.INSTANCE.events().post(event);
if (entity.canAttackWithItem()) { if (entity.canAttackWithItem()) {
if (!entity.hitByEntity(this)) { if (!entity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();