mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Fix some bugs when logging into world
This commit is contained in:
1 parent
23f3213daf
commit
18359eb58e
6 files changed
+22
-16
No files matched your search
@@ -77,7 +77,7 @@ public final class HUDHandler {
|
||||
IProfiler profiler = mc.getProfiler();
|
||||
ItemStack main = mc.player.getHeldItemMainhand();
|
||||
ItemStack offhand = mc.player.getHeldItemOffhand();
|
||||
MatrixStack ms = null; // todo 1.16 Forge moment: ms is not accessible from the event currently
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
|
||||
if (event.getType() == ElementType.ALL) {
|
||||
profiler.startSection("botania-hud");
|
||||
|
||||
@@ -86,7 +86,7 @@ public final class RenderHelper {
|
||||
TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderState.TextureState mipmapBlockAtlasTexture = new RenderState.TextureState(AtlasTexture.LOCATION_BLOCKS_TEXTURE, false, true);
|
||||
RenderState.CullState disableCull = new RenderState.CullState(false);
|
||||
RenderState.LayerState projectionLayering = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228500_J_");
|
||||
RenderState.LayerState viewOffsetZLayering = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_239235_M_");
|
||||
RenderState.WriteMaskState colorMask = new RenderState.WriteMaskState(true, false);
|
||||
RenderType.ShadeModelState smoothShade = new RenderState.ShadeModelState(true);
|
||||
RenderState.LightmapState enableLightmap = new RenderState.LightmapState(true);
|
||||
@@ -107,15 +107,15 @@ public final class RenderHelper {
|
||||
RECTANGLE = RenderType.makeType(LibResources.PREFIX_MOD + "rectangle_highlight", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, glState);
|
||||
CIRCLE = RenderType.makeType(LibResources.PREFIX_MOD + "circle_highlight", DefaultVertexFormats.POSITION_COLOR, GL11.GL_TRIANGLES, 256, false, false, glState);
|
||||
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(1))).layer(projectionLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).build(false);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(1))).layer(viewOffsetZLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).build(false);
|
||||
LINE_1 = RenderType.makeType(LibResources.PREFIX_MOD + "line_1", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 128, glState);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(1))).layer(projectionLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(1))).layer(viewOffsetZLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
LINE_1_NO_DEPTH = RenderType.makeType(LibResources.PREFIX_MOD + "line_1_no_depth", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 128, glState);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(4))).layer(projectionLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(4))).layer(viewOffsetZLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
LINE_4_NO_DEPTH = RenderType.makeType(LibResources.PREFIX_MOD + "line_4_no_depth", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 128, glState);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(5))).layer(projectionLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(5))).layer(viewOffsetZLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
LINE_5_NO_DEPTH = RenderType.makeType(LibResources.PREFIX_MOD + "line_5_no_depth", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 64, glState);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(8))).layer(projectionLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
glState = RenderType.State.getBuilder().line(new RenderState.LineState(OptionalDouble.of(8))).layer(viewOffsetZLayering).transparency(TRANSLUCENT_TRANSPARENCY).writeMask(colorMask).depthTest(noDepth).build(false);
|
||||
LINE_8_NO_DEPTH = RenderType.makeType(LibResources.PREFIX_MOD + "line_8_no_depth", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 64, glState);
|
||||
|
||||
glState = RenderType.State.getBuilder().texture(mipmapBlockAtlasTexture).transparency(TRANSLUCENT_TRANSPARENCY).alpha(new RenderState.AlphaState(0.05F)).lightmap(enableLightmap).build(true);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in new issue
Block a user