mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Improve FreecamHack
This commit is contained in:
parent
d03a2733ab
commit
d40a6bdfd2
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2022 Wurst-Imperium and contributors.
|
||||
*
|
||||
* This source code is subject to the terms of the GNU General Public
|
||||
* License, version 3. If a copy of the GPL was not distributed with this
|
||||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
package net.wurstclient.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.wurstclient.event.Event;
|
||||
import net.wurstclient.event.Listener;
|
||||
|
||||
public interface IsPlayerInLavaListener extends Listener
|
||||
{
|
||||
public void onIsPlayerInLava(IsPlayerInLavaEvent event);
|
||||
|
||||
public static class IsPlayerInLavaEvent
|
||||
extends Event<IsPlayerInLavaListener>
|
||||
{
|
||||
private boolean inLava;
|
||||
private final boolean normallyInLava;
|
||||
|
||||
public IsPlayerInLavaEvent(boolean inLava)
|
||||
{
|
||||
this.inLava = inLava;
|
||||
normallyInLava = inLava;
|
||||
}
|
||||
|
||||
public boolean isInLava()
|
||||
{
|
||||
return inLava;
|
||||
}
|
||||
|
||||
public void setInLava(boolean inLava)
|
||||
{
|
||||
this.inLava = inLava;
|
||||
}
|
||||
|
||||
public boolean isNormallyInLava()
|
||||
{
|
||||
return normallyInLava;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fire(ArrayList<IsPlayerInLavaListener> listeners)
|
||||
{
|
||||
for(IsPlayerInLavaListener listener : listeners)
|
||||
listener.onIsPlayerInLava(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IsPlayerInLavaListener> getListenerType()
|
||||
{
|
||||
return IsPlayerInLavaListener.class;
|
||||
}
|
||||
}
|
||||
}
|
@ -31,7 +31,6 @@ import net.wurstclient.SearchTags;
|
||||
import net.wurstclient.events.*;
|
||||
import net.wurstclient.hack.DontSaveState;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.mixinterface.IClientPlayerEntity;
|
||||
import net.wurstclient.mixinterface.IKeyBinding;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.ColorSetting;
|
||||
@ -44,8 +43,8 @@ import net.wurstclient.util.RotationUtils;
|
||||
@DontSaveState
|
||||
@SearchTags({"free camera", "spectator"})
|
||||
public final class FreecamHack extends Hack
|
||||
implements UpdateListener, PacketOutputListener, PlayerMoveListener,
|
||||
IsPlayerInWaterListener, CameraTransformViewBobbingListener,
|
||||
implements UpdateListener, PacketOutputListener, IsPlayerInWaterListener,
|
||||
IsPlayerInLavaListener, CameraTransformViewBobbingListener,
|
||||
IsNormalCubeListener, SetOpaqueCubeListener, RenderListener
|
||||
{
|
||||
private final SliderSetting speed =
|
||||
@ -74,7 +73,7 @@ public final class FreecamHack extends Hack
|
||||
EVENTS.add(UpdateListener.class, this);
|
||||
EVENTS.add(PacketOutputListener.class, this);
|
||||
EVENTS.add(IsPlayerInWaterListener.class, this);
|
||||
EVENTS.add(PlayerMoveListener.class, this);
|
||||
EVENTS.add(IsPlayerInLavaListener.class, this);
|
||||
EVENTS.add(CameraTransformViewBobbingListener.class, this);
|
||||
EVENTS.add(IsNormalCubeListener.class, this);
|
||||
EVENTS.add(SetOpaqueCubeListener.class, this);
|
||||
@ -96,7 +95,7 @@ public final class FreecamHack extends Hack
|
||||
EVENTS.remove(UpdateListener.class, this);
|
||||
EVENTS.remove(PacketOutputListener.class, this);
|
||||
EVENTS.remove(IsPlayerInWaterListener.class, this);
|
||||
EVENTS.remove(PlayerMoveListener.class, this);
|
||||
EVENTS.remove(IsPlayerInLavaListener.class, this);
|
||||
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
|
||||
EVENTS.remove(IsNormalCubeListener.class, this);
|
||||
EVENTS.remove(SetOpaqueCubeListener.class, this);
|
||||
@ -116,6 +115,7 @@ public final class FreecamHack extends Hack
|
||||
{
|
||||
ClientPlayerEntity player = MC.player;
|
||||
player.setVelocity(Vec3d.ZERO);
|
||||
player.getAbilities().flying = false;
|
||||
|
||||
player.setOnGround(false);
|
||||
player.airStrafingSpeed = speed.getValueF();
|
||||
@ -135,18 +135,18 @@ public final class FreecamHack extends Hack
|
||||
event.cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(IClientPlayerEntity player)
|
||||
{
|
||||
player.setNoClip(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayerInWater(IsPlayerInWaterEvent event)
|
||||
{
|
||||
event.setInWater(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayerInLava(IsPlayerInLavaEvent event)
|
||||
{
|
||||
event.setInLava(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraTransformViewBobbing(
|
||||
CameraTransformViewBobbingEvent event)
|
||||
|
@ -41,6 +41,7 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.wurstclient.WurstClient;
|
||||
import net.wurstclient.event.EventManager;
|
||||
import net.wurstclient.events.IsPlayerInLavaListener.IsPlayerInLavaEvent;
|
||||
import net.wurstclient.events.IsPlayerInWaterListener.IsPlayerInWaterEvent;
|
||||
import net.wurstclient.events.KnockbackListener.KnockbackEvent;
|
||||
import net.wurstclient.events.PlayerMoveListener.PlayerMoveEvent;
|
||||
@ -188,6 +189,23 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
||||
return event.isInWater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInLava()
|
||||
{
|
||||
boolean inLava = super.isInLava();
|
||||
IsPlayerInLavaEvent event = new IsPlayerInLavaEvent(inLava);
|
||||
EventManager.fire(event);
|
||||
|
||||
return event.isInLava();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpectator()
|
||||
{
|
||||
return super.isSpectator()
|
||||
|| WurstClient.INSTANCE.getHax().freecamHack.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTouchingWaterBypass()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user