Fix sparks not rendering and solid vines not being flammable (patches from MoriyaShiine)

This commit is contained in:
Vincent Lee committed 2020-01-19 16:04:51 -06:00
1 parent 0836cee840
commit 2577de5b60
2 files changed
+13 -15

No files matched your search

@@ -11,21 +11,18 @@
package vazkii.botania.client.render.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.entity.EntitySparkBase;
import javax.annotation.Nonnull;
@@ -41,40 +38,41 @@ public abstract class RenderSparkBase<T extends EntitySparkBase> extends EntityR
@Override
public void render(@Nonnull T tEntity, float yaw, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int light) {
TextureAtlasSprite iicon = getBaseIcon(tEntity);
ms.push();
double time = ClientTickHandler.ticksInGame + partialTicks + new Random(tEntity.getEntityId()).nextInt();
float a = 0.1F + (tEntity.isInvisible() ? 0 : 1) * 0.8F;
int alpha = (int) ((0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2) * a * 255.0F);
int iconColor = 0xFFFFFF | (alpha << 24);
float scale = 0.75F + 0.1F * (float) Math.sin(time / 10);
ms.scale(scale, scale, scale);
IVertexBuilder buffer = buffers.getBuffer(RenderHelper.SPARK);
ms.push();
ms.multiply(renderManager.getRotation());
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(180));
renderIcon(ms, buffer, iicon, iconColor);
ms.push();
ms.translate(-0.02F + (float) Math.sin(time / 20) * 0.2F, 0.24F + (float) Math.cos(time / 20) * 0.2F, 0.005F);
ms.scale(0.2F, 0.2F, 0.2F);
int starColor = tEntity.getNetwork().colorValue | ((int) (a * 255.0F) << 24);
renderIcon(ms, buffer, MiscellaneousIcons.INSTANCE.corporeaIconStar, starColor);
ms.pop();
TextureAtlasSprite spinningIcon = getSpinningIcon(tEntity);
if (spinningIcon != null) {
ms.translate(-0.02F + (float) Math.sin(time / 20) * -0.2F, 0.24F + (float) Math.cos(time / 20) * -0.2F, 0.005F);
ms.scale(0.2F, 0.2F, 0.2F);
renderIcon(ms, buffer, spinningIcon, iconColor);
}
ms.pop();
renderCallback(tEntity, partialTicks, ms, buffers);
ms.pop();
}
@@ -108,7 +106,6 @@ public abstract class RenderSparkBase<T extends EntitySparkBase> extends EntityR
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
Matrix4f mat = ms.peek().getModel();
buffer.vertex(mat, 0.0F - f5, 0.0F - f6, 0.0F).color(r, g, b, a).texture(f, f3).light(fullbright).endVertex();
buffer.vertex(mat, f4 - f5, 0.0F - f6, 0.0F).color(r, g, b, a).texture(f1, f3).light(fullbright).endVertex();
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.VineBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -19,7 +20,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nonnull;
@@ -29,6 +29,7 @@ public class BlockSolidVines extends VineBlock {
public BlockSolidVines(Properties builder) {
super(builder);
((FireBlock) Blocks.FIRE).setFireInfo(this, 15, 100);
}
@Override