mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 16:36:00 +00:00
fix missing ArrayType and add tabcompletion to vanilla loot tables
This commit is contained in:
parent
db14861b40
commit
f6a354b890
@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.engine.object.annotations.functions.StructureKeyFunction;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
|
@ -129,6 +129,7 @@ public class IrisObjectPlacement {
|
||||
@ArrayType(min = 1, type = IrisObjectLoot.class)
|
||||
@Desc("The loot tables to apply to these objects")
|
||||
private KList<IrisObjectLoot> loot = new KList<>();
|
||||
@ArrayType(min = 1, type = IrisObjectVanillaLoot.class)
|
||||
@Desc("The vanilla loot tables to apply to these objects")
|
||||
private KList<IrisObjectVanillaLoot> vanillaLoot = new KList<>();
|
||||
@Desc("Whether the given loot tables override any and all other loot tables available in the dimension, region or biome.")
|
||||
|
@ -3,6 +3,7 @@ package com.volmit.iris.engine.object;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.engine.object.annotations.functions.LootTableKeyFunction;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -23,6 +24,7 @@ public class IrisObjectVanillaLoot {
|
||||
private KList<IrisBlockData> filter = new KList<>();
|
||||
@Desc("Exactly match the block data or not")
|
||||
private boolean exact = false;
|
||||
@RegistryListFunction(LootTableKeyFunction.class)
|
||||
@Desc("The vanilla loot table key")
|
||||
@Required
|
||||
private String name;
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.volmit.iris.engine.object.annotations.functions;
|
||||
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.framework.ListFunction;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.loot.LootTables;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LootTableKeyFunction implements ListFunction<IrisData, KList<String>> {
|
||||
@Override
|
||||
public String key() {
|
||||
return "loot-table-key";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fancyName() {
|
||||
return "LootTable Key";
|
||||
}
|
||||
|
||||
@Override
|
||||
public KList<String> apply(IrisData data) {
|
||||
return Arrays.stream(LootTables.values())
|
||||
.map(LootTables::getKey)
|
||||
.map(NamespacedKey::toString)
|
||||
.collect(Collectors.toCollection(KList::new));
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.engine.object.annotations;
|
||||
package com.volmit.iris.engine.object.annotations.functions;
|
||||
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
Loading…
x
Reference in New Issue
Block a user