Rework according to discussed changes

This commit is contained in:
CocoTheOwner
2021-07-19 12:07:29 +02:00
parent 5b662df7cd
commit 1534dcc932
9 changed files with 80 additions and 190 deletions

View File

@@ -81,12 +81,8 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@ArrayType(min = 1, type = IrisEntityInitialSpawn.class)
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@Desc("Sapling override settings")
@ArrayType(min = 1, type = IrisTree.class)
private KList<IrisTree> saplings = new KList<>();
@ArrayType(min = 1, type = IrisEffect.class)
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play around the player even if where the effect was played is no longer in the biome the player is in.")
private KList<IrisEffect> effects = new KList<>();

View File

@@ -151,6 +151,9 @@ public class IrisObjectPlacement {
@Desc("The loot tables to apply to these objects")
private KList<IrisObjectLoot> loot = new KList<>();
@Desc("Tree growth overrides for these object placements")
private IrisTreeOptions treeOptions = new IrisTreeOptions();
public IrisObjectPlacement toPlacement(String... place) {
IrisObjectPlacement p = new IrisObjectPlacement();
p.setPlace(new KList<>(place));

View File

@@ -79,10 +79,6 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@ArrayType(min = 1, type = IrisEntityInitialSpawn.class)
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@Desc("Sapling override settings")
@ArrayType(min = 1, type = IrisTree.class)
private KList<IrisTree> saplings = new KList<>();
@MinNumber(1)
@MaxNumber(128)
@Desc("The rarity of the region")

View File

@@ -12,23 +12,17 @@ import org.bukkit.TreeType;
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Desc("Tree replace options")
@Desc("Tree replace options for this object placer")
@Data
public class IrisTree {
@Required
@Desc("The types of trees overwritten")
@Desc("The types of trees overwritten by this object")
@ArrayType(min = 1, type = IrisTreeType.class)
private KList<IrisTreeType> treeTypes;
@RegistryListObject
@Required
@ArrayType(min = 1, type = String.class)
@Desc("List of objects to replace trees with")
private KList<String> objects = new KList<>();
@Desc("The size of the square of saplings this applies to (2 means a 2 * 2 sapling area)")
@MinNumber(1)
@MaxNumber(TreeManager.maxSaplingPlane)
private int size = 1;
@ArrayType(min = 1, type = IrisTreeSize.class)
private KList<IrisTreeSize> sizes = new KList<>();
}

View File

@@ -0,0 +1,22 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Desc("Tree replace options for this object placer")
@Data
public class IrisTreeOptions {
@Desc("Toggles this object placer's tree overrides")
private boolean enabled = false;
@Desc("Tree overrides affected by these object placements")
private KList<IrisTree> trees = new KList<>();
}

View File

@@ -1,8 +1,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -22,8 +20,4 @@ public class IrisTreeSettings {
@Desc("Object picking modes")
IrisTreeModes mode = IrisTreeModes.FIRST;
@Desc("Tree override list")
@ArrayType(min = 1, type = IrisTree.class)
private KList<IrisTree> saplings = new KList<>();
}

View File

@@ -0,0 +1,35 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.Desc;
@Desc("Sapling override object picking options")
public enum IrisTreeSize {
@Desc("Only one sapling")
ONE,
@Desc("Two by two area")
TWO,
@Desc("Three by three area with center")
THREE_CENTER,
@Desc("Three by three any location")
THREE_ANY,
@Desc("Four by four")
FOUR,
@Desc("Five by five center")
FIVE_CENTER,
@Desc("Five by five")
FIVE_ANY;
public static boolean isAnySize(IrisTreeSize treeSize){
return switch (treeSize) {
case THREE_CENTER, FIVE_CENTER -> false;
default -> true;
};
}
}

View File

@@ -47,22 +47,20 @@ public enum IrisTreeType {
NONE;
public static IrisTreeType fromTreeType(TreeType type){
IrisTreeType irisType;
switch(type){
case BIG_TREE, TREE -> irisType = IrisTreeType.OAK;
case MEGA_REDWOOD, REDWOOD, SWAMP, TALL_REDWOOD -> irisType = IrisTreeType.SPRUCE;
case BIRCH, TALL_BIRCH -> irisType = IrisTreeType.BIRCH;
case JUNGLE, SMALL_JUNGLE -> irisType = IrisTreeType.JUNGLE;
case RED_MUSHROOM -> irisType = IrisTreeType.RED_MUSHROOM;
case BROWN_MUSHROOM -> irisType = IrisTreeType.BROWN_MUSHROOM;
case ACACIA -> irisType = IrisTreeType.ACACIA;
case DARK_OAK -> irisType = IrisTreeType.DARK_OAK;
case CRIMSON_FUNGUS -> irisType = IrisTreeType.CRIMSON_FUNGUS;
case WARPED_FUNGUS -> irisType = IrisTreeType.WARPED_FUNGUS;
case AZALEA -> irisType = IrisTreeType.AZALEA;
//case COCOA_TREE, CHORUS_PLANT, JUNGLE_BUSH -> irisType = IrisSaplingType.NONE;
default -> irisType = IrisTreeType.NONE;
}
return irisType;
return switch(type){
case BIG_TREE, TREE -> IrisTreeType.OAK;
case MEGA_REDWOOD, REDWOOD, SWAMP, TALL_REDWOOD -> IrisTreeType.SPRUCE;
case BIRCH, TALL_BIRCH -> IrisTreeType.BIRCH;
case JUNGLE, SMALL_JUNGLE -> IrisTreeType.JUNGLE;
case RED_MUSHROOM -> IrisTreeType.RED_MUSHROOM;
case BROWN_MUSHROOM -> IrisTreeType.BROWN_MUSHROOM;
case ACACIA -> IrisTreeType.ACACIA;
case DARK_OAK -> IrisTreeType.DARK_OAK;
case CRIMSON_FUNGUS -> IrisTreeType.CRIMSON_FUNGUS;
case WARPED_FUNGUS -> IrisTreeType.WARPED_FUNGUS;
case AZALEA -> IrisTreeType.AZALEA;
//case COCOA_TREE, CHORUS_PLANT, JUNGLE_BUSH -> IrisSaplingType.NONE;
default -> IrisTreeType.NONE;
};
}
}