Small Cleanup (#68)

Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
glowredmanandMartin Robertz authored and GitHub committed 2025-01-13 00:13:56 -06:00
1 parent f5a21fe41e
commit e8fb04df37
196 files changed
+887 -543

No files matched your search

@@ -45,7 +45,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
private static final String TAG_INVIS = "invis";
public static final int INVISIBILITY_DATA_WATCHER_KEY = 27;
Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap());
Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap<>());
int removeTransferants = 2;
boolean firstTick = false;
@@ -92,11 +92,11 @@ public class EntitySpark extends Entity implements ISparkEntity {
case 1 : { // Dispersive
List<EntityPlayer> players = SparkHelper.getEntitiesAround(EntityPlayer.class, worldObj, posX, posY, posZ);
Map<EntityPlayer, Map<ItemStack, Integer>> receivingPlayers = new HashMap();
Map<EntityPlayer, Map<ItemStack, Integer>> receivingPlayers = new HashMap<>();
ItemStack input = new ItemStack(ModItems.spark);
for(EntityPlayer player : players) {
List<ItemStack> stacks = new ArrayList();
List<ItemStack> stacks = new ArrayList<>();
stacks.addAll(Arrays.asList(player.inventory.mainInventory));
stacks.addAll(Arrays.asList(player.inventory.armorInventory));
stacks.addAll(Arrays.asList(PlayerHandler.getPlayerBaubles(player).stackList));
@@ -107,11 +107,11 @@ public class EntitySpark extends Entity implements ISparkEntity {
IManaItem manaItem = (IManaItem) stack.getItem();
if(manaItem.canReceiveManaFromItem(stack, input)) {
Map receivingStacks;
Map<ItemStack, Integer> receivingStacks;
boolean add = false;
if(!receivingPlayers.containsKey(player)) {
add = true;
receivingStacks = new HashMap();
receivingStacks = new HashMap<>();
} else receivingStacks = receivingPlayers.get(player);
int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(TRANSFER_RATE, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
@@ -125,7 +125,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
}
if(!receivingPlayers.isEmpty()) {
List<EntityPlayer> keys = new ArrayList(receivingPlayers.keySet());
List<EntityPlayer> keys = new ArrayList<>(receivingPlayers.keySet());
Collections.shuffle(keys);
EntityPlayer player = keys.iterator().next();
@@ -141,7 +141,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
break;
}
case 2 : { // Dominant
List<ISparkEntity> validSparks = new ArrayList();
List<ISparkEntity> validSparks = new ArrayList<>();
for(ISparkEntity spark : allSparks) {
if(spark == this)
continue;
@@ -332,7 +332,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
@Override
public Collection<ISparkEntity> getTransfers() {
Collection<ISparkEntity> removals = new ArrayList();
Collection<ISparkEntity> removals = new ArrayList<>();
for(ISparkEntity e : transfers) {
ISparkEntity spark = e;