please work

This commit is contained in:
UnknownUser1789 2023-01-23 22:45:04 +00:00
parent 23cf872a5e
commit b5029d0869
9 changed files with 26723 additions and 26806 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
package dev.resent; package dev.resent;
import dev.resent.event.impl.Event;
import dev.resent.module.base.ModManager; import dev.resent.module.base.ModManager;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -18,6 +17,4 @@ public class Resent {
public void init() { public void init() {
Resent.INSTANCE.modManager = new ModManager(); Resent.INSTANCE.modManager = new ModManager();
} }
public static void onEvent(Event e) {}
} }

View File

@ -1,35 +0,0 @@
package dev.resent.event.impl;
public abstract class Event {
public abstract boolean isCancelled();
public abstract void setCancelled(boolean cancelled);
public void setType(EventType type) {
this.type = type;
}
public EventType getType() {
return type;
}
public EventType type;
public boolean isPre() {
if (type == null) return false;
return type == EventType.pre;
}
public boolean isPost() {
if (type == null) return false;
return type == EventType.post;
}
public enum EventType {
pre,
post
}
}

View File

@ -1,18 +0,0 @@
package dev.resent.event.impl;
import net.minecraft.entity.Entity;
public class EventAttack extends Event {
public Entity target;
public boolean cancelled;
public EventAttack(Entity target) {
this.target = target;
}
@Override
public boolean isCancelled() { return cancelled; }
@Override
public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
}

View File

@ -4,8 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import dev.resent.Resent;
import dev.resent.event.impl.Event;
import dev.resent.module.Theme; import dev.resent.module.Theme;
import dev.resent.module.setting.Setting; import dev.resent.module.setting.Setting;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
@ -60,18 +58,13 @@ public class Mod {
} }
} }
public void onEvent(Event e) {
for (int i = 0; i < Resent.INSTANCE.modManager.modules.size(); i++) {
if (!Resent.INSTANCE.modManager.modules.get(i).isEnabled()) continue;
Resent.INSTANCE.modManager.modules.get(i).onEvent(e);
}
}
public void setEnabled(boolean state) { public void setEnabled(boolean state) {
this.enabled = state; this.enabled = state;
if (this.enabled) onEnable(); else onDisable(); if (this.enabled) onEnable(); else onDisable();
} }
public boolean isEnabled() { return enabled; } public boolean isEnabled() { return enabled; }
public String getName() { return name; } public String getName() { return name; }

View File

@ -1,12 +1,11 @@
package dev.resent.module.impl.hud; package dev.resent.module.impl.hud;
import dev.resent.event.impl.Event;
import dev.resent.event.impl.EventAttack;
import dev.resent.module.Theme; import dev.resent.module.Theme;
import dev.resent.module.base.Category; import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule; import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting; import dev.resent.module.setting.BooleanSetting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.network.play.server.S19PacketEntityStatus; import net.minecraft.network.play.server.S19PacketEntityStatus;
public class ComboCounter extends RenderModule { public class ComboCounter extends RenderModule {
@ -20,9 +19,8 @@ public class ComboCounter extends RenderModule {
addSetting(tshadow); addSetting(tshadow);
} }
public void onEvent(Event e) { public void onAttack(Entity e) {
if (e instanceof EventAttack && isEnabled()) { if (this.isEnabled()) {
System.out.println("debug cc");
attacked = true; attacked = true;
} }
} }

View File

@ -2,12 +2,10 @@ package dev.resent.module.impl.hud;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import dev.resent.event.impl.Event;
import dev.resent.event.impl.EventAttack;
import dev.resent.module.Theme; import dev.resent.module.Theme;
import dev.resent.module.base.Category; import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule; import dev.resent.module.base.RenderModule;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
public class ReachDisplay extends RenderModule { public class ReachDisplay extends RenderModule {
@ -32,15 +30,10 @@ public class ReachDisplay extends RenderModule {
mc.fontRendererObj.drawStringWithShadow("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId())); mc.fontRendererObj.drawStringWithShadow("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()));
} }
@Override public void onAttack(Entity e){
public void onEvent(Event e) { if(this.isEnabled()){
if(e instanceof EventAttack){
System.out.println("debug rdisp");
if (this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && this.isEnabled() && this.mc.objectMouseOver.entityHit.getEntityId() == ((EventAttack)e).target.getEntityId()) {
System.out.println("debug rdisp 2");
final Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0f); final Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0f);
this.range = this.mc.objectMouseOver.hitVec.distanceTo(vec3); this.range = this.mc.objectMouseOver.hitVec.distanceTo(vec3);
} }
}
} }
} }

View File

@ -7,9 +7,7 @@ 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.Resent;
import dev.resent.event.impl.Event.EventType;
import dev.resent.module.base.ModManager; import dev.resent.module.base.ModManager;
import dev.resent.event.impl.EventAttack;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; 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;
@ -992,9 +990,9 @@ 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);
event.setType(EventType.pre); ModManager.reachDisplay.onAttack(entity);
Resent.onEvent(event); ModManager.comboCounter.onAttack(entity);
MovingObjectPosition hitResult = Minecraft.getMinecraft().objectMouseOver; MovingObjectPosition hitResult = Minecraft.getMinecraft().objectMouseOver;
if (hitResult == null) if (hitResult == null)