mappings
This commit is contained in:
1 parent
566515d0c3
commit
ae0975d626
20 files changed
+130
-134
No files matched your search
@@ -13,7 +13,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import net.minecraft.command.arguments.BlockPosArgumentType;
|
||||
import net.minecraft.command.arguments.DimensionArgumentType;
|
||||
import net.minecraft.entity.EntityCategory;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.util.DyeColor;
|
||||
@@ -57,7 +57,7 @@ public class SpawnCommand
|
||||
then(literal("stop").
|
||||
executes( (c) -> stopTracking(c.getSource()))).
|
||||
then(argument("type", word()).
|
||||
suggests( (c, b) -> suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName),b)).
|
||||
suggests( (c, b) -> suggestMatching(Arrays.stream(SpawnGroup.values()).map(SpawnGroup::getName),b)).
|
||||
executes( (c) -> recentSpawnsForType(c.getSource(), getString(c, "type"))))).
|
||||
then(literal("test").
|
||||
executes( (c)-> runTest(c.getSource(), 72000, null)).
|
||||
@@ -80,7 +80,7 @@ public class SpawnCommand
|
||||
then(literal("reset").
|
||||
executes( (c) -> resetSpawnRates(c.getSource()))).
|
||||
then(argument("type", word()).
|
||||
suggests( (c, b) -> suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName),b)).
|
||||
suggests( (c, b) -> suggestMatching(Arrays.stream(SpawnGroup.values()).map(SpawnGroup::getName),b)).
|
||||
then(argument("rounds", integer(0)).
|
||||
suggests( (c, b) -> suggestMatching(new String[]{"1"},b)).
|
||||
executes( (c) -> setSpawnRates(
|
||||
@@ -97,19 +97,19 @@ public class SpawnCommand
|
||||
then(literal("entities").
|
||||
executes( (c) -> generalMobcaps(c.getSource()) ).
|
||||
then(argument("type", string()).
|
||||
suggests( (c, b)->suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName), b)).
|
||||
suggests( (c, b)->suggestMatching(Arrays.stream(SpawnGroup.values()).map(SpawnGroup::getName), b)).
|
||||
executes( (c) -> listEntitiesOfType(c.getSource(), getString(c, "type")))));
|
||||
|
||||
dispatcher.register(literalargumentbuilder);
|
||||
}
|
||||
|
||||
private static EntityCategory getCategory(String string) throws CommandSyntaxException
|
||||
private static SpawnGroup getCategory(String string) throws CommandSyntaxException
|
||||
{
|
||||
if (!Arrays.stream(EntityCategory.values()).map(EntityCategory::getName).collect(Collectors.toSet()).contains(string))
|
||||
if (!Arrays.stream(SpawnGroup.values()).map(SpawnGroup::getName).collect(Collectors.toSet()).contains(string))
|
||||
{
|
||||
throw new SimpleCommandExceptionType(Messenger.c("r Wrong mob type: "+string+" should be "+ Arrays.stream(EntityCategory.values()).map(EntityCategory::getName).collect(Collectors.joining(", ")))).create();
|
||||
throw new SimpleCommandExceptionType(Messenger.c("r Wrong mob type: "+string+" should be "+ Arrays.stream(SpawnGroup.values()).map(SpawnGroup::getName).collect(Collectors.joining(", ")))).create();
|
||||
}
|
||||
return EntityCategory.valueOf(string.toUpperCase());
|
||||
return SpawnGroup.valueOf(string.toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class SpawnCommand
|
||||
|
||||
private static int recentSpawnsForType(ServerCommandSource source, String mob_type) throws CommandSyntaxException
|
||||
{
|
||||
EntityCategory cat = getCategory(mob_type);
|
||||
SpawnGroup cat = getCategory(mob_type);
|
||||
Messenger.send(source, SpawnReporter.recent_spawns(source.getWorld(), cat));
|
||||
return 1;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class SpawnCommand
|
||||
|
||||
private static int resetSpawnRates(ServerCommandSource source)
|
||||
{
|
||||
for (EntityCategory s: SpawnReporter.spawn_tries.keySet())
|
||||
for (SpawnGroup s: SpawnReporter.spawn_tries.keySet())
|
||||
{
|
||||
SpawnReporter.spawn_tries.put(s,1);
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public class SpawnCommand
|
||||
|
||||
private static int setSpawnRates(ServerCommandSource source, String mobtype, int rounds) throws CommandSyntaxException
|
||||
{
|
||||
EntityCategory cat = getCategory(mobtype);
|
||||
SpawnGroup cat = getCategory(mobtype);
|
||||
SpawnReporter.spawn_tries.put(cat, rounds);
|
||||
Messenger.m(source, "gi "+mobtype+" mobs will now spawn "+rounds+" times per tick");
|
||||
return 1;
|
||||
@@ -250,7 +250,7 @@ public class SpawnCommand
|
||||
|
||||
private static int setMobcaps(ServerCommandSource source, int hostile_cap)
|
||||
{
|
||||
double desired_ratio = (double)hostile_cap/ EntityCategory.MONSTER.getSpawnCap();
|
||||
double desired_ratio = (double)hostile_cap/ SpawnGroup.MONSTER.getCapacity();
|
||||
SpawnReporter.mobcap_exponent = 4.0*Math.log(desired_ratio)/Math.log(2.0);
|
||||
Messenger.m(source, String.format("gi Mobcaps for hostile mobs changed to %d, other groups will follow", hostile_cap));
|
||||
return 1;
|
||||
@@ -264,7 +264,7 @@ public class SpawnCommand
|
||||
|
||||
private static int listEntitiesOfType(ServerCommandSource source, String mobtype) throws CommandSyntaxException
|
||||
{
|
||||
EntityCategory cat = getCategory(mobtype);
|
||||
SpawnGroup cat = getCategory(mobtype);
|
||||
Messenger.send(source, SpawnReporter.printEntitiesByType(cat, source.getWorld()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user