DutchJelly / CraftEnhance

A Minecraft Plugin that allows server owners to create custom recipes in-game
Apache License 2.0
13 stars 10 forks source link

Crafting a stack of custom items with match meta causes lag #63

Open JeffP07 opened 1 week ago

JeffP07 commented 1 week ago

Describe the bug When using custom items (created via ItemsAdder) using match_meta to craft other custom items, putting in enough ingredients to craft an entire stack causes the server to lag. For example, if there is a recipe that takes 5x "dried bamboo" with MATCH_META to create a "bamboo mat" and you place 5 stacks of "dried bamboo" in and shift-click to create a stack of "bamboo mat" the server lags. I have included a screenshot of the spark profile started and stopped just around me crafting a stack of "bamboo mat".

To Reproduce Steps to reproduce the behavior:

  1. Create recipe that uses MATCH_META with custom items
  2. Place enough items into crafting bench to craft an entire stack
  3. Shift-click to craft the entire stack

Example of a recipe using a "dried bamboo" custom item to create a "bamboo mat" custom item 180px-Wickermat

Spark profiler capturing the lag image

broken1arrow commented 1 week ago

Describe the bug When using custom items (created via ItemsAdder) using match_meta to craft other custom items, putting in enough ingredients to craft an entire stack causes the server to lag. For example, if there is a recipe that takes 5x "dried bamboo" with MATCH_META to create a "bamboo mat" and you place 5 stacks of "dried bamboo" in and shift-click to create a stack of "bamboo mat" the server lags. I have included a screenshot of the spark profile started and stopped just around me crafting a stack of "bamboo mat".

To Reproduce Steps to reproduce the behavior:

1. Create recipe that uses MATCH_META with custom items

2. Place enough items into crafting bench to craft an entire stack

3. Shift-click to craft the entire stack

That task that create the issue is outside of this plugin, what I can see in the logs. You have Array to string and then Itemstack to string and that cost when it convert it to a string. I could see if it is something in the code that make it worse.