mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 00:17:58 +01:00
Proper List#toArray array initialization
This commit is contained in:
parent
2fdebae7e5
commit
6254ec93e9
@ -135,7 +135,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
nodes.add(rootNode);
|
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;
|
declareCommandsPacket.rootIndex = nodes.size() - 1;
|
||||||
|
|
||||||
return declareCommandsPacket;
|
return declareCommandsPacket;
|
||||||
@ -185,7 +185,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
nodes.add(rootNode);
|
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;
|
declareCommandsPacket.rootIndex = nodes.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ public class Player extends LivingEntity {
|
|||||||
recipesIdentifier.add(recipe.getRecipeId());
|
recipesIdentifier.add(recipe.getRecipeId());
|
||||||
}
|
}
|
||||||
if (!recipesIdentifier.isEmpty()) {
|
if (!recipesIdentifier.isEmpty()) {
|
||||||
String[] identifiers = recipesIdentifier.toArray(new String[recipesIdentifier.size()]);
|
String[] identifiers = recipesIdentifier.toArray(new String[0]);
|
||||||
UnlockRecipesPacket unlockRecipesPacket = new UnlockRecipesPacket();
|
UnlockRecipesPacket unlockRecipesPacket = new UnlockRecipesPacket();
|
||||||
unlockRecipesPacket.mode = 0;
|
unlockRecipesPacket.mode = 0;
|
||||||
unlockRecipesPacket.recipesId = identifiers;
|
unlockRecipesPacket.recipesId = identifiers;
|
||||||
|
@ -33,7 +33,7 @@ public class StatusListener {
|
|||||||
statisticList.add(statistic);
|
statisticList.add(statistic);
|
||||||
}
|
}
|
||||||
|
|
||||||
statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[statisticList.size()]);
|
statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[0]);
|
||||||
|
|
||||||
player.getPlayerConnection().sendPacket(statisticsPacket);
|
player.getPlayerConnection().sendPacket(statisticsPacket);
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@ public class RecipeManager {
|
|||||||
packetRecipe.group = recipe.getGroup();
|
packetRecipe.group = recipe.getGroup();
|
||||||
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
|
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
|
||||||
List<DeclareRecipesPacket.Ingredient> ingredients = shapelessRecipe.getIngredients();
|
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();
|
packetRecipe.result = shapelessRecipe.getResult();
|
||||||
break;
|
break;
|
||||||
case SHAPED:
|
case SHAPED:
|
||||||
@ -56,7 +56,7 @@ public class RecipeManager {
|
|||||||
packetRecipe.group = recipe.getGroup();
|
packetRecipe.group = recipe.getGroup();
|
||||||
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
|
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
|
||||||
List<DeclareRecipesPacket.Ingredient> ingredients2 = shapedRecipe.getIngredients();
|
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();
|
packetRecipe.result = shapedRecipe.getResult();
|
||||||
break;
|
break;
|
||||||
case SMELTING:
|
case SMELTING:
|
||||||
@ -75,7 +75,7 @@ public class RecipeManager {
|
|||||||
recipesCache.add(packetRecipe);
|
recipesCache.add(packetRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
declareRecipesPacket.recipes = recipesCache.toArray(new DeclareRecipesPacket.Recipe[recipesCache.size()]);
|
declareRecipesPacket.recipes = recipesCache.toArray(new DeclareRecipesPacket.Recipe[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class RegistryMain {
|
|||||||
|
|
||||||
for (RegistryBlock.BlockState blockState : registryBlock.states) {
|
for (RegistryBlock.BlockState blockState : registryBlock.states) {
|
||||||
short id = blockState.id;
|
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.BlockAlternative blockAlternative = new Block.BlockAlternative(id, properties);
|
||||||
|
|
||||||
block.addBlockAlternative(blockAlternative);
|
block.addBlockAlternative(blockAlternative);
|
||||||
|
Loading…
Reference in New Issue
Block a user