This commit is contained in:
gnembon committed 2021-11-16 21:08:26 +01:00
1 parent 964ff4bb6b
commit adaf19170d
7 files changed
+29 -27

No files matched your search

+2 -2
View File
@@ -5,9 +5,9 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=1.18-pre1
yarn_mappings=1.18-pre1+build.2
yarn_mappings=1.18-pre1+build.14
loader_version=0.12.5
fabric_version=0.42.1+1.18
fabric_version=0.42.4+1.18
# Mod Properties
mod_version = 1.4.53
@@ -6,8 +6,6 @@ import carpet.fakes.StructureFeatureInterface;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.class_6796;
import net.minecraft.class_6797;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager;
import net.minecraft.structure.StructureStart;
@@ -23,6 +21,8 @@ import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.BuiltinBiomes;
import net.minecraft.world.gen.decorator.PlacementModifier;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
import net.minecraft.world.gen.foliage.LargeOakFoliagePlacer;
@@ -188,9 +188,9 @@ public class FeatureGenerator
private static ConfiguredFeature<?, ?> getDefaultFeature(Feature<?> feature, ServerWorld world, BlockPos pos, boolean tryHard)
{
List<List<Supplier<class_6796>>> configuredStepFeatures = world.getBiome(pos).getGenerationSettings().getFeatures();
for (List<Supplier<class_6796>> step: configuredStepFeatures)
for (Supplier<class_6796> provider: step)
List<List<Supplier<PlacedFeature>>> configuredStepFeatures = world.getBiome(pos).getGenerationSettings().getFeatures();
for (List<Supplier<PlacedFeature>> step: configuredStepFeatures)
for (Supplier<PlacedFeature> provider: step)
{
ConfiguredFeature<?, ?> configuredFeature = ((PlacedFeatureInterface)provider.get()).getRawFeature();
if (configuredFeature.feature == feature)
@@ -261,9 +261,9 @@ public class FeatureGenerator
put("coral_claw", simplePlop(Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT)));
put("coral_mushroom", simplePlop(Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT)));
put("coral", simplePlop(Feature.SIMPLE_RANDOM_SELECTOR.configure(new SimpleRandomFeatureConfig(List.of(
() -> Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0]),
() -> Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0]),
() -> Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0])
() -> Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT).withPlacement(),
() -> Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT).withPlacement(),
() -> Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT).withPlacement()
)))));
put("bastion_remnant_units", spawnCustomStructure(
StructureFeature.BASTION_REMNANT,
@@ -1,21 +1,21 @@
package carpet.mixins;
import carpet.fakes.PlacedFeatureInterface;
import net.minecraft.class_6796;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.function.Supplier;
@Mixin(class_6796.class)
@Mixin(PlacedFeature.class)
public class PlacedFeature_scarpetMixin implements PlacedFeatureInterface {
@Shadow @Final private Supplier<ConfiguredFeature<?, ?>> field_35732;
@Shadow @Final private Supplier<ConfiguredFeature<?, ?>> feature;
@Override
public ConfiguredFeature<?, ?> getRawFeature() {
return field_35732.get();
return feature.get();
}
}
@@ -136,8 +136,8 @@ public abstract class ServerWorld_tickMixin extends World
if (TickSpeed.process_entities) worldBorder.tick();
}
@Inject(method = "method_39501", cancellable = true, at = @At("HEAD"))
private void tickWorldBorder(CallbackInfo ci)
@Inject(method = "tickWeather", cancellable = true, at = @At("HEAD"))
private void tickWeather(CallbackInfo ci)
{
if (!TickSpeed.process_entities) ci.cancel();
}
@@ -3,9 +3,9 @@ package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.StructureFeatureInterface;
import com.google.common.collect.ImmutableMultimap;
import net.minecraft.class_6622;
import net.minecraft.class_6626;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructurePiecesCollector;
import net.minecraft.structure.StructurePiecesGenerator;
import net.minecraft.structure.StructureStart;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
@@ -47,9 +47,11 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
//@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom random, ChunkPos pos, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView);
@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView);
@Shadow @Final private class_6622<C> field_34929;
//@Shadow @Final private class_6622<C> field_34929;
@Shadow @Final private StructurePiecesGenerator<C> piecesGenerator;
@Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, C config)
{
@@ -70,7 +72,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
StructureFeature<C> thiss = (StructureFeature<C>) (Object)this;
world.getChunk(j, k).addStructureReference(thiss, chId);
BlockBox box = structurestart.setBoundingBoxFromChildren(); // getBB
BlockBox box = structurestart.getBoundingBox();
if (!wireOnly)
{
@@ -79,7 +81,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
Objects.requireNonNull(thiss);
return registry3.getKey(thiss).map(Object::toString).orElseGet(thiss::toString);
});
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand, box, new ChunkPos(j, k));
structurestart.place(world, world.getStructureAccessor(), generator, rand, box, new ChunkPos(j, k));
}
//structurestart.notifyPostProcessAt(new ChunkPos(j, k));
int i = Math.max(box.getBlockCountX(),box.getBlockCountZ())/16+1;
@@ -137,11 +139,11 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
//if (config == null)
// config = (C) new DefaultFeatureConfig();
class_6626 lv = new class_6626();
field_34929.generatePieces(lv, config, new class_6622.class_6623(worldIn.getRegistryManager(), generator, worldIn.getStructureManager(), chunkpos, b -> true, worldIn, Util.make(new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed())), (chunkRandomx) -> {
StructurePiecesCollector lv = new StructurePiecesCollector();
piecesGenerator.generatePieces(lv, config, new StructurePiecesGenerator.Context(worldIn.getRegistryManager(), generator, worldIn.getStructureManager(), chunkpos, b -> true, worldIn, Util.make(new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed())), (chunkRandomx) -> {
chunkRandomx.setCarverSeed(worldIn.getSeed(), chunkpos.x, chunkpos.z);
}), worldIn.getSeed()));
StructureStart<C> structurestart1 = new StructureStart<>(thiss, chunkpos, 0, lv.method_38714());
StructureStart<C> structurestart1 = new StructureStart<>(thiss, chunkpos, 0, lv.toList());
//StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos,0,worldIn.getSeed());
@@ -1298,7 +1298,7 @@ public class WorldAccess {
StructureStart<?> start = entry.getValue();
if (start == StructureStart.DEFAULT)
continue;
BlockBox box = start.setBoundingBoxFromChildren();
BlockBox box = start.getBoundingBox();
structureList.put(
new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.STRUCTURE_FEATURE.getId(entry.getKey()))),
ListValue.of(ListValue.fromTriple(box.getMinX(), box.getMinY(), box.getMinZ()), ListValue.fromTriple(box.getMaxX(), box.getMaxY(), box.getMaxZ()))
@@ -1347,7 +1347,7 @@ public class WorldAccess {
}
StructureStart<?> start = structures.get(structure);
ChunkPos structureChunkPos = start.getPos(); // new ChunkPos(start.getChunkX(), start.getChunkZ());
BlockBox box = start.setBoundingBoxFromChildren();
BlockBox box = start.getBoundingBox();
for (int chx = box.getMinX() / 16; chx <= box.getMaxX() / 16; chx++) // minx maxx
{
for (int chz = box.getMinZ() / 16; chz <= box.getMaxZ() / 16; chz++) //minZ maxZ
@@ -317,7 +317,7 @@ public class ValueConversions
public static Value of(StructureStart<?> structure)
{
if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL;
BlockBox boundingBox = structure.setBoundingBoxFromChildren();
BlockBox boundingBox = structure.getBoundingBox();
if (boundingBox.getMaxX() < boundingBox.getMinX() || boundingBox.getMaxY() < boundingBox.getMinY() || boundingBox.getMaxZ() < boundingBox.getMinZ()) return Value.NULL;
Map<Value, Value> ret = new HashMap<>();
ret.put(new StringValue("box"), of(boundingBox));