Merge branch 'master' into 1.16
# Conflicts: # src/main/java/carpet/script/CarpetExpression.java
This commit is contained in:
commit
f50fa8cde2
3 files changed
+35
-10
No files matched your search
@@ -109,6 +109,7 @@ import net.minecraft.stat.Stat;
|
||||
import net.minecraft.stat.StatType;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.structure.StructureFeatures;
|
||||
import net.minecraft.structure.StructurePiece;
|
||||
import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.text.LiteralText;
|
||||
@@ -128,6 +129,7 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.SpawnHelper;
|
||||
@@ -359,6 +361,18 @@ public class CarpetExpression
|
||||
return MapValue.wrap(ret);
|
||||
}
|
||||
|
||||
private static long lastSeed = -1;
|
||||
private void BooYah(ChunkGenerator generator)
|
||||
{
|
||||
synchronized (generator)
|
||||
{
|
||||
if (generator.getSeed() != lastSeed)
|
||||
{
|
||||
StructureFeatures.STRONGHOLD.shouldStartAt(null, generator, null, 0, 0, null);
|
||||
lastSeed = generator.getSeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void API_BlockManipulation()
|
||||
{
|
||||
this.expr.addLazyFunction("block", -1, (c, t, lv) ->
|
||||
@@ -1144,6 +1158,9 @@ public class CarpetExpression
|
||||
BlockArgument locator = BlockArgument.findIn(cc, lv, 0);
|
||||
|
||||
ServerWorld world = cc.s.getWorld();
|
||||
|
||||
BooYah(world.getChunkManager().getChunkGenerator());
|
||||
|
||||
BlockPos pos = locator.block.getPos();
|
||||
StructureFeature<?> structure = null;
|
||||
boolean needSize = false;
|
||||
@@ -3236,10 +3253,17 @@ public class CarpetExpression
|
||||
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(dim));
|
||||
}
|
||||
}
|
||||
((CarpetContext) c).s = innerSource;
|
||||
Value retval = lv.get(1).evalValue(c);
|
||||
((CarpetContext) c).s = outerSource;
|
||||
return (cc, tt) -> retval;
|
||||
try
|
||||
{
|
||||
((CarpetContext) c).s = innerSource;
|
||||
Value retval = lv.get(1).evalValue(c);
|
||||
return (cc, tt) -> retval;
|
||||
}
|
||||
finally
|
||||
{
|
||||
((CarpetContext) c).s = outerSource;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.expr.addLazyFunction("plop", 4, (c, t, lv) ->{
|
||||
|
||||
Reference in new issue
Block a user