mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-14 05:31:33 +01:00
Events (100%)
This commit is contained in:
parent
343c6a149e
commit
8f0cb20a23
@ -10,6 +10,7 @@ import net.silentclient.client.cosmetics.StaticResourceLocation;
|
|||||||
import net.silentclient.client.event.impl.EventCameraRotation;
|
import net.silentclient.client.event.impl.EventCameraRotation;
|
||||||
import net.silentclient.client.event.impl.EventPlayerHeadRotation;
|
import net.silentclient.client.event.impl.EventPlayerHeadRotation;
|
||||||
import net.silentclient.client.event.impl.EventRender3D;
|
import net.silentclient.client.event.impl.EventRender3D;
|
||||||
|
import net.silentclient.client.event.impl.EventZoomFov;
|
||||||
import net.silentclient.client.mixin.ducks.EntityRendererExt;
|
import net.silentclient.client.mixin.ducks.EntityRendererExt;
|
||||||
import net.silentclient.client.utils.culling.EntityCulling;
|
import net.silentclient.client.utils.culling.EntityCulling;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -19,6 +20,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(EntityRenderer.class)
|
@Mixin(EntityRenderer.class)
|
||||||
public abstract class EntityRendererMixin implements EntityRendererExt {
|
public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||||
@ -104,4 +106,12 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
|||||||
private void shouldNotPerformCulling(CallbackInfo ci) {
|
private void shouldNotPerformCulling(CallbackInfo ci) {
|
||||||
EntityCulling.shouldPerformCulling = false;
|
EntityCulling.shouldPerformCulling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getFOVModifier", at = @At("RETURN"), cancellable = true)
|
||||||
|
public void getFOVModifier(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable<Float> cir) {
|
||||||
|
EventZoomFov event = new EventZoomFov(cir.getReturnValue());
|
||||||
|
event.call();
|
||||||
|
|
||||||
|
cir.setReturnValue(event.getFov());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,10 @@ package net.silentclient.client.mixin.mixins;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S02PacketChat;
|
||||||
import net.silentclient.client.event.impl.EventReceivePacket;
|
import net.silentclient.client.event.impl.EventReceivePacket;
|
||||||
import net.silentclient.client.event.impl.EventSendPacket;
|
import net.silentclient.client.event.impl.EventSendPacket;
|
||||||
|
import net.silentclient.client.event.impl.NewMessageEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@ -12,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
@Mixin(NetworkManager.class)
|
@Mixin(NetworkManager.class)
|
||||||
public class NetworkManagerMixin {
|
public class NetworkManagerMixin {
|
||||||
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"))
|
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
|
||||||
public void packetEvent(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_, CallbackInfo ci) {
|
public void packetEvent(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_, CallbackInfo ci) {
|
||||||
EventReceivePacket event = new EventReceivePacket(p_channelRead0_2_);
|
EventReceivePacket event = new EventReceivePacket(p_channelRead0_2_);
|
||||||
event.call();
|
event.call();
|
||||||
@ -20,6 +22,15 @@ public class NetworkManagerMixin {
|
|||||||
if(event.isCancelable()) {
|
if(event.isCancelable()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(p_channelRead0_2_ instanceof S02PacketChat && ((S02PacketChat) p_channelRead0_2_).getType() == 0) {
|
||||||
|
NewMessageEvent event2 = new NewMessageEvent(((S02PacketChat) p_channelRead0_2_).getChatComponent());
|
||||||
|
event2.call();
|
||||||
|
|
||||||
|
if(event2.isCancelable()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"))
|
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"))
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package net.silentclient.client.mixin.mixins;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import net.minecraft.client.renderer.culling.ICamera;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.silentclient.client.event.impl.RenderTickEvent;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(RenderGlobal.class)
|
||||||
|
public class RenderGlobalMixin {
|
||||||
|
@Inject(method = "renderEntities", at = @At("HEAD"))
|
||||||
|
public void tickEvent(Entity renderViewEntity, ICamera camera, float partialTicks, CallbackInfo ci) {
|
||||||
|
new RenderTickEvent().call();
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,25 @@
|
|||||||
package net.silentclient.client.mixin.mixins;
|
package net.silentclient.client.mixin.mixins;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
|
import net.minecraft.entity.monster.IMob;
|
||||||
|
import net.minecraft.entity.passive.EntityAmbientCreature;
|
||||||
|
import net.minecraft.entity.passive.EntityAnimal;
|
||||||
|
import net.minecraft.entity.passive.EntityWaterMob;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.event.impl.EventHitOverlay;
|
import net.silentclient.client.event.impl.EventHitOverlay;
|
||||||
|
import net.silentclient.client.event.impl.RenderLivingEvent;
|
||||||
|
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||||
|
import net.silentclient.client.utils.culling.EntityCulling;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(RendererLivingEntity.class)
|
@Mixin(RendererLivingEntity.class)
|
||||||
@ -47,4 +59,29 @@ public class RendererLivingEntityMixin<T extends EntityLivingBase> {
|
|||||||
public float setBrightnessAlpha(float original) {
|
public float setBrightnessAlpha(float original) {
|
||||||
return alpha;
|
return alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void renderEvent(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
|
||||||
|
RenderLivingEvent event = new RenderLivingEvent(entity, x, y, z, (RendererLivingEntity<EntityLivingBase>) (Object) this);
|
||||||
|
event.call();
|
||||||
|
if(event.isCancelable()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
final float entityDistance = entity.getDistanceToEntity(Minecraft.getMinecraft().thePlayer);
|
||||||
|
if (EntityCulling.shouldPerformCulling) {
|
||||||
|
if (entity instanceof IMob && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hostile Entity Render Distance").getValInt()) {
|
||||||
|
ci.cancel();
|
||||||
|
} else if ((entity instanceof EntityAnimal || entity instanceof EntityAmbientCreature || entity instanceof EntityWaterMob) && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Passive Entity Render Distance").getValInt()) {
|
||||||
|
ci.cancel();
|
||||||
|
} else if (entity instanceof EntityPlayer && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Player Render Distance").getValInt()) {
|
||||||
|
ci.cancel();
|
||||||
|
} else if (entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Misc. Entity Render Distance").getValInt()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean() && entity instanceof EntityArmorStand) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
"mixins.WorldClientMixin",
|
"mixins.WorldClientMixin",
|
||||||
"mixins.NetworkManagerMixin",
|
"mixins.NetworkManagerMixin",
|
||||||
"mixins.RenderManagerMixin",
|
"mixins.RenderManagerMixin",
|
||||||
"mixins.ItemRendererMixin"
|
"mixins.ItemRendererMixin",
|
||||||
|
"mixins.RenderGlobalMixin"
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user