mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +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);
|
||||
return getHeight(b, x, z, engine.getWorld().getSeed());
|
||||
}, 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
|
||||
.convertAware2D((h, x, z) ->
|
||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||
|
@ -23,8 +23,10 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
||||
return;
|
||||
}
|
||||
|
||||
BlockData bd;
|
||||
BlockData bd, bdx;
|
||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
||||
bdx = data.get(x, height, z);
|
||||
boolean underwater = height < getDimension().getFluidHeight();
|
||||
|
||||
if(decorator != null)
|
||||
{
|
||||
@ -32,9 +34,12 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
||||
{
|
||||
bd = decorator.getBlockData100(biome, getRng(), realX, realZ, getData());
|
||||
|
||||
if(!canGoOn(bd, data.get(x, height, z)))
|
||||
if(!underwater)
|
||||
{
|
||||
return;
|
||||
if(!canGoOn(bd, bdx))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(bd instanceof Bisected)
|
||||
@ -50,6 +55,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
||||
{
|
||||
|
||||
}
|
||||
bd = bd.clone();
|
||||
((Bisected)bd).setHalf(Bisected.Half.BOTTOM);
|
||||
}
|
||||
|
||||
@ -79,7 +85,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator
|
||||
return;
|
||||
}
|
||||
|
||||
if(i == 0 && !canGoOn(bd, data.get(x, height, z)))
|
||||
if(i == 0 && !underwater && !canGoOn(bd, bdx))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ public interface INMSBinding
|
||||
public INMSCreator getCreator();
|
||||
|
||||
public Object getBiomeBase(World world, Biome biome);
|
||||
public Object getBiomeBase(Object registry, Biome biome);
|
||||
|
||||
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.INMSCreator;
|
||||
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.block.Biome;
|
||||
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
|
||||
{
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
||||
|
||||
@Override
|
||||
@ -21,6 +25,19 @@ public class NMSBinding16_2 implements INMSBinding
|
||||
@Override
|
||||
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.INMSCreator;
|
||||
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.block.Biome;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
|
||||
|
||||
public class NMSBinding16_3 implements INMSBinding
|
||||
{
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
private final AtomicCache<INMSCreator> creator = new AtomicCache<>();
|
||||
|
||||
@Override
|
||||
@ -21,6 +24,19 @@ public class NMSBinding16_3 implements INMSBinding
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBiomeBase(Object registry, Biome biome) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -69,12 +69,10 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
||||
|
||||
public void hotload()
|
||||
{
|
||||
if(hotloadcd.flip())
|
||||
if(isStudio())
|
||||
{
|
||||
Iris.proj.updateWorkspace();
|
||||
getData().dump();
|
||||
initialized.lazySet(false);
|
||||
hotloader.checkIgnore();
|
||||
J.s(() -> {
|
||||
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);
|
||||
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
|
||||
|
@ -15,6 +15,11 @@ public interface EngineDecorator extends EngineComponent {
|
||||
|
||||
default boolean canGoOn(BlockData decorant, BlockData atop)
|
||||
{
|
||||
if(atop == null || B.isAir(atop))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return B.canPlaceOnto(decorant.getMaterial(), atop.getMaterial());
|
||||
}
|
||||
}
|
||||
|
@ -318,6 +318,11 @@ public class B
|
||||
return u;
|
||||
}
|
||||
|
||||
public static boolean isFoliage(Material d)
|
||||
{
|
||||
return isFoliage(d.createBlockData());
|
||||
}
|
||||
|
||||
public static boolean isFoliage(BlockData d)
|
||||
{
|
||||
Boolean f = foliageCache.get(d.getMaterial());
|
||||
@ -370,9 +375,9 @@ public class B
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -503,6 +508,14 @@ public class B
|
||||
|| 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)
|
||||
{
|
||||
return d.getMaterial().equals(Material.WATER) || d.getMaterial().equals(Material.LAVA);
|
||||
|
@ -23,11 +23,49 @@ public class ReactiveFolder
|
||||
|
||||
public void check()
|
||||
{
|
||||
boolean modified = false;
|
||||
|
||||
if(fw.checkModified())
|
||||
{
|
||||
fw.checkModified();
|
||||
hotload.accept(fw.getCreated(), fw.getChanged(), fw.getDeleted());
|
||||
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());
|
||||
}
|
||||
|
||||
fw.checkModified();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user