mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Base biome fixes
This commit is contained in:
parent
58845ae79f
commit
ac04ef34d7
@ -147,7 +147,7 @@ public class IrisComplex implements DataProvider
|
|||||||
IrisBiome b = baseBiomeStream.get(x, z);
|
IrisBiome b = baseBiomeStream.get(x, z);
|
||||||
return getHeight(b, x, z, engine.getWorld().getSeed());
|
return getHeight(b, x, z, engine.getWorld().getSeed());
|
||||||
}, Interpolated.DOUBLE).cache2D(cacheSize);
|
}, Interpolated.DOUBLE).cache2D(cacheSize);
|
||||||
slopeStream = heightStream.slope(4).interpolate().bilinear(4, 4).cache2D(cacheSize);
|
slopeStream = heightStream.slope(3).interpolate().bilinear(3, 3).cache2D(cacheSize);
|
||||||
trueBiomeStream = heightStream
|
trueBiomeStream = heightStream
|
||||||
.convertAware2D((h, x, z) ->
|
.convertAware2D((h, x, z) ->
|
||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
|
@ -23,8 +23,10 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockData bd;
|
BlockData bd, bdx;
|
||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
||||||
|
bdx = data.get(x, height, z);
|
||||||
|
boolean underwater = height < getDimension().getFluidHeight();
|
||||||
|
|
||||||
if(decorator != null)
|
if(decorator != null)
|
||||||
{
|
{
|
||||||
@ -32,10 +34,13 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
|||||||
{
|
{
|
||||||
bd = decorator.getBlockData100(biome, getRng(), realX, realZ, getData());
|
bd = decorator.getBlockData100(biome, getRng(), realX, realZ, getData());
|
||||||
|
|
||||||
if(!canGoOn(bd, data.get(x, height, z)))
|
if(!underwater)
|
||||||
|
{
|
||||||
|
if(!canGoOn(bd, bdx))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(bd instanceof Bisected)
|
if(bd instanceof Bisected)
|
||||||
{
|
{
|
||||||
@ -50,6 +55,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bd = bd.clone();
|
||||||
((Bisected)bd).setHalf(Bisected.Half.BOTTOM);
|
((Bisected)bd).setHalf(Bisected.Half.BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +85,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == 0 && !canGoOn(bd, data.get(x, height, z)))
|
if(i == 0 && !underwater && !canGoOn(bd, bdx))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ public interface INMSBinding
|
|||||||
public INMSCreator getCreator();
|
public INMSCreator getCreator();
|
||||||
|
|
||||||
public Object getBiomeBase(World world, Biome biome);
|
public Object getBiomeBase(World world, Biome biome);
|
||||||
|
public Object getBiomeBase(Object registry, Biome biome);
|
||||||
|
|
||||||
default World createWorld(WorldCreator creator)
|
default World createWorld(WorldCreator creator)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,9 @@ package com.volmit.iris.nms.v16_2;
|
|||||||
import com.volmit.iris.nms.INMSBinding;
|
import com.volmit.iris.nms.INMSBinding;
|
||||||
import com.volmit.iris.nms.INMSCreator;
|
import com.volmit.iris.nms.INMSCreator;
|
||||||
import com.volmit.iris.scaffold.cache.AtomicCache;
|
import com.volmit.iris.scaffold.cache.AtomicCache;
|
||||||
|
import com.volmit.iris.util.KMap;
|
||||||
|
import net.minecraft.server.v1_16_R2.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R2.IRegistry;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
||||||
@ -10,6 +13,7 @@ import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlock;
|
|||||||
|
|
||||||
public class NMSBinding16_2 implements INMSBinding
|
public class NMSBinding16_2 implements INMSBinding
|
||||||
{
|
{
|
||||||
|
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||||
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,6 +25,19 @@ public class NMSBinding16_2 implements INMSBinding
|
|||||||
@Override
|
@Override
|
||||||
public Object getBiomeBase(World world, Biome biome)
|
public Object getBiomeBase(World world, Biome biome)
|
||||||
{
|
{
|
||||||
return CraftBlock.biomeToBiomeBase(((CraftWorld)world).getHandle().r().b(net.minecraft.server.v1_16_R2.IRegistry.ay), biome);
|
return getBiomeBase(((CraftWorld)world).getHandle().r().b(net.minecraft.server.v1_16_R2.IRegistry.ay), biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getBiomeBase(Object registry, Biome biome) {
|
||||||
|
Object v = baseBiomeCache.get(biome);
|
||||||
|
|
||||||
|
if(v != null)
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
v = CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, biome);
|
||||||
|
baseBiomeCache.put(biome, v);
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,16 @@ package com.volmit.iris.nms.v16_3;
|
|||||||
import com.volmit.iris.nms.INMSBinding;
|
import com.volmit.iris.nms.INMSBinding;
|
||||||
import com.volmit.iris.nms.INMSCreator;
|
import com.volmit.iris.nms.INMSCreator;
|
||||||
import com.volmit.iris.scaffold.cache.AtomicCache;
|
import com.volmit.iris.scaffold.cache.AtomicCache;
|
||||||
|
import com.volmit.iris.util.KMap;
|
||||||
|
import net.minecraft.server.v1_16_R3.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R3.IRegistry;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
|
|
||||||
|
|
||||||
public class NMSBinding16_3 implements INMSBinding
|
public class NMSBinding16_3 implements INMSBinding
|
||||||
{
|
{
|
||||||
|
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||||
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,6 +24,19 @@ public class NMSBinding16_3 implements INMSBinding
|
|||||||
@Override
|
@Override
|
||||||
public Object getBiomeBase(World world, Biome biome)
|
public Object getBiomeBase(World world, Biome biome)
|
||||||
{
|
{
|
||||||
return CraftBlock.biomeToBiomeBase(((CraftWorld)world).getHandle().r().b(net.minecraft.server.v1_16_R3.IRegistry.ay), biome);
|
return getBiomeBase(((CraftWorld)world).getHandle().r().b(net.minecraft.server.v1_16_R3.IRegistry.ay), biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getBiomeBase(Object registry, Biome biome) {
|
||||||
|
Object v = baseBiomeCache.get(biome);
|
||||||
|
|
||||||
|
if(v != null)
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
v = org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) registry, biome);
|
||||||
|
baseBiomeCache.put(biome, v);
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,9 @@ public class NMSBinding1X implements INMSBinding
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getBiomeBase(Object registry, Biome biome) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,12 +69,10 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
public void hotload()
|
public void hotload()
|
||||||
{
|
{
|
||||||
if(hotloadcd.flip())
|
if(isStudio())
|
||||||
{
|
{
|
||||||
Iris.proj.updateWorkspace();
|
Iris.proj.updateWorkspace();
|
||||||
getData().dump();
|
getData().dump();
|
||||||
initialized.lazySet(false);
|
|
||||||
hotloader.checkIgnore();
|
|
||||||
J.s(() -> {
|
J.s(() -> {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -90,6 +88,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
initialized.lazySet(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +313,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
compound.generate(x * 16, z * 16, blocks, post, biomes);
|
compound.generate(x * 16, z * 16, blocks, post, biomes);
|
||||||
generated++;
|
generated++;
|
||||||
|
|
||||||
return () -> blocks.insertSoftly(0,0,0,post, (b) -> b == null || B.isAir(b));
|
return () -> blocks.insertSoftly(0,0,0,post, (b) -> b == null || B.isAirOrFluid(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,6 +15,11 @@ public interface EngineDecorator extends EngineComponent {
|
|||||||
|
|
||||||
default boolean canGoOn(BlockData decorant, BlockData atop)
|
default boolean canGoOn(BlockData decorant, BlockData atop)
|
||||||
{
|
{
|
||||||
|
if(atop == null || B.isAir(atop))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return B.canPlaceOnto(decorant.getMaterial(), atop.getMaterial());
|
return B.canPlaceOnto(decorant.getMaterial(), atop.getMaterial());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,11 @@ public class B
|
|||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFoliage(Material d)
|
||||||
|
{
|
||||||
|
return isFoliage(d.createBlockData());
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFoliage(BlockData d)
|
public static boolean isFoliage(BlockData d)
|
||||||
{
|
{
|
||||||
Boolean f = foliageCache.get(d.getMaterial());
|
Boolean f = foliageCache.get(d.getMaterial());
|
||||||
@ -370,9 +375,9 @@ public class B
|
|||||||
{
|
{
|
||||||
String key = mat.name() + "" + onto.name();
|
String key = mat.name() + "" + onto.name();
|
||||||
|
|
||||||
if(isFoliage(B.get(mat.name())))
|
if(isFoliage(mat))
|
||||||
{
|
{
|
||||||
if(!isFoliagePlantable(B.get(onto.name())))
|
if(!isFoliagePlantable(onto))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -503,6 +508,14 @@ public class B
|
|||||||
|| d.getMaterial().equals(Material.PODZOL);
|
|| d.getMaterial().equals(Material.PODZOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFoliagePlantable(Material d)
|
||||||
|
{
|
||||||
|
return d.equals(Material.GRASS_BLOCK)
|
||||||
|
|| d.equals(Material.DIRT)
|
||||||
|
|| d.equals(Material.COARSE_DIRT)
|
||||||
|
|| d.equals(Material.PODZOL);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFluid(BlockData d)
|
public static boolean isFluid(BlockData d)
|
||||||
{
|
{
|
||||||
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.LAVA);
|
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.LAVA);
|
||||||
|
@ -23,11 +23,49 @@ public class ReactiveFolder
|
|||||||
|
|
||||||
public void check()
|
public void check()
|
||||||
{
|
{
|
||||||
|
boolean modified = false;
|
||||||
|
|
||||||
if(fw.checkModified())
|
if(fw.checkModified())
|
||||||
{
|
{
|
||||||
fw.checkModified();
|
for(File i : fw.getCreated())
|
||||||
|
{
|
||||||
|
if(i.getName().endsWith(".iob") || i.getName().endsWith(".json"))
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!modified)
|
||||||
|
{
|
||||||
|
for(File i : fw.getChanged())
|
||||||
|
{
|
||||||
|
if(i.getName().endsWith(".iob") || i.getName().endsWith(".json"))
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!modified)
|
||||||
|
{
|
||||||
|
for(File i : fw.getDeleted())
|
||||||
|
{
|
||||||
|
if(i.getName().endsWith(".iob") || i.getName().endsWith(".json"))
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(modified)
|
||||||
|
{
|
||||||
hotload.accept(fw.getCreated(), fw.getChanged(), fw.getDeleted());
|
hotload.accept(fw.getCreated(), fw.getChanged(), fw.getDeleted());
|
||||||
|
}
|
||||||
|
|
||||||
fw.checkModified();
|
fw.checkModified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user