AzureDoom / MCDoom

Inefficient use of toArray with non-zero sized array argument JAVA-P0335
Performance
Major
2 years ago2 years old
result is less efficient than using a zero sized array here
27		weapon_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 3, DoomItems.ENERGY_CELLS, 6, 12, 5));
28		weapon_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 3, DoomItems.UNMAKRY_BOLT, 6, 12, 5));
29		TradeOffers.PROFESSION_TO_LEVELED_TRADE.get(VillagerProfession.WEAPONSMITH).put(3,
30				weapon_trades.toArray(result));31		}
32
33		if (DoomConfig.enable_toolsmith_trades) {
result is less efficient than using a zero sized array here
73		block_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 2, DoomBlocks.E1M1_25.asItem(), 1, 12, 5));
74		block_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 2, DoomBlocks.E1M1_26.asItem(), 1, 12, 5));
75		TradeOffers.PROFESSION_TO_LEVELED_TRADE.get(VillagerProfession.MASON).put(3,
76				block_trades.toArray(result));77		}
78	}
79}
result is less efficient than using a zero sized array here
39		tool_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 2, DoomItems.ARGENT_HOE, 1, 12, 5));
40		tool_trades.add(new TradeOffers.ProcessItemFactory(Items.EMERALD, 2, DoomItems.ARGENT_SHOVEL, 1, 12, 5));
41		TradeOffers.PROFESSION_TO_LEVELED_TRADE.get(VillagerProfession.TOOLSMITH).put(3,
42				tool_trades.toArray(result));43		}
44
45		if (DoomConfig.enable_mason_trades) {