1.18.2-pre3
This commit is contained in:
1 parent
792fda70b0
commit
d24f711e27
5 files changed
+22
-9
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ 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=1.18.2-pre2
|
minecraft_version=1.18.2-pre3
|
||||||
loader_version=0.12.12
|
loader_version=0.12.12
|
||||||
fabric_version=0.46.2+1.18
|
fabric_version=0.46.2+1.18
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class FeatureGenerator
|
|||||||
ChunkGeneratorInterface cgi = (ChunkGeneratorInterface) generator;
|
ChunkGeneratorInterface cgi = (ChunkGeneratorInterface) generator;
|
||||||
List<StructurePlacement> structureConfig = cgi.getPlacementsForFeatureCM(structure);
|
List<StructurePlacement> structureConfig = cgi.getPlacementsForFeatureCM(structure);
|
||||||
ChunkPos chunkPos = new ChunkPos(pos);
|
ChunkPos chunkPos = new ChunkPos(pos);
|
||||||
boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isFeatureChunk(generator, chunkPos.x, chunkPos.z));
|
boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isFeatureChunk(generator, world.getSeed(), chunkPos.x, chunkPos.z));
|
||||||
if (!couldPlace) return null;
|
if (!couldPlace) return null;
|
||||||
|
|
||||||
final HolderSet<Biome> structureBiomes = structure.biomes();
|
final HolderSet<Biome> structureBiomes = structure.biomes();
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package carpet.mixins;
|
|||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import carpet.utils.SpawnOverrides;
|
import carpet.utils.SpawnOverrides;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.data.worldgen.StructureFeatures;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.monster.Husk;
|
import net.minecraft.world.entity.monster.Husk;
|
||||||
import net.minecraft.world.level.ServerLevelAccessor;
|
import net.minecraft.world.level.ServerLevelAccessor;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@@ -18,6 +18,6 @@ public class Husk_templesMixin
|
|||||||
private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos)
|
private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos)
|
||||||
{
|
{
|
||||||
return serverWorldAccess.canSeeSky(pos) ||
|
return serverWorldAccess.canSeeSky(pos) ||
|
||||||
(CarpetSettings.huskSpawningInTemples && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, StructureFeatures.DESERT_PYRAMID.value().feature, pos));
|
(CarpetSettings.huskSpawningInTemples && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,7 @@ import net.minecraft.commands.arguments.ObjectiveArgument;
|
|||||||
import net.minecraft.commands.arguments.ObjectiveCriteriaArgument;
|
import net.minecraft.commands.arguments.ObjectiveCriteriaArgument;
|
||||||
import net.minecraft.commands.arguments.ParticleArgument;
|
import net.minecraft.commands.arguments.ParticleArgument;
|
||||||
import net.minecraft.commands.arguments.RangeArgument;
|
import net.minecraft.commands.arguments.RangeArgument;
|
||||||
|
import net.minecraft.commands.arguments.ResourceKeyArgument;
|
||||||
import net.minecraft.commands.arguments.ResourceLocationArgument;
|
import net.minecraft.commands.arguments.ResourceLocationArgument;
|
||||||
import net.minecraft.commands.arguments.ResourceOrTagLocationArgument;
|
import net.minecraft.commands.arguments.ResourceOrTagLocationArgument;
|
||||||
import net.minecraft.commands.arguments.ScoreHolderArgument;
|
import net.minecraft.commands.arguments.ScoreHolderArgument;
|
||||||
@@ -209,7 +210,7 @@ public abstract class CommandArgument
|
|||||||
(c, p) -> ValueConversions.of( ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getLootTables().getIds(), builder)
|
(c, p) -> ValueConversions.of( ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getLootTables().getIds(), builder)
|
||||||
),
|
),
|
||||||
new VanillaUnconfigurableArgument("attribute", ResourceLocationArgument::id,
|
new VanillaUnconfigurableArgument("attribute", ResourceLocationArgument::id,
|
||||||
(c, p) -> ValueConversions.of( Registry.ATTRIBUTE.getKey(ResourceLocationArgument.getAttribute(c, p))), (ctx, builder) -> SharedSuggestionProvider.suggestResource(Registry.ATTRIBUTE.keySet(), builder)
|
(c, p) -> ValueConversions.of( Registry.ATTRIBUTE.getKey(ResourceKeyArgument.getAttribute(c, p))), (ctx, builder) -> SharedSuggestionProvider.suggestResource(Registry.ATTRIBUTE.keySet(), builder)
|
||||||
),
|
),
|
||||||
new VanillaUnconfigurableArgument("boss", ResourceLocationArgument::id,
|
new VanillaUnconfigurableArgument("boss", ResourceLocationArgument::id,
|
||||||
(c, p) -> ValueConversions.of( ResourceLocationArgument.getId(c, p)), BossBarCommands.SUGGEST_BOSS_BAR
|
(c, p) -> ValueConversions.of( ResourceLocationArgument.getId(c, p)), BossBarCommands.SUGGEST_BOSS_BAR
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package carpet.utils;
|
package carpet.utils;
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.data.worldgen.StructureFeatures;
|
import net.minecraft.data.worldgen.StructureFeatures;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.util.random.WeightedRandomList;
|
import net.minecraft.util.random.WeightedRandomList;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@@ -18,10 +19,12 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
|||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureSpawnOverride;
|
import net.minecraft.world.level.levelgen.structure.StructureSpawnOverride;
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
public class SpawnOverrides {
|
public class SpawnOverrides {
|
||||||
@@ -69,7 +72,16 @@ public class SpawnOverrides {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isStructureAtPosition(ServerLevel level, StructureFeature structure, BlockPos pos)
|
public static boolean isStructureAtPosition(ServerLevel level, ResourceKey<ConfiguredStructureFeature<?, ?>> structureKey, BlockPos pos)
|
||||||
|
{
|
||||||
|
final ConfiguredStructureFeature<?, ?> fortressFeature = level.registryAccess().registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).get(structureKey);
|
||||||
|
if (fortressFeature == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return level.structureFeatureManager().getStructureAt(pos, fortressFeature).isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isStructureAtPosition(ServerLevel level, StructureFeature<?> structure, BlockPos pos)
|
||||||
{
|
{
|
||||||
for(StructureStart structureStart : startsForFeature(level, SectionPos.of(pos), structure)) {
|
for(StructureStart structureStart : startsForFeature(level, SectionPos.of(pos), structure)) {
|
||||||
if (structureStart.getBoundingBox().isInside(pos) && structureStart.isValid()) {
|
if (structureStart.getBoundingBox().isInside(pos) && structureStart.isValid()) {
|
||||||
|
|||||||
Reference in new issue
Block a user