mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-03 06:16:19 +00:00
example
This commit is contained in:
@@ -197,12 +197,11 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
|
||||
public KList<IrisBiomeCustom> getCustomDerivitives() {
|
||||
if (customDerivitives == null || customDerivitives.isEmpty()) {
|
||||
String biomeID = getLoadKey().replaceAll("\\s", "").replaceAll("[^a-z0-9/._-]", "");
|
||||
setCustomDerivitives(new KList<>(new IrisBiomeCustom().setId(biomeID)));
|
||||
String dimID = getLoader().getEngine().getDimension().getLoadKey();
|
||||
String x = getLoader().getEngine().getDimension().getLoadKey() + ":" + biomeID;
|
||||
INMS.get().registerReplacement(dimID, x, this.getDerivative());
|
||||
}
|
||||
var key = getLoadKey();
|
||||
if (key == null) key = getVanillaDerivative().getKey().getKey();
|
||||
String biomeID = key.replaceAll("\\s", "").replaceAll("[^a-z0-9/._-]", "");
|
||||
setCustomDerivitives(new KList<>(new IrisBiomeReplacement().setId(biomeID)));
|
||||
}
|
||||
return customDerivitives;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class IrisBiomeReplacement extends IrisBiomeCustom {
|
||||
private Biome biome;
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import com.volmit.iris.core.nms.IHeadless;
|
||||
import com.volmit.iris.core.nms.container.IPackRepository;
|
||||
import com.volmit.iris.core.nms.v1_20_R3.mca.ChunkSerializer;
|
||||
import com.volmit.iris.engine.object.IrisBiomeCustom;
|
||||
import com.volmit.iris.engine.object.IrisBiomeReplacement;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
@@ -670,6 +671,8 @@ public class NMSBinding implements INMSBinding {
|
||||
|
||||
@Override
|
||||
public boolean registerBiome(String dimensionId, IrisBiomeCustom biome, boolean replace) {
|
||||
if (biome instanceof IrisBiomeReplacement replacement)
|
||||
return registerReplacement(dimensionId, replacement.getId(), replacement.getBiome());
|
||||
var biomeBase = decode(net.minecraft.world.level.biome.Biome.CODEC, biome.generateJson()).map(Holder::value).orElse(null);
|
||||
if (biomeBase == null) return false;
|
||||
return register(Registries.BIOME, new ResourceLocation(dimensionId, biome.getId()), biomeBase, replace);
|
||||
|
||||
Reference in New Issue
Block a user