mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 14:21:33 +00:00
f
This commit is contained in:
@@ -58,6 +58,8 @@ public interface INMSBinding {
|
|||||||
Object getCustomBiomeBaseFor(String mckey);
|
Object getCustomBiomeBaseFor(String mckey);
|
||||||
Object getCustomBiomeBaseHolderFor(String mckey);
|
Object getCustomBiomeBaseHolderFor(String mckey);
|
||||||
|
|
||||||
|
int getBiomeBaseIdForKey(String key);
|
||||||
|
|
||||||
String getKeyForBiomeBase(Object biomeBase);
|
String getKeyForBiomeBase(Object biomeBase);
|
||||||
|
|
||||||
Object getBiomeBase(World world, Biome biome);
|
Object getBiomeBase(World world, Biome biome);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package com.volmit.iris.core.nms.v19_2;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.INMSBinding;
|
import com.volmit.iris.core.nms.INMSBinding;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
@@ -196,7 +195,7 @@ public class NMSBinding19_2 implements INMSBinding {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTrueBiomeBaseId(Object biomeBase) {
|
public int getTrueBiomeBaseId(Object biomeBase) {
|
||||||
return getCustomBiomeRegistry().getId((net.minecraft.world.level.biome.Biome) biomeBase);
|
return getCustomBiomeRegistry().getId(((Holder<net.minecraft.world.level.biome.Biome>) biomeBase).value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -218,6 +217,10 @@ public class NMSBinding19_2 implements INMSBinding {
|
|||||||
return getCustomBiomeRegistry().getHolder(getTrueBiomeBaseId(getCustomBiomeRegistry().get(new ResourceLocation(mckey)))).get();
|
return getCustomBiomeRegistry().getHolder(getTrueBiomeBaseId(getCustomBiomeRegistry().get(new ResourceLocation(mckey)))).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBiomeBaseIdForKey(String key) {
|
||||||
|
return getCustomBiomeRegistry().getId(getCustomBiomeRegistry().get(new ResourceLocation(key)));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeyForBiomeBase(Object biomeBase) {
|
public String getKeyForBiomeBase(Object biomeBase) {
|
||||||
return getCustomBiomeRegistry().getKey((net.minecraft.world.level.biome.Biome) biomeBase).getPath(); // something, not something:something
|
return getCustomBiomeRegistry().getKey((net.minecraft.world.level.biome.Biome) biomeBase).getPath(); // something, not something:something
|
||||||
@@ -404,19 +407,23 @@ public class NMSBinding19_2 implements INMSBinding {
|
|||||||
@Override
|
@Override
|
||||||
public void injectBiomesFromMantle(Chunk e, Mantle mantle) {
|
public void injectBiomesFromMantle(Chunk e, Mantle mantle) {
|
||||||
LevelChunk chunk = ((CraftChunk)e).getHandle();
|
LevelChunk chunk = ((CraftChunk)e).getHandle();
|
||||||
|
AtomicInteger c = new AtomicInteger();
|
||||||
|
AtomicInteger r = new AtomicInteger();
|
||||||
mantle.iterateChunk(e.getX(), e.getZ(), MatterBiomeInject.class, (x,y,z,b) -> {
|
mantle.iterateChunk(e.getX(), e.getZ(), MatterBiomeInject.class, (x,y,z,b) -> {
|
||||||
if(b != null) {
|
if(b != null) {
|
||||||
if(b.isCustom()) {
|
if(b.isCustom()) {
|
||||||
chunk.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) getBiomeBaseFromId(b.getBiomeId()));
|
chunk.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) getBiomeBaseFromId(b.getBiomeId()));
|
||||||
|
c.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
chunk.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) getBiomeBase(e.getWorld(), b.getBiome()));
|
chunk.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) getBiomeBase(e.getWorld(), b.getBiome()));
|
||||||
|
r.getAndIncrement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chunk.setUnsaved(true);
|
Iris.info("Injected " + c.get() + " custom biomes and " + r.get() + " vanilla biomes into chunk " + e.getX() + "," + e.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getFor(Class<?> type, Object source) {
|
private static Object getFor(Class<?> type, Object source) {
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ public class NMSBinding1X implements INMSBinding {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBiomeBaseIdForKey(String key) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeyForBiomeBase(Object biomeBase) {
|
public String getKeyForBiomeBase(Object biomeBase) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -479,12 +479,8 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
fixEnergy();
|
fixEnergy();
|
||||||
getEngine().cleanupMantleChunk(e.getX(), e.getZ());
|
getEngine().cleanupMantleChunk(e.getX(), e.getZ());
|
||||||
|
|
||||||
if(generated && !injectBiomes.isEmpty()) {
|
if(generated) {
|
||||||
Position2 p = new Position2(e.getX(), e.getZ());
|
INMS.get().injectBiomesFromMantle(e, getMantle());
|
||||||
|
|
||||||
if(injectBiomes.remove(p)) {
|
|
||||||
INMS.get().injectBiomesFromMantle(e, getMantle());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,30 +52,42 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
@Override
|
@Override
|
||||||
public void onActuate(int x, int z, Hunk<Biome> h, boolean multicore, ChunkContext context) {
|
public void onActuate(int x, int z, Hunk<Biome> h, boolean multicore, ChunkContext context) {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
try
|
||||||
|
{
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
|
||||||
for(int xf = 0; xf < h.getWidth(); xf++) {
|
int m = 0;
|
||||||
IrisBiome ib;
|
for(int xf = 0; xf < h.getWidth(); xf++) {
|
||||||
for(int zf = 0; zf < h.getDepth(); zf++) {
|
IrisBiome ib;
|
||||||
ib = context.getBiome().get(xf, zf);
|
for(int zf = 0; zf < h.getDepth(); zf++) {
|
||||||
int maxHeight = (int) (getComplex().getFluidHeight() + ib.getMaxWithObjectHeight(getData()));
|
ib = context.getBiome().get(xf, zf);
|
||||||
MatterBiomeInject matter = null;
|
int maxHeight = (int) (getComplex().getFluidHeight() + ib.getMaxWithObjectHeight(getData()));
|
||||||
|
MatterBiomeInject matter = null;
|
||||||
|
|
||||||
if(ib.isCustom()) {
|
if(ib.isCustom()) {
|
||||||
IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z);
|
IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z);
|
||||||
Object biomeBase = INMS.get().getCustomBiomeBaseHolderFor(getDimension().getLoadKey() + ":" + custom.getId());
|
matter = BiomeInjectMatter.get(INMS.get().getBiomeBaseIdForKey(getDimension().getLoadKey() + ":" + custom.getId()));
|
||||||
matter = BiomeInjectMatter.get(INMS.get().getTrueBiomeBaseId(biomeBase));
|
} else {
|
||||||
} else {
|
Biome v = ib.getSkyBiome(rng, x, 0, z);
|
||||||
Biome v = ib.getSkyBiome(rng, x, 0, z);
|
matter = BiomeInjectMatter.get(v);
|
||||||
matter = BiomeInjectMatter.get(v);
|
}
|
||||||
}
|
|
||||||
|
for(int i = 0; i < maxHeight; i++) {
|
||||||
|
getEngine().getMantle().getMantle().set(x, i, z, matter);
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < maxHeight; i++) {
|
|
||||||
getEngine().getMantle().getMantle().set(x, i, z, matter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEngine().getMetrics().getBiome().put(p.getMilliseconds());
|
||||||
|
Iris.info("Biome Actuator: " + p.getMilliseconds() + "ms");
|
||||||
|
Iris.info("Mantle: " + m + " blocks");
|
||||||
}
|
}
|
||||||
|
|
||||||
getEngine().getMetrics().getBiome().put(p.getMilliseconds());
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user