Resolve raw type warnings (#1516)

Also very small optimization to hopper counters and removal of redundant casts in `PerimeterDiagnostics`
This commit is contained in:
altrisi authored and GitHub committed 2022-07-29 13:12:09 +02:00
1 parent be3c7f267c
commit 8f7e45387e
7 files changed
+17 -17

No files matched your search

@@ -406,6 +406,6 @@ public class HopperCounter
*/ */
public long getTotalItems() public long getTotalItems()
{ {
return counter.isEmpty()?0:counter.values().stream().mapToLong(Long::longValue).sum(); return counter.isEmpty()?0:counter.values().longStream().sum();
} }
} }
@@ -32,7 +32,7 @@ public class BoundTickingBlockEntity_tickMixin<T extends BlockEntity>
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/level/block/entity/BlockEntityTicker;tick(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)V" target = "Lnet/minecraft/world/level/block/entity/BlockEntityTicker;tick(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)V"
)) ))
private void checkProcessTEs(BlockEntityTicker blockEntityTicker, Level world, BlockPos pos, BlockState state, T blockEntity) private void checkProcessBEs(BlockEntityTicker<T> blockEntityTicker, Level world, BlockPos pos, BlockState state, T blockEntity)
{ {
if (TickSpeed.process_entities) blockEntityTicker.tick(world, pos, state, blockEntity); if (TickSpeed.process_entities) blockEntityTicker.tick(world, pos, state, blockEntity);
} }
@@ -82,8 +82,8 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock
@Inject(method = "moveBlocks", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, @Inject(method = "moveBlocks", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
target = "Ljava/util/List;size()I", ordinal = 4),locals = LocalCapture.CAPTURE_FAILHARD) target = "Ljava/util/List;size()I", ordinal = 4),locals = LocalCapture.CAPTURE_FAILHARD)
private void onMove(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, private void onMove(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1,
CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map map_1, CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map<?, ?> map_1,
List<BlockPos> list_1, List<BlockState> list_2, List list_3, BlockState[] blockStates_1, List<BlockPos> list_1, List<BlockState> list_2, List<?> list_3, BlockState[] blockStates_1,
Direction direction_2, int int_2) Direction direction_2, int int_2)
{ {
//Get the blockEntities and remove them from the world before any magic starts to happen //Get the blockEntities and remove them from the world before any magic starts to happen
@@ -110,11 +110,11 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock
target = "Lnet/minecraft/world/level/Level;setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", ordinal = 0), target = "Lnet/minecraft/world/level/Level;setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", ordinal = 0),
locals = LocalCapture.CAPTURE_FAILHARD) locals = LocalCapture.CAPTURE_FAILHARD)
private void setBlockEntityWithCarried(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, private void setBlockEntityWithCarried(Level world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1,
CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map map_1, List list_1, CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonStructureResolver pistonHandler_1, Map<?, ?> map_1, List<?> list_1,
List list_2, List list_3, BlockState[] blockStates_1, Direction direction_2, int int_2, List<BlockState> list_2, List<?> list_3, BlockState[] blockStates_1, Direction direction_2, int int_2,
int int_3, BlockPos blockPos_4, BlockState blockState9, BlockState blockState4) int int_3, BlockPos blockPos_4, BlockState blockState9, BlockState blockState4)
{ {
BlockEntity blockEntityPiston = MovingPistonBlock.newMovingBlockEntity(blockPos_4, blockState4, (BlockState) list_2.get(int_3), BlockEntity blockEntityPiston = MovingPistonBlock.newMovingBlockEntity(blockPos_4, blockState4, list_2.get(int_3),
direction_1, boolean_1, false); direction_1, boolean_1, false);
if (CarpetSettings.movableBlockEntities) if (CarpetSettings.movableBlockEntities)
((PistonBlockEntityInterface) blockEntityPiston).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3)); ((PistonBlockEntityInterface) blockEntityPiston).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3));
@@ -373,7 +373,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
if (t instanceof CollectionTag) if (t instanceof CollectionTag)
{ {
List<Value> elems = new ArrayList<>(); List<Value> elems = new ArrayList<>();
CollectionTag<? extends Tag> ltag = (CollectionTag<? extends Tag>)t; CollectionTag<?> ltag = (CollectionTag<?>)t;
for (Tag elem: ltag) for (Tag elem: ltag)
{ {
elems.add(decodeTagDeep(elem)); elems.add(decodeTagDeep(elem));
@@ -274,7 +274,7 @@ public class ValueConversions
} }
if (v instanceof Set) if (v instanceof Set)
{ {
v = new ArrayList(((Set) v)); v = new ArrayList<>(((Set<?>) v));
} }
if (v instanceof List<?> l) if (v instanceof List<?> l)
{ {
@@ -85,7 +85,7 @@ public class PerimeterDiagnostics
} }
} }
PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el); PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el);
EntityType type = EntityType.ZOMBIE; EntityType<?> type = EntityType.ZOMBIE;
if (el != null) type = el.getType(); if (el != null) type = el.getType();
int minY = worldserver.getMinBuildHeight(); int minY = worldserver.getMinBuildHeight();
int maxY = worldserver.getMaxBuildHeight(); int maxY = worldserver.getMaxBuildHeight();
@@ -180,7 +180,7 @@ public class PerimeterDiagnostics
if (NaturalSpawner.isSpawnPositionOk(spt, worldServer, pos, sle.type)) if (NaturalSpawner.isSpawnPositionOk(spt, worldServer, pos, sle.type))
{ {
el.moveTo((float)pos.getX() + 0.5F, (float)pos.getY(), (float)pos.getZ()+0.5F, 0.0F, 0.0F); el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F);
return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, MobSpawnType.NATURAL) && return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, MobSpawnType.NATURAL) &&
SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), MobSpawnType.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) && SpawnPlacements.checkSpawnRules(el.getType(),(ServerLevel)el.getCommandSenderWorld(), MobSpawnType.NATURAL, el.blockPosition(), el.getCommandSenderWorld().random) &&
worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1 worldServer.noCollision(el); // check collision rules once they stop fiddling with them after 1.14.1
@@ -52,7 +52,7 @@ public class SpawnReporter
public static Long track_spawns = 0L; public static Long track_spawns = 0L;
public static final HashMap<ResourceKey<Level>, Integer> chunkCounts = new HashMap<>(); public static final HashMap<ResourceKey<Level>, Integer> chunkCounts = new HashMap<>();
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Object2LongMap<EntityType>> spawn_stats = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Object2LongMap<EntityType<?>>> spawn_stats = new HashMap<>();
public static double mobcap_exponent = 0.0D; public static double mobcap_exponent = 0.0D;
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_attempts = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_attempts = new HashMap<>();
@@ -62,7 +62,7 @@ public class SpawnReporter
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_ticks_succ = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_ticks_succ = new HashMap<>();
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_ticks_spawns = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_ticks_spawns = new HashMap<>();
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_cap_count = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, Long> spawn_cap_count = new HashMap<>();
public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, EvictingQueue<Pair<EntityType, BlockPos>>> spawned_mobs = new HashMap<>(); public static final HashMap<Pair<ResourceKey<Level>, MobCategory>, EvictingQueue<Pair<EntityType<?>, BlockPos>>> spawned_mobs = new HashMap<>();
public static final HashMap<MobCategory, Integer> spawn_tries = new HashMap<>(); public static final HashMap<MobCategory, Integer> spawn_tries = new HashMap<>();
public static BlockPos lower_spawning_limit = null; public static BlockPos lower_spawning_limit = null;
public static BlockPos upper_spawning_limit = null; public static BlockPos upper_spawning_limit = null;
@@ -170,7 +170,7 @@ public class SpawnReporter
String type_code = creature_type.getName(); String type_code = creature_type.getName();
lst.add(Messenger.s(String.format("Recent %s spawns:",type_code))); lst.add(Messenger.s(String.format("Recent %s spawns:",type_code)));
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.dimension(), creature_type)).keySet()) // getDImTYpe for (Pair<EntityType<?>, BlockPos> pair : spawned_mobs.get(Pair.of(world.dimension(), creature_type)).keySet()) // getDImTYpe
{ {
lst.add( Messenger.c( lst.add( Messenger.c(
"w - ", "w - ",
@@ -291,7 +291,7 @@ public class SpawnReporter
if (!all && persistent) if (!all && persistent)
continue; continue;
EntityType type = entity.getType(); EntityType<?> type = entity.getType();
BlockPos pos = entity.blockPosition(); BlockPos pos = entity.blockPosition();
lst.add( Messenger.c( lst.add( Messenger.c(
"w - ", "w - ",
@@ -387,7 +387,7 @@ public class SpawnReporter
(100.0D*spawn_ticks_succ.get(code))/ spawn_attempts.get(code), (100.0D*spawn_ticks_succ.get(code))/ spawn_attempts.get(code),
(1.0D*spawn_ticks_spawns.get(code))/(spawn_ticks_fail.get(code)+spawn_ticks_succ.get(code)) (1.0D*spawn_ticks_spawns.get(code))/(spawn_ticks_fail.get(code)+spawn_ticks_succ.get(code))
))); )));
for (EntityType type: spawn_stats.get(code).keySet()) for (EntityType<?> type: spawn_stats.get(code).keySet())
{ {
report.add(Messenger.s(String.format(" - %s: %d spawns, %d per hour", report.add(Messenger.s(String.format(" - %s: %d spawns, %d per hour",
type.getDescription().getString(), type.getDescription().getString(),
@@ -559,4 +559,4 @@ public class SpawnReporter
} }
return rep; return rep;
} }
} }