|
AquaEntities.setSpawnPlacement(); |
|
WormFarmBlock.addCompostables(); |
Both ComposterBlock.COMPOSTABLES as well SpawnPlacements.register are not threadsafe and thus must be used within enqueueWork.
This causes crashes such as reported here.
|
public static void addCatBreeding() { |
|
try { |
|
Ingredient catBreedingItems = Cat.TEMPT_INGREDIENT; |
|
Ingredient ocelotBreedingItems = Ocelot.TEMPT_INGREDIENT; |
|
List<ItemStack> aquaFish = new ArrayList<>(); |
|
fishEntities.forEach(f -> aquaFish.add(new ItemStack(ForgeRegistries.ITEMS.getValue(f.getRegistryName())))); |
|
aquaFish.removeIf(p -> p.getItem().equals(AquaItems.JELLYFISH)); |
|
|
|
Cat.TEMPT_INGREDIENT = StackHelper.mergeIngredient(catBreedingItems, StackHelper.ingredientFromStackList(aquaFish)); |
|
Ocelot.TEMPT_INGREDIENT = StackHelper.mergeIngredient(ocelotBreedingItems, StackHelper.ingredientFromStackList(aquaFish)); |
|
} catch (Throwable t) { |
|
t.printStackTrace(); |
|
} |
|
} |
This code is also not threadsafe and the exception handling is terrible.
While going through the code I also found that the entire registration code (for blocks, items and similar) is broken. Please refer to the documentation.