Aquaculture 2

Aquaculture 2

95M Downloads

Threading issues and other problems

diesieben07 opened this issue · 1 comments

commented

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.

commented

Sorry for the late response, I´ve been extremely busy the last couple of months!
I´ll take look at this, as soon as I can get JEI to load as a dependencie again.