diff --git a/changelog.md b/changelog.md index 08bce08..c605a47 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,5 @@ - Added Censor Mode Setting - Improved Surface Detection (Goop now sticks to non-full block surfaces like slabs) - goop is no longer offset weirdly in negative coordinates -- Added Random Rotation Setting \ No newline at end of file +- Added Random Rotation Setting +- Added Keybind for clearing all Goop \ No newline at end of file diff --git a/src/main/java/absolutelyaya/goop/client/GoopClient.java b/src/main/java/absolutelyaya/goop/client/GoopClient.java index 20bd800..0ab5eec 100644 --- a/src/main/java/absolutelyaya/goop/client/GoopClient.java +++ b/src/main/java/absolutelyaya/goop/client/GoopClient.java @@ -4,6 +4,7 @@ import absolutelyaya.goop.particles.GoopDropParticle; import absolutelyaya.goop.particles.GoopParticle; import absolutelyaya.goop.particles.GoopStringParticle; +import absolutelyaya.goop.registries.KeybindRegistry; import absolutelyaya.goop.registries.PacketRegistry; import absolutelyaya.goop.registries.ParticleRegistry; import me.shedaniel.autoconfig.AutoConfig; @@ -33,6 +34,7 @@ public void onInitializeClient() particleRegistry.register(ParticleRegistry.EGG_GOOP, EggGoopParticle.Factory::new); PacketRegistry.registerClient(); + KeybindRegistry.register(); } public static boolean recolorMature() diff --git a/src/main/java/absolutelyaya/goop/particles/GoopDropParticle.java b/src/main/java/absolutelyaya/goop/particles/GoopDropParticle.java index 835cc95..97e4bec 100644 --- a/src/main/java/absolutelyaya/goop/particles/GoopDropParticle.java +++ b/src/main/java/absolutelyaya/goop/particles/GoopDropParticle.java @@ -12,7 +12,6 @@ import net.minecraft.entity.Entity; import net.minecraft.particle.DustParticleEffect; import net.minecraft.particle.ParticleType; -import net.minecraft.particle.ParticleTypes; import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; @@ -46,7 +45,7 @@ protected GoopDropParticle(ClientWorld clientWorld, Vec3d pos, Vec3d vel, Sprite { super(clientWorld, pos.x, pos.y, pos.z); GoopConfig config = GoopClient.getConfig(); - color = mature && config.censorMature ? Vec3d.unpackRgb(config.censorColor) : color; + color = mature && GoopClient.recolorMature() ? Vec3d.unpackRgb(config.censorColor) : color; setColor((float)color.getX(), (float)color.getY(), (float)color.getZ()); this.color = color; this.scale = scale - (scale > 1 ? 1.25f * (scale / 2) : 0f); diff --git a/src/main/java/absolutelyaya/goop/particles/GoopParticle.java b/src/main/java/absolutelyaya/goop/particles/GoopParticle.java index 2bc37e3..6eb6e87 100644 --- a/src/main/java/absolutelyaya/goop/particles/GoopParticle.java +++ b/src/main/java/absolutelyaya/goop/particles/GoopParticle.java @@ -15,6 +15,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Queue; public class GoopParticle extends SurfaceAlignedParticle @@ -34,7 +35,7 @@ protected GoopParticle(ClientWorld world, double x, double y, double z, SpritePr super(world, x, y, z, spriteProvider, color, scale, dir, deform); this.maxAge = config.permanent ? Integer.MAX_VALUE : 200 + random.nextInt(100); this.alpha = Math.min(random.nextFloat() + 0.5f, 1); - this.color = mature && config.censorMature ? Vec3d.unpackRgb(config.censorColor) : color; + this.color = mature && GoopClient.recolorMature() ? Vec3d.unpackRgb(config.censorColor) : color; this.scale = 0; this.size = scale; this.normalAlpha = alpha; @@ -111,6 +112,11 @@ public void markDead() GOOP_QUEUE.remove(this); } + public static void removeAll() + { + new ArrayList<>(GOOP_QUEUE).forEach(GoopParticle::markDead); + } + public static class Factory implements ParticleFactory { protected final SpriteProvider spriteProvider; diff --git a/src/main/java/absolutelyaya/goop/particles/GoopStringParticle.java b/src/main/java/absolutelyaya/goop/particles/GoopStringParticle.java index 1eba5d6..2a10b07 100644 --- a/src/main/java/absolutelyaya/goop/particles/GoopStringParticle.java +++ b/src/main/java/absolutelyaya/goop/particles/GoopStringParticle.java @@ -19,7 +19,7 @@ protected GoopStringParticle(ClientWorld world, Vec3d pos, SpriteProvider sprite gravityStrength = random.nextFloat() * 0.25f + 0.1f; maxAge = random.nextInt(15) + 20; GoopConfig config = GoopClient.getConfig(); - color = mature && config.censorMature ? Vec3d.unpackRgb(config.censorColor) : color; + color = mature && GoopClient.recolorMature() ? Vec3d.unpackRgb(config.censorColor) : color; setColor((float)color.getX(), (float)color.getY(), (float)color.getZ()); this.scale = this.scale.multiply(scale); collidesWithWorld = true; diff --git a/src/main/java/absolutelyaya/goop/registries/KeybindRegistry.java b/src/main/java/absolutelyaya/goop/registries/KeybindRegistry.java new file mode 100644 index 0000000..f818c9e --- /dev/null +++ b/src/main/java/absolutelyaya/goop/registries/KeybindRegistry.java @@ -0,0 +1,30 @@ +package absolutelyaya.goop.registries; + +import absolutelyaya.goop.particles.GoopParticle; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; + +public class KeybindRegistry +{ + public static final KeyBinding CLEAR_GOOP = KeyBindingHelper.registerKeyBinding( + new KeyBinding("key.goop.clear", InputUtil.Type.KEYSYM, + InputUtil.UNKNOWN_KEY.getCode(), "category.goop")); + + static boolean clearPressed; + + public static void register() + { + ClientTickEvents.END_CLIENT_TICK.register(client -> + { + while (CLEAR_GOOP.wasPressed() && !clearPressed) + { + GoopParticle.removeAll(); + clearPressed = true; + } + while (CLEAR_GOOP.wasPressed()); //remove stored presses + clearPressed = CLEAR_GOOP.isPressed(); + }); + } +} diff --git a/src/main/resources/assets/goop/lang/en_us.json b/src/main/resources/assets/goop/lang/en_us.json index 301f41b..f7a1162 100644 --- a/src/main/resources/assets/goop/lang/en_us.json +++ b/src/main/resources/assets/goop/lang/en_us.json @@ -2,6 +2,9 @@ "modmenu.descriptionTranslation.goop": "Adds Splatter Particle Effects for Blood, Slime or other cool VFX", "yaya.support.kofi": "Support yayas hijinx", + "category.goop": "Goop Technology", + "key.goop.clear": "Clear Goop", + "text.autoconfig.goop.title": "Goop Config", "text.autoconfig.goop.category.default": "Goop", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e46380b..24f2b53 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,7 +8,9 @@ "Absolutelyaya" ], "contact": { - "repo": "https://github.com/absolutelyaya/Goop" + "issues": "https://github.com/absolutelyaya/Goop/issues", + "repo": "https://github.com/absolutelyaya/Goop", + "homepage": "https://absolutelyaya.neocities.org/" }, "license": "MIT", "icon": "assets/goop/icon.png",