mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-10 15:09:08 +01:00
fixed custom renderers (particles, boxes)
This commit is contained in:
parent
76e8fa9008
commit
0ac27ff2bb
2 changed files with 13 additions and 23 deletions
|
@ -27,6 +27,7 @@ import net.minecraft.client.MainWindow;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
@ -36,10 +37,7 @@ import net.minecraft.item.Items;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -212,12 +210,12 @@ public class ClientEvents {
|
|||
@SubscribeEvent
|
||||
public void onWorldRender(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
GL11.glPushMatrix();
|
||||
float partial = event.getPartialTicks();
|
||||
GL11.glTranslated(
|
||||
-mc.player.prevPosX - (mc.player.getPosX() - mc.player.prevPosX) * partial,
|
||||
-mc.player.prevPosY - (mc.player.getPosY() - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height),
|
||||
-mc.player.prevPosZ - (mc.player.getPosZ() - mc.player.prevPosZ) * partial);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.multMatrix(event.getMatrixStack().getLast().getPositionMatrix());
|
||||
|
||||
ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo();
|
||||
Vec3d view = info.getProjectedView();
|
||||
GL11.glTranslated(-view.getX(), -view.getY(), -view.getZ());
|
||||
|
||||
if (mc.gameSettings.showDebugInfo && mc.player.isCreative() && ModConfig.instance.debugWorld.get()) {
|
||||
Map<BlockPos, Integer> spots = new HashMap<>();
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.client.particle.Particle;
|
|||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.settings.ParticleStatus;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -68,20 +69,11 @@ public final class ParticleHandler {
|
|||
}
|
||||
|
||||
public static void renderParticles(MatrixStack stack, float partialTicks) {
|
||||
// TODO Render particles
|
||||
if(true)
|
||||
return;
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientPlayerEntity player = mc.player;
|
||||
|
||||
if (player != null) {
|
||||
ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo();
|
||||
float f = MathHelper.cos(info.getYaw() * ((float) Math.PI / 180F));
|
||||
float f1 = MathHelper.sin(info.getYaw() * ((float) Math.PI / 180F));
|
||||
float f2 = -f1 * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F));
|
||||
float f3 = f * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F));
|
||||
float f4 = MathHelper.cos(info.getPitch() * ((float) Math.PI / 180F));
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.multMatrix(stack.getLast().getPositionMatrix());
|
||||
|
@ -90,7 +82,7 @@ public final class ParticleHandler {
|
|||
GlStateManager.enableBlend();
|
||||
RenderSystem.alphaFunc(516, 0.003921569F);
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE.param);
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||
|
||||
GlStateManager.depthMask(false);
|
||||
|
||||
|
@ -98,13 +90,13 @@ public final class ParticleHandler {
|
|||
Tessellator tessy = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessy.getBuffer();
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
for (Particle particle : PARTICLES)
|
||||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
|
||||
GlStateManager.disableDepthTest();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
for (Particle particle : PARTICLES_NO_DEPTH)
|
||||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
|
@ -112,7 +104,7 @@ public final class ParticleHandler {
|
|||
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableBlend();
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
|
||||
|
|
Loading…
Reference in a new issue