Fix some bugs when logging into world

This commit is contained in:
Vincent Lee committed 2020-06-28 16:49:42 -05:00
1 parent 23f3213daf
commit 18359eb58e
6 files changed
+22 -16

No files matched your search

@@ -236,6 +236,7 @@ public class Botania {
.func_233813_a_());
ModBanners.init();
ColorHelper.init();
ModLootModifiers.init();
PatchouliAPI.instance.registerMultiblock(Registry.BLOCK.getKey(ModBlocks.alfPortal), TileAlfPortal.MULTIBLOCK.getValue());
PatchouliAPI.instance.registerMultiblock(Registry.BLOCK.getKey(ModBlocks.terraPlate), TileTerraPlate.MULTIBLOCK.getValue());
@@ -8,6 +8,7 @@
*/
package vazkii.botania.common.crafting;
import com.google.common.collect.ImmutableSet;
import com.google.gson.JsonObject;
import net.minecraft.block.Block;
@@ -27,7 +28,7 @@ public class StateIngredientTag extends StateIngredientBlocks {
private final ITag.INamedTag<Block> tag;
public StateIngredientTag(ITag.INamedTag<Block> tag) {
super(tag.func_230236_b_());
super(ImmutableSet.of());
this.tag = tag;
}
@@ -14,6 +14,7 @@ import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.SpecialRecipe;
import net.minecraft.item.crafting.SpecialRecipeSerializer;
import net.minecraft.util.LazyValue;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.Tags;
@@ -30,7 +31,7 @@ import java.util.List;
public class LensDyeingRecipe extends SpecialRecipe {
public static final SpecialRecipeSerializer<LensDyeingRecipe> SERIALIZER = new SpecialRecipeSerializer<>(LensDyeingRecipe::new);
private final List<Ingredient> dyes = Arrays.asList(
private final LazyValue<List<Ingredient>> dyes = new LazyValue<>(() -> Arrays.asList(
Ingredient.fromTag(Tags.Items.DYES_WHITE), Ingredient.fromTag(Tags.Items.DYES_ORANGE),
Ingredient.fromTag(Tags.Items.DYES_MAGENTA), Ingredient.fromTag(Tags.Items.DYES_LIGHT_BLUE),
Ingredient.fromTag(Tags.Items.DYES_YELLOW), Ingredient.fromTag(Tags.Items.DYES_LIME),
@@ -40,7 +41,7 @@ public class LensDyeingRecipe extends SpecialRecipe {
Ingredient.fromTag(Tags.Items.DYES_BROWN), Ingredient.fromTag(Tags.Items.DYES_GREEN),
Ingredient.fromTag(Tags.Items.DYES_RED), Ingredient.fromTag(Tags.Items.DYES_BLACK),
Ingredient.fromItems(ModItems.manaPearl)
);
));
public LensDyeingRecipe(ResourceLocation id) {
super(id);
@@ -111,6 +112,7 @@ public class LensDyeingRecipe extends SpecialRecipe {
}
private int getStackColor(ItemStack stack) {
List<Ingredient> dyes = this.dyes.getValue();
for (int i = 0; i < dyes.size(); i++) {
if (dyes.get(i).test(stack)) {
return i;
@@ -48,12 +48,14 @@ public class ItemBlockSpecialFlower extends BlockItem {
public void addInformation(@Nonnull ItemStack stack, World world, @Nonnull List<ITextComponent> tooltip, @Nonnull ITooltipFlag flag) {
// Prevent crash when tooltips queried before configs load
if (Botania.finishedLoading) {
if (GENERATING.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.generating").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
} else if (FUNCTIONAL.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.functional").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
} else if (MISC.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.misc").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
if (world != null) {
if (GENERATING.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.generating").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
} else if (FUNCTIONAL.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.functional").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
} else if (MISC.func_230235_a_(this)) {
tooltip.add(new TranslationTextComponent("botania.flowerType.misc").func_240701_a_(TextFormatting.ITALIC, TextFormatting.BLUE));
}
}
if (ConfigHandler.CLIENT.referencesEnabled.get()) {