26.3-snap-3
This commit is contained in:
1 parent
f146a9e307
commit
3a91edeecc
6 files changed
+142
-28
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
|
||||
|
||||
# Fabric Properties
|
||||
# check https://fabricmc.net/develop/
|
||||
minecraft_version=26.3-snapshot-2
|
||||
minecraft_version=26.3-snapshot-3
|
||||
loader_version=0.19.3
|
||||
loom_version=1.17-SNAPSHOT
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package carpet.helpers;
|
||||
|
||||
import carpet.script.utils.FeatureGenerator;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.BaseCoralPlantTypeBlock;
|
||||
@@ -16,11 +19,16 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BonemealableBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralClawFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralTreeFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CuboidPlacement;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.SimpleRandomSelectorFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.OffsetPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.RandomChancePlacement;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Deduplicates logic for the different behaviors of the {@code renewableCoral} rule
|
||||
*/
|
||||
@@ -47,15 +55,9 @@ public interface FertilizableCoral extends BonemealableBlock {
|
||||
@Override
|
||||
public default void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
|
||||
{
|
||||
int variant = random.nextInt(3);
|
||||
CoralFeature coral = switch (variant) {
|
||||
case 0 -> new CoralClawFeature();
|
||||
case 1 -> new CoralTreeFeature();
|
||||
default -> new CoralMushroomFeature();
|
||||
};
|
||||
|
||||
MapColor color = blockUnder.getMapColor(worldIn, pos);
|
||||
BlockState properBlock = blockUnder;
|
||||
var blocks = worldIn.registryAccess().lookupOrThrow(Registries.BLOCK);
|
||||
HolderSet.Named<Block> coralBlocks = worldIn.registryAccess().lookupOrThrow(Registries.BLOCK).get(BlockTags.CORAL_BLOCKS).orElseThrow();
|
||||
for (Holder<Block> block: coralBlocks)
|
||||
{
|
||||
@@ -65,9 +67,36 @@ public interface FertilizableCoral extends BonemealableBlock {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Block actualProperBlock = properBlock.getBlock();
|
||||
|
||||
worldIn.setBlock(pos, Blocks.WATER.defaultBlockState(), Block.UPDATE_NONE);
|
||||
|
||||
if (!coral.placeFeature(worldIn, random, pos, properBlock))
|
||||
var features = worldIn.registryAccess().lookupOrThrow(Registries.FEATURE);
|
||||
Feature feature = new SimpleRandomSelectorFeature( HolderSet.direct(Stream.of(actualProperBlock)
|
||||
.map(block -> FeatureGenerator.coral(features, blocks, actualProperBlock))
|
||||
.flatMap(
|
||||
coralType -> Stream.of(
|
||||
PlacementUtils.inlinePlaced(new CoralTreeFeature(
|
||||
PlacementUtils.inlinePlaced(coralType, FeatureGenerator.coralPlacement))
|
||||
),
|
||||
PlacementUtils.inlinePlaced(new CoralClawFeature(
|
||||
PlacementUtils.inlinePlaced(coralType, FeatureGenerator.coralPlacement))),
|
||||
PlacementUtils.inlinePlaced(
|
||||
coralType,
|
||||
OffsetPlacement.vertical(UniformInt.of(-3, -1)),
|
||||
new CuboidPlacement(
|
||||
UniformInt.of(3, 5),
|
||||
UniformInt.of(3, 5),
|
||||
false,
|
||||
false
|
||||
),
|
||||
new RandomChancePlacement(0.9f),
|
||||
FeatureGenerator.coralPlacement
|
||||
)
|
||||
)
|
||||
).toList())
|
||||
);
|
||||
if (!feature.place(worldIn, worldIn.getChunkSource().getGenerator(), random, pos))
|
||||
{
|
||||
worldIn.setBlock(pos, blockUnder, 3);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ package carpet.mixins;
|
||||
import carpet.network.CarpetClient;
|
||||
import carpet.script.utils.ShapesRenderer;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
|
||||
import com.mojang.blaze3d.framegraph.FramePass;
|
||||
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
||||
import com.mojang.renderpearl.api.buffers.GpuBufferSlice;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
@@ -56,8 +56,9 @@ public class LevelRenderer_scarpetRenderMixin
|
||||
|
||||
@Inject(method = "render", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
|
||||
target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/renderpearl/api/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;submitFeatures(Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/client/renderer/SubmitNodeCollector;Z)V",
|
||||
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
|
||||
|
||||
@@ -1100,7 +1100,7 @@ public class WorldAccess
|
||||
for (ServerPlayer serverPlayer : cc.level().players()) {
|
||||
if (serverPlayer.distanceToSqr(pos) < 4096.0) {
|
||||
Optional<Vec3> optional = Optional.ofNullable((Vec3)serverExplosion.getHitPlayers().get(serverPlayer));
|
||||
serverPlayer.connection.send(new ClientboundExplodePacket(pos, powah, i, optional, particleOptions3, SoundEvents.GENERIC_EXPLODE, DEFAULT_EXPLOSION_BLOCK_PARTICLES));
|
||||
serverPlayer.connection.send(new ClientboundExplodePacket(pos, powah, i, optional, particleOptions3, SoundEvents.GENERIC_EXPLODE, DEFAULT_EXPLOSION_BLOCK_PARTICLES, true));
|
||||
}
|
||||
}
|
||||
return Value.TRUE;
|
||||
|
||||
@@ -11,9 +11,11 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
import net.minecraft.core.HolderSet;
|
||||
@@ -22,13 +24,19 @@ import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.worldgen.Pools;
|
||||
import net.minecraft.data.worldgen.ProcessorLists;
|
||||
import net.minecraft.data.worldgen.features.AquaticFeatures;
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.references.BlockItemIds;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.random.Weighted;
|
||||
import net.minecraft.util.random.WeightedList;
|
||||
import net.minecraft.util.valueproviders.ConstantInt;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -38,18 +46,28 @@ import net.minecraft.world.level.chunk.ChunkGeneratorStructureState;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.RandomState;
|
||||
import net.minecraft.world.level.levelgen.VerticalAnchor;
|
||||
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralClawFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CoralTreeFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.CuboidPlacement;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.NoOpFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.OverlayFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.SimpleRandomSelectorFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.TreeFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.WeightedRandomSelectorFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize;
|
||||
import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer;
|
||||
import net.minecraft.world.level.levelgen.feature.foliageplacers.FancyFoliagePlacer;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.RandomBlockProvider;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.RotatedBlockProvider;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.RuleBasedStateProvider;
|
||||
import net.minecraft.world.level.levelgen.heightproviders.ConstantHeight;
|
||||
import net.minecraft.world.level.levelgen.placement.BlockPredicateFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.OffsetPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.RandomChancePlacement;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureType;
|
||||
@@ -278,6 +296,78 @@ public class FeatureGenerator
|
||||
return new TreeFeature.Builder(BlockStateProvider.simple(block), new StraightTrunkPlacer(i, j, k), BlockStateProvider.simple(block2), new BlobFoliagePlacer(ConstantInt.of(l), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1), belowTrees);
|
||||
}
|
||||
|
||||
// from AquaticFeatures
|
||||
private static Holder<PlacedFeature> wallCoral(final HolderGetter<Block> blocks, final Direction direction) {
|
||||
return PlacementUtils.inlinePlaced(
|
||||
new SimpleBlockFeature(new RotatedBlockProvider(new RandomBlockProvider(blocks.getOrThrow(BlockTags.WALL_CORALS)), Optional.of(direction))),
|
||||
new RandomChancePlacement(0.2f),
|
||||
OffsetPlacement.of(direction),
|
||||
BlockPredicateFilter.forPredicate(BlockPredicate.matchesBlocks(Blocks.WATER))
|
||||
);
|
||||
}
|
||||
|
||||
public static Feature coral(final HolderGetter<Feature> features, final HolderGetter<Block> blocks, final Block block) {
|
||||
return new OverlayFeature(HolderSet.direct(
|
||||
PlacementUtils.inlinePlaced(new SimpleBlockFeature(BlockStateProvider.simple(block))),
|
||||
PlacementUtils.inlinePlaced(
|
||||
new WeightedRandomSelectorFeature(WeightedList.of(
|
||||
new Weighted<>(PlacementUtils.inlinePlaced(new SimpleBlockFeature(new RandomBlockProvider(blocks.getOrThrow(BlockTags.CORALS)))), 20),
|
||||
new Weighted<>(PlacementUtils.inlinePlaced(features.getOrThrow(AquaticFeatures.SEA_PICKLE)), 3),
|
||||
new Weighted<>(PlacementUtils.inlinePlaced(new NoOpFeature()), 57)
|
||||
)),
|
||||
OffsetPlacement.above()
|
||||
),
|
||||
wallCoral(blocks, Direction.NORTH),
|
||||
wallCoral(blocks, Direction.EAST),
|
||||
wallCoral(blocks, Direction.SOUTH),
|
||||
wallCoral(blocks, Direction.WEST)
|
||||
));
|
||||
}
|
||||
|
||||
final static public BlockPredicateFilter coralPlacement = BlockPredicateFilter.forPredicate(BlockPredicate.allOf(
|
||||
BlockPredicate.anyOf(BlockPredicate.matchesBlocks(Blocks.WATER), BlockPredicate.matchesTag(BlockTags.CORALS)),
|
||||
BlockPredicate.matchesBlocks(Direction.UP, Blocks.WATER)
|
||||
));
|
||||
|
||||
|
||||
private static Feature coral(ServerLevel level, final int type) {
|
||||
var blocks = level.registryAccess().lookupOrThrow(Registries.BLOCK);
|
||||
var features = level.registryAccess().lookupOrThrow(Registries.FEATURE);
|
||||
|
||||
return new SimpleRandomSelectorFeature(
|
||||
HolderSet.direct(
|
||||
Stream.of(BlockItemIds.TUBE_CORAL_BLOCK, BlockItemIds.BRAIN_CORAL_BLOCK, BlockItemIds.BUBBLE_CORAL_BLOCK, BlockItemIds.FIRE_CORAL_BLOCK, BlockItemIds.HORN_CORAL_BLOCK)
|
||||
.map(id -> blocks.getOrThrow(id.block()).value())
|
||||
.map(block -> coral(features, blocks, block))
|
||||
.map(
|
||||
coralType -> switch (type) {
|
||||
case 0 -> PlacementUtils.inlinePlaced(new CoralTreeFeature(
|
||||
PlacementUtils.inlinePlaced(coralType, coralPlacement))
|
||||
);
|
||||
case 1 -> PlacementUtils.inlinePlaced(new CoralClawFeature(
|
||||
PlacementUtils.inlinePlaced(coralType, coralPlacement))
|
||||
);
|
||||
default -> PlacementUtils.inlinePlaced(
|
||||
coralType,
|
||||
OffsetPlacement.vertical(UniformInt.of(-3, -1)),
|
||||
new CuboidPlacement(
|
||||
UniformInt.of(3, 5),
|
||||
UniformInt.of(3, 5),
|
||||
false,
|
||||
false
|
||||
),
|
||||
new RandomChancePlacement(0.9f),
|
||||
coralPlacement
|
||||
);
|
||||
}
|
||||
)
|
||||
.toList()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final Map<String, Function<ServerLevel, Thing>> featureMap = new HashMap<>()
|
||||
{{
|
||||
|
||||
@@ -286,17 +376,13 @@ public class FeatureGenerator
|
||||
put("fancy_oak_bees", l -> simpleTree(new TreeFeature.Builder(BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), new FancyFoliagePlacer(ConstantInt.of(2), ConstantInt.of(4), 4), new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(4)), belowTrees).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F)))));
|
||||
put("birch_bees", l -> simpleTree(createTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F)))));
|
||||
|
||||
put("coral_tree", l -> simplePlop(new CoralTreeFeature()));
|
||||
put("coral_tree", l -> simplePlop(coral(l, 0)));
|
||||
|
||||
put("coral_claw", l -> simplePlop(coral(l, 1)));
|
||||
put("coral_mushroom", l -> simplePlop(coral(l , 2)));
|
||||
|
||||
put("coral", l -> simplePlop( l.registryAccess().lookupOrThrow(Registries.FEATURE).getOrThrow(AquaticFeatures.WARM_OCEAN_VEGETATION).value()));
|
||||
|
||||
put("coral_claw", l -> simplePlop(new CoralClawFeature()));
|
||||
put("coral_mushroom", l -> simplePlop(new CoralMushroomFeature()));
|
||||
put("coral", l -> simplePlop(new SimpleRandomSelectorFeature(
|
||||
HolderSet.direct(
|
||||
PlacementUtils.inlinePlaced(new CoralTreeFeature()),
|
||||
PlacementUtils.inlinePlaced(new CoralClawFeature()),
|
||||
PlacementUtils.inlinePlaced(new CoralMushroomFeature())
|
||||
)
|
||||
)));
|
||||
put("bastion_remnant_units", l -> {
|
||||
RegistryAccess regs = l.registryAccess();
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
//import com.mojang.blaze3d.vertex.VertexFormat.Mode;
|
||||
import com.mojang.math.Axis;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
|
||||
|
||||
Reference in new issue
Block a user