This commit is contained in:
gnembon committed 2022-03-31 20:23:49 +02:00
1 parent 79f994f2da
commit ef3e71b9b6
5 files changed
+30 -15

No files matched your search

+3 -3
View File
@@ -4,9 +4,9 @@ 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=22w12a minecraft_version=22w13a
loader_version=0.13.3 loader_version=0.13.3
fabric_version=0.46.4+1.18 fabric_version=0.49.4+1.19
# Mod Properties # Mod Properties
mod_version = 1.4.68 mod_version = 1.4.68
@@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates # This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = 1.18.2 release-curse-versions = 1.18-1.18.2
# Whether or not to build another branch on release # Whether or not to build another branch on release
release-extra-branch = true release-extra-branch = true
# The name of the second branch to release # The name of the second branch to release
@@ -14,6 +14,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandBuildContext;
@@ -107,13 +109,15 @@ public class SpawnCommand
dispatcher.register(literalargumentbuilder); dispatcher.register(literalargumentbuilder);
} }
private static final Map<String, MobCategory> MOB_CATEGORY_MAP = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(MobCategory::getName, Function.identity()));
private static MobCategory getCategory(String string) throws CommandSyntaxException private static MobCategory getCategory(String string) throws CommandSyntaxException
{ {
if (!Arrays.stream(MobCategory.values()).map(MobCategory::getName).collect(Collectors.toSet()).contains(string)) if (!Arrays.stream(MobCategory.values()).map(MobCategory::getName).collect(Collectors.toSet()).contains(string))
{ {
throw new SimpleCommandExceptionType(Messenger.c("r Wrong mob type: "+string+" should be "+ Arrays.stream(MobCategory.values()).map(MobCategory::getName).collect(Collectors.joining(", ")))).create(); throw new SimpleCommandExceptionType(Messenger.c("r Wrong mob type: "+string+" should be "+ Arrays.stream(MobCategory.values()).map(MobCategory::getName).collect(Collectors.joining(", ")))).create();
} }
return MobCategory.byName(string.toLowerCase(Locale.ROOT)); return MOB_CATEGORY_MAP.get(string.toLowerCase(Locale.ROOT));
} }
@@ -46,6 +46,7 @@ import net.minecraft.world.level.levelgen.heightproviders.ConstantHeight;
import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraft.world.level.levelgen.structure.StructureType;
import net.minecraft.world.level.levelgen.structure.TerrainAdjustment;
import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement; import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
import net.minecraft.world.level.levelgen.feature.treedecorators.BeehiveDecorator; import net.minecraft.world.level.levelgen.feature.treedecorators.BeehiveDecorator;
@@ -259,11 +260,12 @@ public class FeatureGenerator
PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE) PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)
)))); ))));
put("bastion_remnant_units", spawnCustomStructure( put("bastion_remnant_units", spawnCustomStructure(
new JigsawStructure( new JigsawStructure( new Structure.StructureSettings(
BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT),
Map.of(), Map.of(),
GenerationStep.Decoration.SURFACE_STRUCTURES, GenerationStep.Decoration.SURFACE_STRUCTURES,
false, TerrainAdjustment.NONE
),
Holder.direct(new StructureTemplatePool( Holder.direct(new StructureTemplatePool(
new ResourceLocation("bastion/starts"), new ResourceLocation("bastion/starts"),
new ResourceLocation("empty"), new ResourceLocation("empty"),
@@ -278,11 +280,12 @@ public class FeatureGenerator
) )
)); ));
put("bastion_remnant_hoglin_stable", spawnCustomStructure( put("bastion_remnant_hoglin_stable", spawnCustomStructure(
new JigsawStructure( new JigsawStructure( new Structure.StructureSettings(
BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT),
Map.of(), Map.of(),
GenerationStep.Decoration.SURFACE_STRUCTURES, GenerationStep.Decoration.SURFACE_STRUCTURES,
false, TerrainAdjustment.NONE
),
Holder.direct(new StructureTemplatePool( Holder.direct(new StructureTemplatePool(
new ResourceLocation("bastion/starts"), new ResourceLocation("bastion/starts"),
new ResourceLocation("empty"), new ResourceLocation("empty"),
@@ -297,11 +300,12 @@ public class FeatureGenerator
) )
)); ));
put("bastion_remnant_treasure", spawnCustomStructure( put("bastion_remnant_treasure", spawnCustomStructure(
new JigsawStructure( new JigsawStructure( new Structure.StructureSettings(
BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT),
Map.of(), Map.of(),
GenerationStep.Decoration.SURFACE_STRUCTURES, GenerationStep.Decoration.SURFACE_STRUCTURES,
false, TerrainAdjustment.NONE
),
Holder.direct(new StructureTemplatePool( Holder.direct(new StructureTemplatePool(
new ResourceLocation("bastion/starts"), new ResourceLocation("bastion/starts"),
new ResourceLocation("empty"), new ResourceLocation("empty"),
@@ -316,11 +320,12 @@ public class FeatureGenerator
) )
)); ));
put("bastion_remnant_bridge", spawnCustomStructure( put("bastion_remnant_bridge", spawnCustomStructure(
new JigsawStructure( new JigsawStructure( new Structure.StructureSettings(
BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT),
Map.of(), Map.of(),
GenerationStep.Decoration.SURFACE_STRUCTURES, GenerationStep.Decoration.SURFACE_STRUCTURES,
false, TerrainAdjustment.NONE
),
Holder.direct(new StructureTemplatePool( Holder.direct(new StructureTemplatePool(
new ResourceLocation("bastion/starts"), new ResourceLocation("bastion/starts"),
new ResourceLocation("empty"), new ResourceLocation("empty"),
@@ -107,9 +107,9 @@ public class EntityPlayerMPFake extends ServerPlayer
} }
@Override @Override
protected void equipEventAndSound(ItemStack stack) protected void equipEventAndSound(ItemStack stack, boolean sendGameEvent)
{ {
if (!isUsingItem()) super.equipEventAndSound(stack); if (!isUsingItem()) super.equipEventAndSound(stack, sendGameEvent);
} }
@Override @Override
@@ -12,14 +12,20 @@ import carpet.script.value.StringValue;
import carpet.script.value.Value; import carpet.script.value.Value;
import carpet.utils.SpawnReporter; import carpet.utils.SpawnReporter;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.NaturalSpawner; import net.minecraft.world.level.NaturalSpawner;
public class Monitoring { public class Monitoring {
private static final Map<String, MobCategory> MOB_CATEGORY_MAP = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(MobCategory::getName, Function.identity()));
public static void apply(Expression expression) public static void apply(Expression expression)
{ {
@@ -62,7 +68,7 @@ public class Monitoring {
return MapValue.wrap(retDict); return MapValue.wrap(retDict);
} }
String catString = lv.get(0).getString(); String catString = lv.get(0).getString();
MobCategory cat = MobCategory.byName(catString.toLowerCase(Locale.ROOT)); MobCategory cat = MOB_CATEGORY_MAP.get(catString.toLowerCase(Locale.ROOT));
if (cat == null) throw new InternalExpressionException("Unreconized mob category: "+catString); if (cat == null) throw new InternalExpressionException("Unreconized mob category: "+catString);
return ListValue.of( return ListValue.of(
new NumericValue(mobcounts.getInt(cat)), new NumericValue(mobcounts.getInt(cat)),