Skip to content

Commit

Permalink
color
Browse files Browse the repository at this point in the history
  • Loading branch information
ImToggle committed Apr 3, 2024
1 parent a5b35bc commit e6b79b0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ public abstract class WorldRendererMixin {
private void color(float red, float green, float blue, float alpha, CallbackInfoReturnable<WorldRenderer> cir) {
if (PolyParticles.INSTANCE.getRendering()) {
ParticleConfig config = ModConfig.INSTANCE.getConfig(PolyParticles.INSTANCE.getRenderingEntity());
if (config != null) {
if (config != null && config.getId() != 28) {
OneColor c = config.getEntry().getColor();
int a = UtilKt.colorInt(c.getAlpha(), alpha, config);
if (config.getId() == 28) a = Math.min(a, (int) (alpha * 255f));
cir.setReturnValue(this.color(UtilKt.colorInt(c.getRed(), red, config), UtilKt.colorInt(c.getGreen(), green, config), UtilKt.colorInt(c.getBlue(), blue, config), a));
cir.setReturnValue(this.color(UtilKt.colorInt(c.getRed(), red, config), UtilKt.colorInt(c.getGreen(), green, config), UtilKt.colorInt(c.getBlue(), blue, config), UtilKt.colorInt(c.getAlpha(), alpha, config)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

import cc.polyfrost.oneconfig.config.annotations.Slider;
import cc.polyfrost.oneconfig.gui.elements.config.ConfigSlider;
import cc.polyfrost.oneconfig.libs.universal.UChat;
import org.polyfrost.polyparticles.PolyParticles;
import org.polyfrost.polyparticles.config.ModConfig;
import org.polyfrost.polyparticles.config.ParticleEntry;
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.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.lang.reflect.Field;
Expand All @@ -20,10 +17,12 @@ public class ConfigSliderMixin {
@Inject(method = "create", at = @At("HEAD"), cancellable = true)
private static void cap(Field field, Object parent, CallbackInfoReturnable<ConfigSlider> cir) {
if (parent instanceof ParticleEntry) {
ParticleEntry entry = (ParticleEntry) parent;
if (PolyParticles.INSTANCE.getUnfair().contains(entry.getID())) {
Slider slider = field.getAnnotation(Slider.class);
if (Objects.equals(slider.name(), "Size")) {
Slider slider = field.getAnnotation(Slider.class);
if (Objects.equals(slider.name(), "Size")) {
ParticleEntry entry = (ParticleEntry) parent;
int id = entry.getID();
System.out.println(id);
if (PolyParticles.INSTANCE.getUnfair().contains(id)) {
cir.setReturnValue(new ConfigSlider(field, parent, slider.name(), slider.description(), slider.category(), slider.subcategory(), slider.min(), 1f, slider.step(), slider.instant()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ParticleConfig(val name: String, val id: Int) : Config(Mod(name, ModType.U
addDependency("color", "customColor")
addDependency("colorMode", "customColor")
hideIf("multiplier") { PolyParticles.unfair.contains(id) }
hideIf("color") { id == 28 }
}

override fun reInitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class ParticleEntry {
}

fun getID(): Int {
for (i in 0..<ModConfig.particles.entries.size) {
if (ModConfig.particles[PolyParticles.names[i]] == this) {
return i
for (i in ModConfig.particles) {
if (i.value == this) {
return PolyParticles.names.indexOf(i.key)
}
}
return 100
Expand Down

0 comments on commit e6b79b0

Please sign in to comment.