20w21a ohboi

This commit is contained in:
gnembon committed 2020-05-21 02:59:17 -03:00
1 parent 838211edba
commit bec5259216
40 files changed
+445 -347

No files matched your search

+1 -1
View File
@@ -175,7 +175,7 @@ public class BlockInfo
Material material = state.getMaterial();
Block block = state.getBlock();
String metastring = "";
for (net.minecraft.state.property.Property<?> iproperty : state.getProperties())
for (net.minecraft.state.property.Property<?> iproperty : state.method_28501())// getProperties())
{
metastring += ", "+iproperty.getName() + '='+state.get(iproperty);
}
@@ -56,15 +56,15 @@ public class CarpetProfiler
private static String getSectionString(World world, String section)
{
return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""),
section,
world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
section, // ^ getDImension getId
world.isClient ? " (Client)" : "");
}
private static String getEntityString(World world, Entity e)
{
return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""),
world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
Registry.ENTITY_TYPE.getId(e.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : "");
}
@@ -72,7 +72,7 @@ public class CarpetProfiler
private static String getTEntityString(World world, BlockEntity be)
{
return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""),
world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
Registry.BLOCK_ENTITY_TYPE.getId(be.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : "");
}
@@ -5,6 +5,7 @@ import carpet.helpers.TickSpeed;
import carpet.logging.LoggerRegistry;
import carpet.logging.logHelpers.PacketCounter;
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
import net.minecraft.class_5321;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.network.packet.s2c.play.PlayerListHeaderS2CPacket;
@@ -58,17 +59,17 @@ public class HUDController
if (LoggerRegistry.__mobcaps)
LoggerRegistry.getLogger("mobcaps").log((option, player) -> {
DimensionType dim = player.dimension;
class_5321<DimensionType> dim = player.world.method_27983(); //getDimType
switch (option)
{
case "overworld":
dim = DimensionType.OVERWORLD;
dim = DimensionType.field_24753; // OW
break;
case "nether":
dim = DimensionType.THE_NETHER;
dim = DimensionType.field_24754; // nrther
break;
case "end":
dim = DimensionType.THE_END;
dim = DimensionType.field_24755; // end
break;
}
return new BaseText[]{SpawnReporter.printMobcapsForDimension(server.getWorld(dim), false).get(0)};
+8 -7
View File
@@ -9,6 +9,7 @@ import net.minecraft.text.HoverEvent;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.TextColor;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.Formatting;
@@ -251,11 +252,11 @@ public class Messenger
//message source
public static void m(ServerCommandSource source, Object ... fields)
{
source.sendFeedback(Messenger.c(fields),source.getMinecraftServer().getWorld(DimensionType.OVERWORLD) != null);
source.sendFeedback(Messenger.c(fields),source.getMinecraftServer().getWorld(DimensionType.field_24753) != null); //OW
}
public static void m(PlayerEntity player, Object ... fields)
{
player.sendSystemMessage(Messenger.c(fields));
player.sendSystemMessage(Messenger.c(fields), Util.field_25140); //NULL UUID
}
/*
@@ -299,7 +300,7 @@ public class Messenger
public static void send(PlayerEntity player, Collection<BaseText> lines)
{
lines.forEach(player::sendSystemMessage);
lines.forEach(message -> player.sendSystemMessage(message, Util.field_25140));
}
public static void send(ServerCommandSource source, Collection<BaseText> lines)
{
@@ -311,21 +312,21 @@ public class Messenger
{
if (server == null)
LOG.error("Message not delivered: "+message);
server.sendSystemMessage(new LiteralText(message));
server.sendSystemMessage(new LiteralText(message), Util.field_25140);
BaseText txt = c("gi "+message);
for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList())
{
entityplayer.sendSystemMessage(txt);
entityplayer.sendSystemMessage(txt, Util.field_25140);
}
}
public static void print_server_message(MinecraftServer server, BaseText message)
{
if (server == null)
LOG.error("Message not delivered: "+message.getString());
server.sendSystemMessage(message);
server.sendSystemMessage(message, Util.field_25140);
for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList())
{
entityplayer.sendSystemMessage(message);
entityplayer.sendSystemMessage(message, Util.field_25140);
}
}
}
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.SpawnReason;
@@ -85,6 +86,8 @@ public class PerimeterDiagnostics
}
}
PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el);
EntityType type = EntityType.ZOMBIE;
if (el != null) type = el.getType();
for (int x = -128; x <= 128; ++x)
{
for (int z = -128; z <= 128; ++z)
@@ -128,7 +131,7 @@ public class PerimeterDiagnostics
{
Block block = iblockstate_down.getBlock();
boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
if( flag && SpawnHelper.isClearForSpawn(worldserver, pos, iblockstate, iblockstate.getFluidState()) && SpawnHelper.isClearForSpawn(worldserver, pos.up(), iblockstate_up, iblockstate_up.getFluidState()))
if( flag && SpawnHelper.isClearForSpawn(worldserver, pos, iblockstate, iblockstate.getFluidState(), type) && SpawnHelper.isClearForSpawn(worldserver, pos.up(), iblockstate_up, iblockstate_up.getFluidState(), type))
{
result.ground ++;
if (add_ground && diagnostic.check_entity_spawn(pos))
+21 -19
View File
@@ -5,6 +5,7 @@ import carpet.mixins.WeightedPickerEntryMixin;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityType;
@@ -28,6 +29,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -37,19 +39,19 @@ public class SpawnReporter
public static boolean mock_spawns = false;
public static Long track_spawns = 0L;
public static final HashMap<DimensionType, Integer> chunkCounts = new HashMap<>();
public static final HashMap<class_5321<DimensionType>, Integer> chunkCounts = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Object2LongMap<EntityType>> spawn_stats = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Object2LongMap<EntityType>> spawn_stats = new HashMap<>();
public static double mobcap_exponent = 0.0D;
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_attempts = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> overall_spawn_ticks = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_full = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_fail = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_succ = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_spawns = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_cap_count = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, EvictingQueue<Pair<EntityType, BlockPos>>> spawned_mobs = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_attempts = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> overall_spawn_ticks = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_full = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_fail = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_succ = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_spawns = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_cap_count = new HashMap<>();
public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, EvictingQueue<Pair<EntityType, BlockPos>>> spawned_mobs = new HashMap<>();
public static final HashMap<SpawnGroup, Integer> spawn_tries = new HashMap<>();
public static BlockPos lower_spawning_limit = null;
public static BlockPos upper_spawning_limit = null;
@@ -61,7 +63,7 @@ public class SpawnReporter
reset_spawn_stats(true);
}
public static void registerSpawn(DimensionType dim, MobEntity mob, SpawnGroup cat, BlockPos pos)
public static void registerSpawn(MobEntity mob, SpawnGroup cat, BlockPos pos)
{
if (lower_spawning_limit != null)
{
@@ -73,7 +75,7 @@ public class SpawnReporter
return;
}
}
Pair<DimensionType, SpawnGroup> key = Pair.of(mob.dimension, cat);
Pair<class_5321<DimensionType>, SpawnGroup> key = Pair.of(mob.world.method_27983(), cat);
long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L);
spawn_stats.get(key).put(mob.getType(), count + 1);
spawned_mobs.get(key).put(Pair.of(mob.getType(), pos));
@@ -83,7 +85,7 @@ public class SpawnReporter
public static List<BaseText> printMobcapsForDimension(ServerWorld world, boolean multiline)
{
DimensionType dim = world.getDimension().getType();
class_5321<DimensionType> dim = world.method_27983();
String name = dim.toString();
List<BaseText> lst = new ArrayList<>();
if (multiline)
@@ -147,7 +149,7 @@ public class SpawnReporter
String type_code = creature_type.getName();
lst.add(Messenger.s(String.format("Recent %s spawns:",type_code)));
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.getDimension().getType(),creature_type)).keySet())
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.method_27983(), creature_type)).keySet()) // getDImTYpe
{
lst.add( Messenger.c(
"w - ",
@@ -303,9 +305,9 @@ public class SpawnReporter
{
spawn_tries.put(enumcreaturetype, 1);
}
for (DimensionType dim : DimensionType.getAll())
for (class_5321<DimensionType> dim : Arrays.asList(DimensionType.field_24753, DimensionType.field_24754, DimensionType.field_24755))
{
Pair<DimensionType, SpawnGroup> key = Pair.of(dim, enumcreaturetype);
Pair<class_5321<DimensionType>, SpawnGroup> key = Pair.of(dim, enumcreaturetype);
overall_spawn_ticks.put(key, 0L);
spawn_attempts.put(key, 0L);
spawn_ticks_full.put(key, 0L);
@@ -343,15 +345,15 @@ public class SpawnReporter
{
//String type_code = String.format("%s", enumcreaturetype);
boolean there_are_mobs_to_list = false;
for (DimensionType dim: DimensionType.getAll()) //String world_code: new String[] {"", " (N)", " (E)"})
for (class_5321<DimensionType> dim: Arrays.asList(DimensionType.field_24753, DimensionType.field_24754, DimensionType.field_24755)) //String world_code: new String[] {"", " (N)", " (E)"})
{
Pair<DimensionType, SpawnGroup> code = Pair.of(dim, enumcreaturetype);
Pair<class_5321<DimensionType>, SpawnGroup> code = Pair.of(dim, enumcreaturetype);
if (spawn_ticks_spawns.get(code) > 0L)
{
there_are_mobs_to_list = true;
double hours = overall_spawn_ticks.get(code)/72000.0;
report.add(Messenger.s(String.format(" > %s (%.1f min), %.1f m/t, {%.1f%%F / %.1f%%- / %.1f%%+}; %.2f s/att",
code.getRight()+((code.getLeft()==DimensionType.OVERWORLD)?"":( (code.getLeft()==DimensionType.THE_NETHER)?"(N)":"(E)" )),
code.getRight()+((code.getLeft()==DimensionType.field_24753)?"":( (code.getLeft()==DimensionType.field_24754)?"(N)":"(E)" )), // OW, nether
60*hours,
(1.0D*spawn_cap_count.get(code))/ spawn_attempts.get(code),
(100.0D*spawn_ticks_full.get(code))/ spawn_attempts.get(code),