fixes to set_biome to accomodate 3d biomes

This commit is contained in:
gnembon committed 2019-09-05 14:29:55 -03:00
1 parent faa8d54484
commit 8747f18836
4 files changed
+10 -11

No files matched your search

@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.fakes.class_4548Interface;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4548;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -25,11 +25,10 @@ public class class_4548_getBiomeArrayMixin implements class_4548Interface
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
ChunkPos chunkPos = new ChunkPos(pos);
int seaLevel = world.getSeaLevel();
int int_4 = chunkPos.x & field_20650;
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & field_20650;
int int_5 = MathHelper.clamp(seaLevel, 0, field_20651);
int int_6 = chunkPos.z & field_20650;
int int_6 = (pos.getZ() >> 2) & field_20650;
field_20654[int_5 << field_20652 + field_20652 | int_6 << field_20652 | int_4] = what;
}
}
@@ -2,6 +2,7 @@ package carpet.script;
import carpet.CarpetServer;
import carpet.fakes.MinecraftServerInterface;
import carpet.fakes.class_4548Interface;
import carpet.helpers.FeatureGenerator;
import carpet.script.Fluff.TriFunction;
import carpet.script.exception.CarpetExpressionException;
@@ -997,8 +998,8 @@ public class CarpetExpression
return (_c, _t) -> res;
});
this.expr.addLazyFunction("set_biome", -1, (c, t, lv) -> {
throw new InternalExpressionException("set_biome is WIP on 19w36a");/*
this.expr.addLazyFunction("set_biome", -1, (c, t, lv) ->
{
CarpetContext cc = (CarpetContext)c;
BlockValue.LocatorResult locator = BlockValue.fromParams(cc, lv, 0);
if (lv.size() == locator.offset)
@@ -1010,10 +1011,9 @@ public class CarpetExpression
ServerWorld world = cc.s.getWorld();
BlockPos pos = locator.block.getPos();
Chunk chunk = world.method_22350(pos);
// todo these indices are wrong in 1.15 - needs fixing.
((class_4548Interface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
this.forceChunkUpdate(pos, world);
return LazyValue.NULL; */
return LazyValue.NULL;
});
// need get_biome
@@ -27,7 +27,7 @@ import static carpet.settings.RuleCategory.SURVIVAL;
public class CarpetSettings
{
public static final String carpetVersion = "1.0.6+v190905";
public static final String carpetVersion = "1.0.6+v190905-2";
public static final Logger LOG = LogManager.getLogger();
public static boolean skipGenerationChecks = false;
public static boolean impendingFillSkipUpdates = false;