1.18-pre1

This commit is contained in:
gnembon committed 2021-11-11 22:49:26 +01:00
1 parent 6468ac37c7
commit 5a6fc19bb0
10 files changed
+57 -24

No files matched your search

+2 -2
View File
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=21w44a minecraft_version=1.18-pre1
yarn_mappings=21w44a+build.10 yarn_mappings=1.18-pre1+build.2
loader_version=0.12.5 loader_version=0.12.5
fabric_version=0.42.1+1.18 fabric_version=0.42.1+1.18
@@ -0,0 +1,9 @@
package carpet.fakes;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
public interface PlacedFeatureInterface {
ConfiguredFeature<?, ?> getRawFeature();
}
@@ -13,5 +13,5 @@ import net.minecraft.world.gen.feature.FeatureConfig;
public interface StructureFeatureInterface<C extends FeatureConfig> public interface StructureFeatureInterface<C extends FeatureConfig>
{ {
boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly,Biome biome, C config); boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly,Biome biome, C config);
boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, ChunkPos chpos, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView); boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView);
} }
@@ -1,10 +1,13 @@
package carpet.helpers; package carpet.helpers;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import carpet.fakes.PlacedFeatureInterface;
import carpet.fakes.StructureFeatureInterface; import carpet.fakes.StructureFeatureInterface;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.class_6796;
import net.minecraft.class_6797;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager; import net.minecraft.structure.StructureManager;
import net.minecraft.structure.StructureStart; import net.minecraft.structure.StructureStart;
@@ -185,11 +188,11 @@ public class FeatureGenerator
private static ConfiguredFeature<?, ?> getDefaultFeature(Feature<?> feature, ServerWorld world, BlockPos pos, boolean tryHard) private static ConfiguredFeature<?, ?> getDefaultFeature(Feature<?> feature, ServerWorld world, BlockPos pos, boolean tryHard)
{ {
List<List<Supplier<ConfiguredFeature<?, ?>>>> configuredStepFeatures = world.getBiome(pos).getGenerationSettings().getFeatures(); List<List<Supplier<class_6796>>> configuredStepFeatures = world.getBiome(pos).getGenerationSettings().getFeatures();
for (List<Supplier<ConfiguredFeature<?, ?>>> step: configuredStepFeatures) for (List<Supplier<class_6796>> step: configuredStepFeatures)
for (Supplier<ConfiguredFeature<?, ?>> provider: step) for (Supplier<class_6796> provider: step)
{ {
ConfiguredFeature<?, ?> configuredFeature = provider.get(); ConfiguredFeature<?, ?> configuredFeature = ((PlacedFeatureInterface)provider.get()).getRawFeature();
if (configuredFeature.feature == feature) if (configuredFeature.feature == feature)
return configuredFeature; return configuredFeature;
} }
@@ -258,9 +261,9 @@ public class FeatureGenerator
put("coral_claw", simplePlop(Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT))); put("coral_claw", simplePlop(Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT)));
put("coral_mushroom", simplePlop(Feature.CORAL_MUSHROOM.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( put("coral", simplePlop(Feature.SIMPLE_RANDOM_SELECTOR.configure(new SimpleRandomFeatureConfig(List.of(
() -> Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT), () -> Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0]),
() -> Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT), () -> Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0]),
() -> Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT) () -> Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT).method_39594(new class_6797[0])
))))); )))));
put("bastion_remnant_units", spawnCustomStructure( put("bastion_remnant_units", spawnCustomStructure(
StructureFeature.BASTION_REMNANT, StructureFeature.BASTION_REMNANT,
@@ -0,0 +1,21 @@
package carpet.mixins;
import carpet.fakes.PlacedFeatureInterface;
import net.minecraft.class_6796;
import net.minecraft.world.gen.feature.ConfiguredFeature;
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)
public class PlacedFeature_scarpetMixin implements PlacedFeatureInterface {
@Shadow @Final private Supplier<ConfiguredFeature<?, ?>> field_35732;
@Override
public ConfiguredFeature<?, ?> getRawFeature() {
return field_35732.get();
}
}
@@ -136,13 +136,10 @@ public abstract class ServerWorld_tickMixin extends World
if (TickSpeed.process_entities) worldBorder.tick(); if (TickSpeed.process_entities) worldBorder.tick();
} }
@Redirect(method = "tick", at = @At( @Inject(method = "method_39501", cancellable = true, at = @At("HEAD"))
value = "INVOKE", private void tickWorldBorder(CallbackInfo ci)
target = "Lnet/minecraft/world/dimension/DimensionType;hasSkyLight()Z"
))
private boolean tickWorldBorder(DimensionType dimension)
{ {
return TickSpeed.process_entities && dimension.hasSkyLight(); if (!TickSpeed.process_entities) ci.cancel();
} }
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
@@ -44,10 +44,12 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
//@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom random, ChunkPos chunkPos, Biome biome, ChunkPos chunkPos2, C featureConfig, HeightLimitView heightLimitView); //@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom random, ChunkPos chunkPos, Biome biome, ChunkPos chunkPos2, C featureConfig, HeightLimitView heightLimitView);
@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, 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;
@Override @Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, C config) public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, C config)
{ {
@@ -157,8 +159,8 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
} }
@Override @Override
public boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, ChunkPos chpos, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView) public boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkPos chunkPos, C featureConfig, HeightLimitView heightLimitView)
{ {
return shouldStartAt(chunkGenerator, biomeSource, l, chunkRandom, chpos, chunkPos, featureConfig, heightLimitView); return shouldStartAt(chunkGenerator, biomeSource, l, chunkPos, featureConfig, heightLimitView);
} }
} }
@@ -16,11 +16,11 @@ import net.minecraft.world.Heightmap;
//import net.minecraft.world.TickScheduler; //import net.minecraft.world.TickScheduler;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.BlendingData;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection; import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.UpgradeData; import net.minecraft.world.chunk.UpgradeData;
import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.gen.chunk.Blender;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -35,9 +35,8 @@ public abstract class WorldChunk_movableTEMixin extends Chunk implements WorldCh
@Final @Final
World world; World world;
public WorldChunk_movableTEMixin(ChunkPos chunkPos, UpgradeData upgradeData, HeightLimitView heightLimitView, Registry<Biome> registry, long l, @Nullable ChunkSection[] chunkSections, @Nullable BlendingData blendingData) public WorldChunk_movableTEMixin(ChunkPos pos, UpgradeData upgradeData, HeightLimitView heightLimitView, Registry<Biome> biome, long inhabitedTime, @Nullable ChunkSection[] sectionArrayInitializer, @Nullable Blender blendingData) {
{ super(pos, upgradeData, heightLimitView, biome, inhabitedTime, sectionArrayInitializer, blendingData);
super(chunkPos, upgradeData, heightLimitView, registry, l, chunkSections, blendingData);
} }
@Shadow @Shadow
@@ -1,6 +1,7 @@
package carpet.script.utils; package carpet.script.utils;
import carpet.fakes.BiomeEffectsInterface; import carpet.fakes.BiomeEffectsInterface;
import carpet.fakes.PlacedFeatureInterface;
import carpet.script.value.BlockValue; import carpet.script.value.BlockValue;
import carpet.script.value.ListValue; import carpet.script.value.ListValue;
import carpet.script.value.NumericValue; import carpet.script.value.NumericValue;
@@ -41,7 +42,7 @@ public class BiomeInfo
return ListValue.wrap( return ListValue.wrap(
b.getGenerationSettings().getFeatures().stream().map(step -> b.getGenerationSettings().getFeatures().stream().map(step ->
ListValue.wrap(step.stream().map(cfp -> ListValue.wrap(step.stream().map(cfp ->
ValueConversions.of(registry.getId(cfp.get())) ValueConversions.of(registry.getId(((PlacedFeatureInterface)cfp.get()).getRawFeature()))
)) ))
) )
); );
+1
View File
@@ -102,6 +102,7 @@
"World_scarpetPlopMixin", "World_scarpetPlopMixin",
"ChunkRegion_scarpetPlopMixin", "ChunkRegion_scarpetPlopMixin",
"StructurePiece_scarpetPlopMixin", "StructurePiece_scarpetPlopMixin",
"PlacedFeature_scarpetMixin",
"ServerPlayNetworkHandler_scarpetEventsMixin", "ServerPlayNetworkHandler_scarpetEventsMixin",
"ServerPlayerInteractionManager_scarpetEventsMixin", "ServerPlayerInteractionManager_scarpetEventsMixin",