-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/dev/stardust/mixin/BannerBlockEntityRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dev.stardust.mixin; | ||
|
||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import net.minecraft.block.entity.BannerBlockEntity; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import meteordevelopment.meteorclient.systems.modules.render.NoRender; | ||
import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; | ||
|
||
/** | ||
* @author Tas [0xTas] <root@0xTas.dev> | ||
**/ | ||
@Mixin(BannerBlockEntityRenderer.class) | ||
public class BannerBlockEntityRendererMixin { | ||
|
||
// See NoRenderMixin.java | ||
@Inject(method = "render(Lnet/minecraft/block/entity/BannerBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) | ||
private void onRender(BannerBlockEntity bannerBlockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) { | ||
if (bannerBlockEntity.getWorld() != null) { | ||
Modules mods = Modules.get(); | ||
if (mods == null) return; | ||
NoRender noRender = mods.get(NoRender.class); | ||
if (!noRender.isActive()) return; | ||
|
||
Text bannerName = bannerBlockEntity.getCustomName(); | ||
var bannerSetting = noRender.settings.get("cody-banners"); | ||
|
||
if (bannerSetting == null || bannerName == null) return; | ||
if ((boolean) bannerSetting.get() && bannerName.getString().contains("codysmile11")) { | ||
ci.cancel(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/dev/stardust/mixin/meteor/NoRenderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package dev.stardust.mixin.meteor; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import meteordevelopment.meteorclient.settings.Setting; | ||
import meteordevelopment.meteorclient.settings.BoolSetting; | ||
import meteordevelopment.meteorclient.settings.SettingGroup; | ||
import meteordevelopment.meteorclient.systems.modules.Module; | ||
import meteordevelopment.meteorclient.systems.modules.Category; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import meteordevelopment.meteorclient.systems.modules.render.NoRender; | ||
|
||
/** | ||
* @author Tas [0xTas] <root@0xTas.dev> | ||
**/ | ||
// TODO: Paul wants this to stop the signs from showing up on another client's search somehow... | ||
@Mixin(value = NoRender.class, remap = false) | ||
public abstract class NoRenderMixin extends Module { | ||
public NoRenderMixin(Category category, String name, String description) { | ||
super(category, name, description); | ||
} | ||
|
||
@Unique | ||
private final SettingGroup sgCody = settings.createGroup("codysmile11"); | ||
@Unique | ||
private @Nullable Setting<Boolean> codySigns = null; | ||
@Unique | ||
private @Nullable Setting<Boolean> codyPlayer = null; | ||
@Unique | ||
private @Nullable Setting<Boolean> codyBanners = null; | ||
|
||
@Inject(method = "<init>", at = @At(value = "FIELD", target = "Lmeteordevelopment/meteorclient/systems/modules/render/NoRender;noSignText:Lmeteordevelopment/meteorclient/settings/Setting;")) | ||
private void addNoRenderSettings(CallbackInfo ci) { | ||
// See EntityRendererMixin.java | ||
codyPlayer = sgCody.add( | ||
new BoolSetting.Builder() | ||
.name("cody") | ||
.description("Ignore his very existence.") | ||
.defaultValue(false) | ||
.build() | ||
); | ||
codySigns = sgCody.add( | ||
new BoolSetting.Builder() | ||
.name("cody-signs") | ||
.description("Don't render signs which contain the text \"codysmile11\".") | ||
.defaultValue(false) | ||
.build() | ||
); | ||
codyBanners = sgCody.add( | ||
new BoolSetting.Builder() | ||
.name("cody-banners") | ||
.description("Don't render banners which contain \"codysmile11\" in the name.") | ||
.defaultValue(false) | ||
.build() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters