Skip to content

Commit

Permalink
Change ShouldDrawFacelessModelEvent back to ShouldDrawSideEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 29, 2023
1 parent fa0d37c commit 062311c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 58 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package net.wurstclient.events;

import java.util.ArrayList;
import java.util.Objects;

import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
Expand All @@ -27,7 +28,7 @@ public static class ShouldDrawSideEvent

public ShouldDrawSideEvent(BlockState state, BlockPos pos)
{
this.state = state;
this.state = Objects.requireNonNull(state);
this.pos = pos;
}

Expand Down
13 changes: 1 addition & 12 deletions src/main/java/net/wurstclient/hacks/XRayHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.wurstclient.events.GetAmbientOcclusionLightLevelListener;
import net.wurstclient.events.RenderBlockEntityListener;
import net.wurstclient.events.SetOpaqueCubeListener;
import net.wurstclient.events.ShouldDrawFacelessModelListener;
import net.wurstclient.events.ShouldDrawSideListener;
import net.wurstclient.events.TesselateBlockListener;
import net.wurstclient.events.UpdateListener;
Expand All @@ -38,8 +37,7 @@
@SearchTags({"XRay", "x ray", "OreFinder", "ore finder"})
public final class XRayHack extends Hack implements UpdateListener,
SetOpaqueCubeListener, GetAmbientOcclusionLightLevelListener,
ShouldDrawSideListener, ShouldDrawFacelessModelListener,
TesselateBlockListener, RenderBlockEntityListener
ShouldDrawSideListener, TesselateBlockListener, RenderBlockEntityListener
{
private final BlockListSetting ores = new BlockListSetting("Ores",
"A list of blocks that X-Ray will show. They don't have to be just ores"
Expand Down Expand Up @@ -111,7 +109,6 @@ public void onEnable()
EVENTS.add(SetOpaqueCubeListener.class, this);
EVENTS.add(GetAmbientOcclusionLightLevelListener.class, this);
EVENTS.add(ShouldDrawSideListener.class, this);
EVENTS.add(ShouldDrawFacelessModelListener.class, this);
EVENTS.add(TesselateBlockListener.class, this);
EVENTS.add(RenderBlockEntityListener.class, this);

Expand All @@ -131,7 +128,6 @@ public void onDisable()
EVENTS.remove(SetOpaqueCubeListener.class, this);
EVENTS.remove(GetAmbientOcclusionLightLevelListener.class, this);
EVENTS.remove(ShouldDrawSideListener.class, this);
EVENTS.remove(ShouldDrawFacelessModelListener.class, this);
EVENTS.remove(TesselateBlockListener.class, this);
EVENTS.remove(RenderBlockEntityListener.class, this);

Expand Down Expand Up @@ -172,13 +168,6 @@ public void onShouldDrawSide(ShouldDrawSideEvent event)
isVisible(event.getState().getBlock(), event.getPos()));
}

@Override
public void onShouldDrawFacelessModel(ShouldDrawFacelessModelEvent event)
{
if(!isVisible(event.getState().getBlock(), null))
event.cancel();
}

@Override
public void onTesselateBlock(TesselateBlockEvent event)
{
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.minecraft.util.math.random.Random;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.ShouldDrawFacelessModelListener.ShouldDrawFacelessModelEvent;
import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent;

@Mixin(BasicBakedModel.class)
public class BasicBakedModelMixin
Expand All @@ -39,11 +39,10 @@ private void getQuads(@Nullable BlockState state, @Nullable Direction face,
|| !WurstClient.INSTANCE.getHax().xRayHack.isEnabled())
return;

ShouldDrawFacelessModelEvent event =
new ShouldDrawFacelessModelEvent(state);
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, null);
EventManager.fire(event);

if(event.isCancelled())
if(Boolean.FALSE.equals(event.isRendered()))
cir.setReturnValue(List.of());
}
}

0 comments on commit 062311c

Please sign in to comment.