totem particle mod
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package org.saturnclient.saturnclient.mixin;
|
||||
|
||||
import net.minecraft.client.particle.AnimatedParticle;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.particle.TotemParticle;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
|
||||
import org.saturnclient.saturnmods.mods.Particles;
|
||||
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(TotemParticle.class)
|
||||
public class TotemParticleMixin extends AnimatedParticle {
|
||||
protected TotemParticleMixin(ClientWorld world, double x, double y, double z, SpriteProvider spriteProvider,
|
||||
float upwardsAcceleration) {
|
||||
super(world, x, y, z, spriteProvider, upwardsAcceleration);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "<init>")
|
||||
private void colorChanger(ClientWorld world, double x, double y, double z, double velocityX, double velocityY,
|
||||
double velocityZ, SpriteProvider spriteProvider, CallbackInfo ci) {
|
||||
if (Particles.enabled.value && Particles.totem_enabled.value) {
|
||||
if (this.random.nextInt(2) == 0) {
|
||||
this.setColor(ColorHelper.getRedFloat(Particles.totem_1.value),
|
||||
ColorHelper.getGreenFloat(Particles.totem_1.value),
|
||||
ColorHelper.getBlueFloat(Particles.totem_1.value));
|
||||
} else {
|
||||
this.setColor(ColorHelper.getRedFloat(Particles.totem_2.value),
|
||||
ColorHelper.getGreenFloat(Particles.totem_2.value),
|
||||
ColorHelper.getBlueFloat(Particles.totem_2.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,10 @@ import org.saturnclient.saturnmods.mods.*;
|
||||
public class ModManager {
|
||||
|
||||
public static SaturnMod[] MODS = {
|
||||
new Coordinates(),
|
||||
new ArmorDisplay(),
|
||||
new FpsDisplay(),
|
||||
new Coordinates(),
|
||||
new ArmorDisplay(),
|
||||
new FpsDisplay(),
|
||||
new Particles()
|
||||
};
|
||||
|
||||
public static void init() {
|
||||
@@ -21,10 +22,8 @@ public class ModManager {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
TextRenderer textRenderer = client.textRenderer;
|
||||
|
||||
if (
|
||||
textRenderer != null &&
|
||||
!(client.currentScreen instanceof HudEditor)
|
||||
) {
|
||||
if (textRenderer != null &&
|
||||
!(client.currentScreen instanceof HudEditor)) {
|
||||
SaturnClient.textRenderer = textRenderer;
|
||||
|
||||
for (SaturnMod m : MODS) {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.saturnclient.saturnmods.mods;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.saturnclient.saturnclient.SaturnClient;
|
||||
import org.saturnclient.saturnclient.config.ConfigManager;
|
||||
import org.saturnclient.saturnclient.config.Property;
|
||||
import org.saturnclient.saturnmods.SaturnMod;
|
||||
import org.saturnclient.ui.Textures;
|
||||
|
||||
public class Particles implements SaturnMod {
|
||||
public static ConfigManager config = new ConfigManager("Particles");
|
||||
|
||||
public static Property<Boolean> enabled = config.property(
|
||||
"Enabled",
|
||||
new Property<>(false));
|
||||
|
||||
public static Property<Boolean> totem_enabled = config.property(
|
||||
"Change totem color",
|
||||
new Property<>(false));
|
||||
|
||||
public static Property<Integer> totem_1 = config.property(
|
||||
"Totem particle color 1",
|
||||
new Property<>(SaturnClient.COLOR.value, Property.PropertyType.HEX));
|
||||
|
||||
public static Property<Integer> totem_2 = config.property(
|
||||
"Totem particle color 2",
|
||||
new Property<>(SaturnClient.COLOR.value, Property.PropertyType.HEX));
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Particles";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getIconTexture() {
|
||||
return Textures.getModIcon("particles");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigManager getConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -9,7 +9,8 @@
|
||||
"NameTagMixin",
|
||||
"PlayerEntityRendererMixin",
|
||||
"WhoAmI",
|
||||
"SaturnReload"
|
||||
"SaturnReload",
|
||||
"TotemParticleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user