mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
iris:decorant ported onto IrisApi and listed in the built-ins jar; decorate becomes a dimension setting
This commit is contained in:
1 parent
b59538ca6f
commit
3ac31c573b
25 files changed
+778
-653
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package art.arcane.iris.builtin.decorant;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether a dimension decorates at all, written as {@code "decorate": false}. A dimension without the key decorates. */
|
||||
@Desc("Generate decorations or not")
|
||||
@Feature(id = "iris:decorant/decorate", name = "Decorate", key = "decorate", root = "decorate", targets = Target.DIMENSION)
|
||||
public final class DecorateSettings implements IrisFeature {
|
||||
@Desc("Generate decorations or not")
|
||||
private boolean decorate = true;
|
||||
|
||||
public DecorateSettings() {
|
||||
}
|
||||
|
||||
public boolean decorate() {
|
||||
return decorate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package art.arcane.iris.builtin.decorant;
|
||||
|
||||
/** How loaded with decorating a biome is, which studio's decorator load view colours it by. */
|
||||
public final class DecoratorLoad {
|
||||
private static final int COLUMNS_PER_CHUNK = 256;
|
||||
|
||||
private DecoratorLoad() {
|
||||
}
|
||||
|
||||
/** The sum of the decorators' chances times their stack heights, at least one block each; 0 for a biome without decorators. */
|
||||
public static double of(DecorantSettings settings) {
|
||||
if (settings == null) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
double load = 0D;
|
||||
for (Decorator decorator : settings.decorators()) {
|
||||
load += Math.max(decorator.stackMax(), 1) * decorator.chance();
|
||||
}
|
||||
return load;
|
||||
}
|
||||
|
||||
/** The sum of the decorators' chances over a chunk's columns, which is how strongly the view colours the biome. */
|
||||
public static double colour(DecorantSettings settings) {
|
||||
if (settings == null) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
double load = 0D;
|
||||
for (Decorator decorator : settings.decorators()) {
|
||||
load += decorator.chance() * Math.min(1, decorator.stackMax()) * COLUMNS_PER_CHUNK;
|
||||
}
|
||||
return load;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user