First pass of crash and bug fixes. Runs surprisingly well

This commit is contained in:
Vincent Lee committed 2020-01-15 23:09:54 -06:00
1 parent fa325cefdf
commit a8d2139d61
5 files changed
+18 -12

No files matched your search

@@ -11,6 +11,8 @@
package vazkii.botania.client.core.proxy;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.FlowerBlock;
import net.minecraft.block.TallFlowerBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
@@ -47,9 +49,13 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockModDoubleFlower;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.block.BlockSpecialFlower;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.BlockShinyFlower;
import vazkii.botania.common.block.decor.panes.BlockModPane;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
@@ -132,6 +138,7 @@ public class ClientProxy implements IProxy {
RenderTypeLookup.setRenderLayer(ModBlocks.taigaAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.mesaAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.mossyAltar, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.ghostRail, RenderType.getCutout());
RenderTypeLookup.setRenderLayer(ModBlocks.manaGlass, RenderType.getTranslucent());
RenderTypeLookup.setRenderLayer(ModFluffBlocks.managlassPane, RenderType.getTranslucent());
@@ -149,7 +156,7 @@ public class ClientProxy implements IProxy {
Registry.BLOCK.stream().filter(b -> b.getRegistryName().getNamespace().equals(LibMisc.MOD_ID))
.forEach(b -> {
if (b instanceof BlockFloatingFlower)
if (b instanceof BlockFloatingFlower || b instanceof FlowerBlock || b instanceof TallFlowerBlock)
RenderTypeLookup.setRenderLayer(b, RenderType.getCutout());
});
}
@@ -52,10 +52,6 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
ms.push();
if (pool == null) { // A null pool means we are calling the TESR without a pool (on a minecart). Adjust accordingly
ms.translate(0, 0, -1);
}
boolean fab = pool != null && ((BlockPool) pool.getBlockState().getBlock()).variant == BlockPool.Variant.FABULOUS;
if (fab) {
@@ -68,7 +64,7 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
int blue = color & 0xFF;
BlockState state = pool.getBlockState();
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModel(state);
IVertexBuilder buffer = buffers.getBuffer(RenderTypeLookup.getBlockLayer(state));
IVertexBuilder buffer = buffers.getBuffer(RenderTypeLookup.getEntityBlockLayer(state));
Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer()
.render(ms.peek(), buffer, state, model, red / 255F, green / 255F, blue / 255F, light, overlay);
}
@@ -22,6 +22,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.util.LazyValue;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
@@ -132,13 +133,13 @@ public class RenderTilePylon extends TileEntityRenderer<TilePylon> {
}
public static class TEISR extends ItemStackTileEntityRenderer {
private static final TilePylon DUMMY = new TilePylon();
private static final LazyValue<TilePylon> DUMMY = new LazyValue<>(TilePylon::new);
@Override
public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
if(Block.getBlockFromItem(stack.getItem()) instanceof BlockPylon) {
RenderTilePylon.forceVariant = ((BlockPylon) Block.getBlockFromItem(stack.getItem())).variant;
TileEntityRenderer r = TileEntityRendererDispatcher.instance.getRenderer(DUMMY);
TileEntityRenderer<TilePylon> r = TileEntityRendererDispatcher.instance.getRenderer(DUMMY.getValue());
((RenderTilePylon) r).renderPylon(null, 0, ms, buffers, light, overlay);
}
}
@@ -191,6 +191,7 @@ public class RenderTileTinyPotato extends TileEntityRenderer<TileTinyPotato> {
ms.scale(1F, -1F, -1F);
renderName(potato, name, ms, buffers, light);
ms.pop();
}
private void renderName(TileTinyPotato potato, String name, MatrixStack ms, IRenderTypeBuffer buffers, int light) {
@@ -303,6 +304,7 @@ public class RenderTileTinyPotato extends TileEntityRenderer<TileTinyPotato> {
}
ms.pop();
ms.push();
if (!name.isEmpty()) {
ContributorFancinessHandler.firstStart();
@@ -478,7 +478,7 @@ public final class ModBlocks {
register(r, new BlockMod(builder.lightValue(12)), LibBlockNames.DREAM_WOOD_GLIMMERING);
register(r, new BlockConjurationCatalyst(Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)), LibBlockNames.CONJURATION_CATALYST);
register(r, new BlockBifrost(Block.Properties.create(Material.GLASS).hardnessAndResistance(-1, 0.3F).lightValue(15).sound(SoundType.GLASS)), LibBlockNames.BIFROST);
register(r, new BlockBifrost(Block.Properties.create(Material.GLASS).hardnessAndResistance(-1, 0.3F).lightValue(15).sound(SoundType.GLASS).nonOpaque()), LibBlockNames.BIFROST);
register(r, new BlockSolidVines(Block.Properties.create(Material.TALL_PLANTS).hardnessAndResistance(0.2F).sound(SoundType.PLANT)), LibBlockNames.SOLID_VINE);
builder = Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT).lightValue(4);
@@ -502,9 +502,9 @@ public final class ModBlocks {
register(r, new BlockEnderEye(Block.Properties.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL)), LibBlockNames.ENDER_EYE_BLOCK);
register(r, new BlockStarfield(Block.Properties.create(Material.IRON).hardnessAndResistance(5, 2000).sound(SoundType.METAL)), LibBlockNames.STARFIELD);
register(r, new BlockRFGenerator(Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)), LibBlockNames.FLUXFIELD);
register(r, new BlockElfGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)), LibBlockNames.ELF_GLASS);
register(r, new BlockElfGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15).nonOpaque()), LibBlockNames.ELF_GLASS);
register(r, new BlockBrewery(Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)), LibBlockNames.BREWERY);
register(r, new GlassBlock(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)), LibBlockNames.MANA_GLASS);
register(r, new GlassBlock(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15).nonOpaque()), LibBlockNames.MANA_GLASS);
register(r, new BlockTerraPlate(Block.Properties.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL)), LibBlockNames.TERRA_PLATE);
builder = Block.Properties.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE);
@@ -560,7 +560,7 @@ public final class ModBlocks {
register(r, new BlockManaBomb(Block.Properties.create(Material.WOOD).hardnessAndResistance(12).sound(SoundType.WOOD)), LibBlockNames.MANA_BOMB);
register(r, new BlockCacophonium(Block.Properties.create(Material.WOOD).hardnessAndResistance(0.8F)), LibBlockNames.CACOPHONIUM);
register(r, new BlockBellows(Block.Properties.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD)), LibBlockNames.BELLOWS);
register(r, new BlockBifrostPerm(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).lightValue(15).sound(SoundType.GLASS)), LibBlockNames.BIFROST_PERM);
register(r, new BlockBifrostPerm(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).lightValue(15).sound(SoundType.GLASS).nonOpaque()), LibBlockNames.BIFROST_PERM);
register(r, new BlockCell(Block.Properties.create(Material.GOURD).sound(SoundType.CLOTH)), LibBlockNames.CELL_BLOCK);
register(r, new BlockGaiaHeadWall(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(1)), LibBlockNames.GAIA_WALL_HEAD);
register(r, new BlockGaiaHead(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(1)), LibBlockNames.GAIA_HEAD);