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