Merge branch 'master' into 1.17

# Conflicts:
#	src/main/java/carpet/helpers/FeatureGenerator.java
This commit is contained in:
gnembon committed 2021-05-13 01:52:08 -03:00
commit 65447f09ad
3 files changed
+86 -75

No files matched your search

@@ -40,7 +40,7 @@ import java.util.Map;
public class FeatureGenerator
{
public static final Object boo = new Object();
synchronized public static Boolean plop(String featureName, ServerWorld world, BlockPos pos)
{
Thing custom = featureMap.get(featureName);
@@ -147,8 +147,10 @@ public class FeatureGenerator
long seed = world.getSeed();
ChunkGenerator generator = world.getChunkManager().getChunkGenerator();
StructureConfig params = generator.getStructuresConfig().getForType(structure);
if (!generator.getBiomeSource().hasStructureFeature(structure))
return null;
synchronized(boo) {
if (!generator.getBiomeSource().hasStructureFeature(structure))
return null;
}
BiomeAccess biomeAccess = world.getBiomeAccess().withSource(generator.getBiomeSource());
ChunkRandom chunkRandom = new ChunkRandom();
ChunkPos chunkPos = new ChunkPos(pos);
@@ -163,7 +165,9 @@ public class FeatureGenerator
if (!computeBox) return StructureStart.DEFAULT;
StructureManager manager = world.getStructureManager();
StructureStart<T> structureStart3 = structure.getStructureStartFactory().create((StructureFeature<T>) configuredFeature.feature, chunkPos, 0, seed);
structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos, biome, (T) configuredFeature.config, world);
synchronized (boo) {
structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos, biome, (T) configuredFeature.config, world);
}
if (!structureStart3.hasChildren()) return null;
return structureStart3;
}
@@ -1,8 +1,6 @@
package carpet.script.argument;
import carpet.CarpetServer;
import carpet.script.Context;
import carpet.script.LazyValue;
import carpet.script.bundled.Module;
import carpet.script.exception.InternalExpressionException;
import carpet.script.exception.ThrowStatement;
@@ -180,14 +178,11 @@ public class FileArgument
Map<String, String> env = new HashMap<>();
if (reason == Reason.CREATE) env.put("create", "true");
zipPath = resolve(getDescriptor(module, zipContainer));
if (!Files.exists(zipPath) && reason != Reason.CREATE) return null; // no zip file
try {
zfs = FileSystems.newFileSystem(URI.create("jar:"+ zipPath.toUri().toString()), env);
}
catch (FileSystemNotFoundException fsnfe)
{
return null;
}
catch (IOException e)
catch (FileSystemNotFoundException | IOException fsnfe)
{
return null; // undr java 16 no file throws IOException - will take care of it later
//throw new ThrowStatement("Unable to open zip file: "+zipContainer, Throwables.IO_EXCEPTION);