Proper List#toArray array initialization

This commit is contained in:
Felix Cravic 2020-05-25 12:25:39 +02:00
parent 2fdebae7e5
commit 6254ec93e9
5 changed files with 8 additions and 8 deletions

View File

@ -135,7 +135,7 @@ public class CommandManager {
nodes.add(rootNode);
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[nodes.size()]);
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[0]);
declareCommandsPacket.rootIndex = nodes.size() - 1;
return declareCommandsPacket;
@ -185,7 +185,7 @@ public class CommandManager {
nodes.add(rootNode);
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[nodes.size()]);
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[0]);
declareCommandsPacket.rootIndex = nodes.size() - 1;
}

View File

@ -224,7 +224,7 @@ public class Player extends LivingEntity {
recipesIdentifier.add(recipe.getRecipeId());
}
if (!recipesIdentifier.isEmpty()) {
String[] identifiers = recipesIdentifier.toArray(new String[recipesIdentifier.size()]);
String[] identifiers = recipesIdentifier.toArray(new String[0]);
UnlockRecipesPacket unlockRecipesPacket = new UnlockRecipesPacket();
unlockRecipesPacket.mode = 0;
unlockRecipesPacket.recipesId = identifiers;

View File

@ -33,7 +33,7 @@ public class StatusListener {
statisticList.add(statistic);
}
statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[statisticList.size()]);
statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[0]);
player.getPlayerConnection().sendPacket(statisticsPacket);
break;

View File

@ -48,7 +48,7 @@ public class RecipeManager {
packetRecipe.group = recipe.getGroup();
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
List<DeclareRecipesPacket.Ingredient> ingredients = shapelessRecipe.getIngredients();
packetRecipe.ingredients = ingredients.toArray(new DeclareRecipesPacket.Ingredient[ingredients.size()]);
packetRecipe.ingredients = ingredients.toArray(new DeclareRecipesPacket.Ingredient[0]);
packetRecipe.result = shapelessRecipe.getResult();
break;
case SHAPED:
@ -56,7 +56,7 @@ public class RecipeManager {
packetRecipe.group = recipe.getGroup();
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
List<DeclareRecipesPacket.Ingredient> ingredients2 = shapedRecipe.getIngredients();
packetRecipe.ingredients = ingredients2.toArray(new DeclareRecipesPacket.Ingredient[ingredients2.size()]);
packetRecipe.ingredients = ingredients2.toArray(new DeclareRecipesPacket.Ingredient[0]);
packetRecipe.result = shapedRecipe.getResult();
break;
case SMELTING:
@ -75,7 +75,7 @@ public class RecipeManager {
recipesCache.add(packetRecipe);
}
declareRecipesPacket.recipes = recipesCache.toArray(new DeclareRecipesPacket.Recipe[recipesCache.size()]);
declareRecipesPacket.recipes = recipesCache.toArray(new DeclareRecipesPacket.Recipe[0]);
}
}

View File

@ -58,7 +58,7 @@ public class RegistryMain {
for (RegistryBlock.BlockState blockState : registryBlock.states) {
short id = blockState.id;
String[] properties = blockState.propertiesValues.toArray(new String[blockState.propertiesValues.size()]);
String[] properties = blockState.propertiesValues.toArray(new String[0]);
Block.BlockAlternative blockAlternative = new Block.BlockAlternative(id, properties);
block.addBlockAlternative(blockAlternative);