Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.registries.BuiltInRegistries;

Expand All @@ -21,11 +20,6 @@ public ParticleTypeListSettingScreen(GuiTheme theme, Setting<List<ParticleType<?
super(theme, "Select Particles", setting, setting.get(), BuiltInRegistries.PARTICLE_TYPE);
}

@Override
protected boolean includeValue(ParticleType<?> value) {
return value instanceof ParticleOptions;
}

@Override
protected WWidget getValueWidget(ParticleType<?> value) {
return theme.label(Names.get(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -42,20 +43,22 @@ private void onRemoveEntity(int id, Entity.RemovalReason reason, CallbackInfo ci
MeteorClient.EVENT_BUS.post(EntityRemovedEvent.get(getEntity(id)));
}

@Inject(method = "addDestroyBlockEffect", at = @At("HEAD"), cancellable = true)
private void onAddDestroyBlockEffect(BlockPos pos, BlockState blockState, CallbackInfo ci) {
if (Modules.get().get(NoRender.class).noParticle(ParticleTypes.BLOCK)) ci.cancel();
}

@Inject(method = "addBreakingBlockEffect", at = @At("HEAD"), cancellable = true)
private void onAddBlockBreakingParticles(BlockPos pos, Direction direction, CallbackInfo ci) {
if (Modules.get().get(NoRender.class).noParticle(ParticleTypes.BLOCK)) ci.cancel();
}

@ModifyArgs(method = "animateTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;doAnimateTick(IIIILnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/block/Block;Lnet/minecraft/core/BlockPos$MutableBlockPos;)V"))
private void doRandomBlockDisplayTicks(Args args) {
if (Modules.get().get(NoRender.class).noBarrierInvis()) {
args.set(5, Blocks.BARRIER);
}
}

@Inject(method = "addDestroyBlockEffect", at = @At("HEAD"), cancellable = true)
private void onAddDestroyBlockEffect(BlockPos pos, BlockState blockState, CallbackInfo ci) {
if (Modules.get().get(NoRender.class).noBlockBreakParticles()) ci.cancel();
}

@Inject(method = "addBreakingBlockEffect", at = @At("HEAD"), cancellable = true)
private void onAddBlockBreakingParticles(BlockPos pos, Direction direction, CallbackInfo ci) {
if (Modules.get().get(NoRender.class).noBlockBreakParticles()) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,17 @@
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ParticleEngine.class)
public abstract class ParticleEngineMixin {
@Shadow
@Nullable
protected abstract <T extends ParticleOptions> Particle makeParticle(T options, double x, double y, double z, double xa, double ya, double za);

@Inject(method = "createParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)Lnet/minecraft/client/particle/Particle;", at = @At("HEAD"), cancellable = true)
private void onCreateParticle(ParticleOptions options, double x, double y, double z, double xa, double ya, double za, CallbackInfoReturnable<Particle> cir) {
ParticleEvent event = MeteorClient.EVENT_BUS.post(ParticleEvent.get(options));

if (event.isCancelled()) {
if (options.getType() == ParticleTypes.FLASH)
cir.setReturnValue(makeParticle(options, x, y, z, xa, ya, za));
else cir.cancel();
}
if (event.isCancelled()) cir.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected List<ParticleType<?>> parseImpl(String str) {
try {
for (String value : values) {
ParticleType<?> particleType = parseId(BuiltInRegistries.PARTICLE_TYPE, value);
if (particleType instanceof ParticleOptions) particleTypes.add(particleType);
if (particleType != null) particleTypes.add(particleType);
}
} catch (Exception _) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,6 @@ public class NoRender extends Module {
.build()
);

private final Setting<Boolean> noBlockBreakParticles = sgWorld.add(new BoolSetting.Builder()
.name("block-break-particles")
.description("Disables rendering of block-break particles.")
.defaultValue(false)
.build()
);

private final Setting<Boolean> noBlockBreakOverlay = sgWorld.add(new BoolSetting.Builder()
.name("block-break-overlay")
.description("Disables rendering of block-break overlay.")
Expand Down Expand Up @@ -512,8 +505,8 @@ public boolean noSignText() {
return isActive() && noSignText.get();
}

public boolean noBlockBreakParticles() {
return isActive() && noBlockBreakParticles.get();
public boolean noParticle(ParticleType<?> type) {
return isActive() && particles.get().contains(type);
}

public boolean noBlockBreakOverlay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.sounds.WeighedSoundEvents;
import net.minecraft.core.Holder;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand Down Expand Up @@ -107,7 +106,6 @@ public static String get(EntityType<?> entityType) {
}

public static String get(ParticleType<?> type) {
if (!(type instanceof ParticleOptions)) return "";
return particleTypesNames.computeIfAbsent(type, _ -> StringUtils.capitalize(BuiltInRegistries.PARTICLE_TYPE.getKey(type).getPath().replace("_", " ")));
}

Expand Down