mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-04 08:49:55 +01:00
Minimal Particles config option & optimizations
This commit is contained in:
parent
4111ceec81
commit
c91e441eab
@ -50,6 +50,7 @@ drainItems:
|
||||
- MILK_BUCKET/2
|
||||
|
||||
# Partikel steigen von Kesseln auf wenn sie Zutaten und eine Feuerquelle haben [true]
|
||||
# Die sich ändernde Farbe der Partikel kann beim Fermentieren mancher Rezepte helfen
|
||||
enableCauldronParticles: true
|
||||
|
||||
# Ob das craften und das benutzen des Trank-Versiegelungs-Tisches aktiviert ist (2 Flaschen über 4 Holz) [true, true]
|
||||
@ -502,6 +503,9 @@ colorInBrewer: true
|
||||
# Ob große Fässer an jedem Block geöffnet werden können, nicht nur an Zapfhahn und Schild. Bei kleinen Fässern geht dies immer. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# Ob nur ein Minimum an Kessel-Partikeln dargestellt werden sollen
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Chat Veränderungs Einstellungen --
|
||||
|
||||
|
@ -50,6 +50,7 @@ drainItems:
|
||||
- MILK_BUCKET/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -503,6 +504,9 @@ colorInBrewer: true
|
||||
# If a Large Barrel can be opened by clicking on any of its blocks, not just Spigot or Sign. This is always true for Small Barrels. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Chat Distortion Settings --
|
||||
|
||||
|
@ -51,6 +51,7 @@ drainItems:
|
||||
- MILK_BUCKET/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -498,6 +499,9 @@ colorInBrewer: true
|
||||
# Si le grand tonneau peut être ouvert en cliquant sur n'importe quel bloc, non seulement le robinet ou le panneau. Toujours "true" pour les petits tonneaux. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Paramètres de la distorsion du Chat --
|
||||
|
||||
|
@ -49,7 +49,8 @@ drainItems:
|
||||
- BREAD/4
|
||||
- MILK_BUCKET/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# Show particles over cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -490,6 +491,9 @@ colorInBrewer: true
|
||||
# Se un barile grande può essere aperto cliccandoci sopra, non solo sul cartello e sulla staccionata. Questo è sempre true per i barili piccoli. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Imostazioni di distorsione della chat --
|
||||
|
||||
|
@ -50,6 +50,7 @@ drainItems:
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Partikel steigen von Kesseln auf wenn sie Zutaten und eine Feuerquelle haben [true]
|
||||
# Die sich ändernde Farbe der Partikel kann beim Fermentieren mancher Rezepte helfen
|
||||
enableCauldronParticles: true
|
||||
|
||||
# Ob das craften und das benutzen des Trank-Versiegelungs-Tisches aktiviert ist (2 Flaschen über 4 Holz) [true, true]
|
||||
@ -899,6 +900,9 @@ colorInBrewer: true
|
||||
# Ob große Fässer an jedem Block geöffnet werden können, nicht nur an Zapfhahn und Schild. Bei kleinen Fässern geht dies immer. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# Ob nur ein Minimum an Kessel-Partikeln dargestellt werden sollen
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Chat Veränderungs Einstellungen --
|
||||
|
||||
|
@ -50,6 +50,7 @@ drainItems:
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -891,6 +892,9 @@ colorInBrewer: true
|
||||
# If a Large Barrel can be opened by clicking on any of its blocks, not just Spigot or Sign. This is always true for Small Barrels. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Chat Distortion Settings --
|
||||
|
||||
|
@ -50,6 +50,7 @@ drainItems:
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -891,6 +892,9 @@ colorInBrewer: true
|
||||
# If a Large Barrel can be opened by clicking on any of its blocks, not just Spigot or Sign. This is always true for Small Barrels. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Chat Distortion Settings --
|
||||
|
||||
|
@ -51,6 +51,7 @@ drainItems:
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -897,6 +898,9 @@ colorInBrewer: true
|
||||
# Si le grand tonneau peut être ouvert en cliquant sur n'importe quel bloc, non seulement le robinet ou le panneau. Toujours "true" pour les petits tonneaux. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Paramètres de la distorsion du Chat --
|
||||
|
||||
|
@ -50,6 +50,7 @@ drainItems:
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -891,6 +892,9 @@ colorInBrewer: true
|
||||
# Se un barile grande può essere aperto cliccandoci sopra, non solo sul cartello e sulla staccionata. Questo è sempre true per i barili piccoli. [true]
|
||||
openLargeBarrelEverywhere: true
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- Imostazioni di distorsione della chat --
|
||||
|
||||
|
@ -48,10 +48,11 @@ showStatusOnDrink: true
|
||||
|
||||
# 解酒物/解酒强度. 降低玩家一定程度的醉酒程度, 解救强度为百分数.(下列)
|
||||
drainItems:
|
||||
- Bread/4
|
||||
- Milk_Bucket/2
|
||||
- Bread/4
|
||||
- Milk_Bucket/2
|
||||
|
||||
# Show Particles over Cauldrons when they have ingredients and a heat source. [true]
|
||||
# The changing color of the particles can help with timing some recipes
|
||||
enableCauldronParticles: true
|
||||
|
||||
# If crafting and using of the Brew Sealing Table is enabled (2 Bottles over 4 Planks) [true, true]
|
||||
@ -895,6 +896,9 @@ colorInBrewer: true
|
||||
# 大型熟成木桶可以通过右击桶身任意一个位置来打开, 而不需要专门右击其龙头. 这一操作对小型酒桶总为真.[true]
|
||||
openLargeBarrelEverywhere: false
|
||||
|
||||
# If Cauldron Particles should be reduced to the bare minimum
|
||||
minimalParticles: false
|
||||
|
||||
|
||||
# -- 口糊设置 --
|
||||
|
||||
|
@ -6,7 +6,7 @@ authors: [Milan Albrecht, Frank Baumann, ProgrammerDan, Daniel Saukel]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
brewery:
|
||||
description: Command for Administration
|
||||
description: Mostly admin commands to create/modify Brews and drunkeness
|
||||
aliases: [brew]
|
||||
permissions:
|
||||
# -- Groups --
|
||||
@ -42,6 +42,8 @@ permissions:
|
||||
brewery.cmd.pukeOther: true
|
||||
brewery.cmd.player: true
|
||||
brewery.cmd.create: true
|
||||
brewery.cmd.drink: true
|
||||
brewery.cmd.drinkOther: true
|
||||
brewery.cmd.copy: true
|
||||
brewery.cmd.delete: true
|
||||
brewery.cmd.static: true
|
||||
@ -73,12 +75,18 @@ permissions:
|
||||
description: Set Player-values
|
||||
brewery.cmd.wakeup:
|
||||
description: Set, Check and Remove Wakeup Points
|
||||
brewery.cmd.create:
|
||||
description: Create Brews
|
||||
brewery.cmd.drink:
|
||||
description: Simulate drinking Brews
|
||||
brewery.cmd.drinkOther:
|
||||
description: Simulate other players drinking Brews
|
||||
brewery.cmd.copy:
|
||||
description: Copy Potions
|
||||
description: Copy Brews
|
||||
brewery.cmd.delete:
|
||||
description: Delete Potions
|
||||
description: Delete Brews
|
||||
brewery.cmd.static:
|
||||
description: Make Potions Static
|
||||
description: Make Brews Static
|
||||
brewery.cmd.reload:
|
||||
description: Reload config
|
||||
|
||||
|
@ -101,9 +101,9 @@ public class BCauldron {
|
||||
if (state > 0) {
|
||||
state--;
|
||||
}
|
||||
if (BConfig.enableCauldronParticles) {
|
||||
if (BConfig.enableCauldronParticles && !BConfig.minimalParticles) {
|
||||
// Few little sparks and lots of water splashes. Offset by 0.2 in x and z
|
||||
block.getWorld().spawnParticle(Particle.SPELL_INSTANT, particleLocation,3, 0.2, 0, 0.2);
|
||||
block.getWorld().spawnParticle(Particle.SPELL_INSTANT, particleLocation,2, 0.2, 0, 0.2);
|
||||
block.getWorld().spawnParticle(Particle.WATER_SPLASH, particleLocation, 10, 0.2, 0, 0.2);
|
||||
}
|
||||
}
|
||||
@ -238,6 +238,20 @@ public class BCauldron {
|
||||
|
||||
public void cookEffect() {
|
||||
if (BUtil.isChunkLoaded(block) && LegacyUtil.isCauldronHeatsource(block.getRelative(BlockFace.DOWN))) {
|
||||
Color color = getParticleColor();
|
||||
// Colorable spirally spell, 0 count enables color instead of the offset variables
|
||||
// Configurable RGB color. The last parameter seems to control the hue and motion, but i couldn't find
|
||||
// how exactly in the client code. 1025 seems to be the best for color brightness and upwards motion
|
||||
block.getWorld().spawnParticle(Particle.SPELL_MOB, getRandParticleLoc(), 0,
|
||||
((double) color.getRed()) / 255.0,
|
||||
((double) color.getGreen()) / 255.0,
|
||||
((double) color.getBlue()) / 255.0,
|
||||
1025.0);
|
||||
|
||||
if (BConfig.minimalParticles) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (particleRandom.nextFloat() > 0.85) {
|
||||
// Dark pixely smoke cloud at 0.4 random in x and z
|
||||
// 0 count enables direction, send to y = 1 with speed 0.09
|
||||
@ -247,17 +261,9 @@ public class BCauldron {
|
||||
// A Water Splash with 0.2 offset in x and z
|
||||
block.getWorld().spawnParticle(Particle.WATER_SPLASH, particleLocation, 1, 0.2, 0, 0.2);
|
||||
}
|
||||
Color color = getParticleColor();
|
||||
// Colorable spirally spell, 0 count enables color instead of the offset variables
|
||||
// Configurable RGB color. 1025 seems to be the best for color brightness and upwards motion
|
||||
block.getWorld().spawnParticle(Particle.SPELL_MOB, getRandParticleLoc(), 0,
|
||||
((double) color.getRed()) / 255.0,
|
||||
((double) color.getGreen()) / 255.0,
|
||||
((double) color.getBlue()) / 255.0,
|
||||
1025.0);
|
||||
|
||||
if (P.use1_13 && particleRandom.nextFloat() > 0.4) {
|
||||
// Two hovering pixely dust clouds, a bit offset with DustOptions to give some color and size
|
||||
// Two hovering pixely dust clouds, a bit offset and with DustOptions to give some color and size
|
||||
block.getWorld().spawnParticle(Particle.REDSTONE, particleLocation, 2, 0.15, 0.2, 0.15, new Particle.DustOptions(color, 1.5f));
|
||||
}
|
||||
}
|
||||
@ -345,12 +351,52 @@ public class BCauldron {
|
||||
return particleColor;
|
||||
}
|
||||
|
||||
public static void processNextCookEffects() {
|
||||
/*public static void processCookEffects() {
|
||||
if (!BConfig.enableCauldronParticles) return;
|
||||
int size = bcauldrons.size();
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
final int skipSize = PARTICLEPAUSE - 1 + (BConfig.minimalParticles ? 20 : 0);
|
||||
|
||||
int skip = particleRandom.nextInt(skipSize);
|
||||
if (skip >= size) {
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<BCauldron> cauldronsIter = bcauldrons.values().iterator();
|
||||
while (cauldronsIter.hasNext()) {
|
||||
BCauldron cauldron = cauldronsIter.next();
|
||||
if (skip == 0) {
|
||||
cauldron.cookEffect();
|
||||
skip = skipSize;
|
||||
} else {
|
||||
skip--;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void processCookEffects() {
|
||||
if (!BConfig.enableCauldronParticles) return;
|
||||
if (bcauldrons.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final float chance = 1f / PARTICLEPAUSE;
|
||||
|
||||
for (BCauldron cauldron : bcauldrons.values()) {
|
||||
if (particleRandom.nextFloat() < chance) {
|
||||
cauldron.cookEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void old_processNextCookEffects() {
|
||||
if (!BConfig.enableCauldronParticles) return;
|
||||
int size = bcauldrons.size();
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int useParticlePause = PARTICLEPAUSE;
|
||||
|
||||
// The Particle Delay is reduced every time, independent on how many cauldrons are processed
|
||||
// If it did not reach zero as we process all cauldrons, skip some tasks
|
||||
@ -358,17 +404,17 @@ public class BCauldron {
|
||||
if (particleCauldron >= size) {
|
||||
if (particleDelay <= 0) {
|
||||
particleCauldron = 0;
|
||||
particleDelay = PARTICLEPAUSE;
|
||||
particleDelay = useParticlePause;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Decide how many cauldrons to process this time
|
||||
int cauldronsToProcess;
|
||||
if (size < PARTICLEPAUSE) {
|
||||
if (size < useParticlePause) {
|
||||
cauldronsToProcess = 1;
|
||||
} else {
|
||||
cauldronsToProcess = (int) Math.ceil((float) size / (float) PARTICLEPAUSE);
|
||||
cauldronsToProcess = (int) Math.ceil((float) size / (float) useParticlePause);
|
||||
}
|
||||
|
||||
Iterator<BCauldron> cauldronsIter = bcauldrons.values().iterator();
|
||||
@ -383,7 +429,7 @@ public class BCauldron {
|
||||
if (particleDelay <= 0) {
|
||||
// Processing all cauldrons took as long as the delay, start over right away
|
||||
particleCauldron = 0;
|
||||
particleDelay = PARTICLEPAUSE;
|
||||
particleDelay = useParticlePause;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -516,7 +562,7 @@ public class BCauldron {
|
||||
* Recalculate the Cauldron Particle Recipe
|
||||
*/
|
||||
public static void reload() {
|
||||
for (BCauldron cauldron : BCauldron.bcauldrons.values()) {
|
||||
for (BCauldron cauldron : bcauldrons.values()) {
|
||||
cauldron.particleRecipe = null;
|
||||
cauldron.particleColor = null;
|
||||
if (BConfig.enableCauldronParticles) {
|
||||
|
@ -23,6 +23,9 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -517,10 +520,25 @@ public class P extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
private int ticks = 0;
|
||||
private double times = 0;
|
||||
|
||||
public class CauldronParticles implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
BCauldron.processNextCookEffects();
|
||||
if (BConfig.minimalParticles && BCauldron.particleRandom.nextFloat() > 0.5f) {
|
||||
return;
|
||||
}
|
||||
long t1 = System.nanoTime();
|
||||
BCauldron.processCookEffects();
|
||||
long t2 = System.nanoTime();
|
||||
times += (t2 - t1) / 1000.0;
|
||||
ticks++;
|
||||
if (ticks == BCauldron.PARTICLEPAUSE) {
|
||||
ticks = 0;
|
||||
P.p.log("Particles: ~ " + BigDecimal.valueOf(times / BCauldron.PARTICLEPAUSE).round(new MathContext(5, RoundingMode.HALF_UP)) + "µs");
|
||||
times = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ public class BConfig {
|
||||
// Cauldron
|
||||
public static boolean useOffhandForCauldron;
|
||||
public static boolean enableCauldronParticles;
|
||||
public static boolean minimalParticles;
|
||||
|
||||
//BPlayer
|
||||
public static Map<Material, Integer> drainItems = new HashMap<>();// DrainItem Material and Strength
|
||||
@ -250,6 +251,7 @@ public class BConfig {
|
||||
enableEncode = config.getBoolean("enableEncode", false);
|
||||
openEverywhere = config.getBoolean("openLargeBarrelEverywhere", false);
|
||||
enableCauldronParticles = P.use1_9 && config.getBoolean("enableCauldronParticles", false);
|
||||
minimalParticles = config.getBoolean("minimalParticles", false);
|
||||
useOffhandForCauldron = config.getBoolean("useOffhandForCauldron", false);
|
||||
loadDataAsync = config.getBoolean("loadDataAsync", true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user