rendering stuff is almost finally fixed yaaaaaaaay

This commit is contained in:
Ellpeck 2020-01-29 18:18:41 +01:00
parent 0ac27ff2bb
commit 161e38187e
15 changed files with 185 additions and 290 deletions

View file

@ -63,8 +63,8 @@ import java.util.function.Predicate;
public final class Helper { public final class Helper {
public static boolean getTileEntitiesInArea(IWorld world, BlockPos pos, int radius, Function<TileEntity, Boolean> consumer) { public static boolean getTileEntitiesInArea(IWorld world, BlockPos pos, int radius, Function<TileEntity, Boolean> consumer) {
for (int x = (pos.getX() - radius) >> 4; x <= (pos.getX() + radius) >> 4; x++) { for (int x = pos.getX() - radius >> 4; x <= pos.getX() + radius >> 4; x++) {
for (int z = (pos.getZ() - radius) >> 4; z <= (pos.getZ() + radius) >> 4; z++) { for (int z = pos.getZ() - radius >> 4; z <= pos.getZ() + radius >> 4; z++) {
Chunk chunk = getLoadedChunk(world, x, z); Chunk chunk = getLoadedChunk(world, x, z);
if (chunk != null) { if (chunk != null) {
for (BlockPos tilePos : chunk.getTileEntitiesPos()) { for (BlockPos tilePos : chunk.getTileEntitiesPos()) {
@ -79,8 +79,8 @@ public final class Helper {
} }
public static void getAuraChunksInArea(World world, BlockPos pos, int radius, Consumer<AuraChunk> consumer) { public static void getAuraChunksInArea(World world, BlockPos pos, int radius, Consumer<AuraChunk> consumer) {
for (int x = (pos.getX() - radius) >> 4; x <= (pos.getX() + radius) >> 4; x++) { for (int x = pos.getX() - radius >> 4; x <= pos.getX() + radius >> 4; x++) {
for (int z = (pos.getZ() - radius) >> 4; z <= (pos.getZ() + radius) >> 4; z++) { for (int z = pos.getZ() - radius >> 4; z <= pos.getZ() + radius >> 4; z++) {
Chunk chunk = getLoadedChunk(world, x, z); Chunk chunk = getLoadedChunk(world, x, z);
if (chunk != null) { if (chunk != null) {
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null); AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null);
@ -116,7 +116,7 @@ public final class Helper {
int r = (int) ((c1 >> 16 & 0xFF) * ratio + (c2 >> 16 & 0xFF) * (1 - ratio)); int r = (int) ((c1 >> 16 & 0xFF) * ratio + (c2 >> 16 & 0xFF) * (1 - ratio));
int g = (int) ((c1 >> 8 & 0xFF) * ratio + (c2 >> 8 & 0xFF) * (1 - ratio)); int g = (int) ((c1 >> 8 & 0xFF) * ratio + (c2 >> 8 & 0xFF) * (1 - ratio));
int b = (int) ((c1 & 0xFF) * ratio + (c2 & 0xFF) * (1 - ratio)); int b = (int) ((c1 & 0xFF) * ratio + (c2 & 0xFF) * (1 - ratio));
return ((a & 255) << 24) | ((r & 255) << 16) | ((g & 255) << 8) | (b & 255); return (a & 255) << 24 | (r & 255) << 16 | (g & 255) << 8 | b & 255;
} }
public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) { public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) {
@ -125,20 +125,6 @@ public final class Helper {
return !nbt || ItemStack.areItemStackTagsEqual(first, second); return !nbt || ItemStack.areItemStackTagsEqual(first, second);
} }
@OnlyIn(Dist.CLIENT)
public static void renderItemInWorld(ItemStack stack) {
// TODO rendering items in world
/* if (!stack.isEmpty()) {
RenderSystem.pushMatrix();
RenderSystem.disableLighting();
RenderHelper.enableStandardItemLighting();
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
RenderSystem.enableLighting();
RenderSystem.popMatrix();
}*/
}
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) { public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();

View file

@ -1,26 +1,25 @@
package de.ellpeck.naturesaura.blocks.tiles.render; package de.ellpeck.naturesaura.blocks.tiles.render;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.nio.FloatBuffer; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.stream.IntStream;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> { public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png");
private static final ResourceLocation END_PORTAL_TEXTURE = new ResourceLocation("textures/entity/end_portal.png");
private static final Random RANDOM = new Random(31100L); private static final Random RANDOM = new Random(31100L);
private static final FloatBuffer MODELVIEW = GLAllocation.createDirectFloatBuffer(16); private static final List<RenderType> RENDER_TYPES = IntStream.range(0, 16).mapToObj(i -> RenderType.endPortal(i + 1)).collect(ImmutableList.toImmutableList());
private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16);
private final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) { public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn); super(rendererDispatcherIn);
@ -28,93 +27,31 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
@Override @Override
public void render(TileEntityEnderCrate tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { public void render(TileEntityEnderCrate tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
}
// TODO TESR
/*@Override
public void render(TileEntityEnderCrate tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
GlStateManager.disableLighting();
RANDOM.setSeed(31100L); RANDOM.setSeed(31100L);
GlStateManager.getMatrix(2982, MODELVIEW); double d0 = tileEntityIn.getPos().distanceSq(this.renderDispatcher.renderInfo.getProjectedView(), true);
GlStateManager.getMatrix(2983, PROJECTION);
double d0 = x * x + y * y + z * z;
int i = this.getPasses(d0); int i = this.getPasses(d0);
float f = this.getOffset(); float f = this.getOffset();
boolean flag = false; Matrix4f matrix4f = matrixStackIn.getLast().getPositionMatrix();
GameRenderer gamerenderer = Minecraft.getInstance().gameRenderer; this.renderCube(f, 0.15F, matrix4f, bufferIn.getBuffer(RENDER_TYPES.get(0)));
for (int j = 0; j < i; ++j) { for (int j = 1; j < i; ++j) {
GlStateManager.pushMatrix(); this.renderCube(f, 2.0F / (float) (18 - j), matrix4f, bufferIn.getBuffer(RENDER_TYPES.get(j)));
float f1 = 2.0F / (float) (18 - j);
if (j == 0) {
this.bindTexture(END_SKY_TEXTURE);
f1 = 0.15F;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
}
if (j >= 1) {
this.bindTexture(END_PORTAL_TEXTURE);
flag = true;
gamerenderer.setupFogColor(true);
}
if (j == 1) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
}
GlStateManager.texGenMode(GlStateManager.TexGen.S, 9216);
GlStateManager.texGenMode(GlStateManager.TexGen.T, 9216);
GlStateManager.texGenMode(GlStateManager.TexGen.R, 9216);
GlStateManager.texGenParam(GlStateManager.TexGen.S, 9474, this.getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GlStateManager.texGenParam(GlStateManager.TexGen.T, 9474, this.getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GlStateManager.texGenParam(GlStateManager.TexGen.R, 9474, this.getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GlStateManager.enableTexGen(GlStateManager.TexGen.S);
GlStateManager.enableTexGen(GlStateManager.TexGen.T);
GlStateManager.enableTexGen(GlStateManager.TexGen.R);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translatef(0.5F, 0.5F, 0.0F);
GlStateManager.scalef(0.5F, 0.5F, 1.0F);
float f2 = (float) (j + 1);
GlStateManager.translatef(17.0F / f2, (2.0F + f2 / 1.5F) * ((float) System.currentTimeMillis() % 800000.0F / 800000.0F), 0.0F);
GlStateManager.rotatef((f2 * f2 * 4321.0F + f2 * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.scalef(4.5F - f2 / 4.0F, 4.5F - f2 / 4.0F, 1.0F);
GlStateManager.multMatrix(PROJECTION);
GlStateManager.multMatrix(MODELVIEW);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
float f3 = (RANDOM.nextFloat() * 0.5F + 0.1F) * f1;
float f4 = (RANDOM.nextFloat() * 0.5F + 0.4F) * f1;
float f5 = (RANDOM.nextFloat() * 0.5F + 0.5F) * f1;
float indent = 1.95F / 16F;
bufferbuilder.pos(x + indent, y + (double) f, z - indent + 1.0D).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x - indent + 1.0D, y + (double) f, z - indent + 1.0D).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x - indent + 1.0D, y + (double) f, z + indent).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x + indent, y + (double) f, z + indent).color(f3, f4, f5, 1.0F).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
this.bindTexture(END_SKY_TEXTURE);
} }
}
GlStateManager.disableBlend(); private void renderCube(float g, float h, Matrix4f mat, IVertexBuilder builder) {
GlStateManager.disableTexGen(GlStateManager.TexGen.S); float f = (RANDOM.nextFloat() * 0.5F + 0.1F) * h;
GlStateManager.disableTexGen(GlStateManager.TexGen.T); float f1 = (RANDOM.nextFloat() * 0.5F + 0.4F) * h;
GlStateManager.disableTexGen(GlStateManager.TexGen.R); float f2 = (RANDOM.nextFloat() * 0.5F + 0.5F) * h;
GlStateManager.enableLighting(); this.renderFace(mat, builder, g, g, f, f1, f2);
if (flag) { }
gamerenderer.setupFogColor(false);
} private void renderFace(Matrix4f mat, IVertexBuilder builder, float h, float i, float n, float o, float p) {
}*/ builder.pos(mat, (float) 0.0, h, (float) 1.0).color(n, o, p, 1.0F).endVertex();
builder.pos(mat, (float) 1.0, h, (float) 1.0).color(n, o, p, 1.0F).endVertex();
builder.pos(mat, (float) 1.0, i, (float) 0.0).color(n, o, p, 1.0F).endVertex();
builder.pos(mat, (float) 0.0, i, (float) 0.0).color(n, o, p, 1.0F).endVertex();
}
protected int getPasses(double dist) { protected int getPasses(double dist) {
int i; int i;
@ -145,11 +82,4 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
protected float getOffset() { protected float getOffset() {
return 1.001F; return 1.001F;
} }
private FloatBuffer getBuffer(float a, float b, float c, float d) {
this.buffer.clear();
this.buffer.put(a).put(b).put(c).put(d);
this.buffer.flip();
return this.buffer;
}
} }

View file

@ -1,11 +1,18 @@
package de.ellpeck.naturesaura.blocks.tiles.render; package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -13,51 +20,30 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGeneratorLimitRemover> { public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGeneratorLimitRemover> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png"); private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png");
//private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint(); private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
public RenderGeneratorLimitRemover(TileEntityRendererDispatcher disp) { public RenderGeneratorLimitRemover(TileEntityRendererDispatcher disp) {
super(disp); super(disp);
} }
@Override @Override
public void render(TileEntityGeneratorLimitRemover tileEntityGeneratorLimitRemover, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) { public void render(TileEntityGeneratorLimitRemover te, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
}
// TODO TESR
/*
@Override
public void render(TileEntityGeneratorLimitRemover te, double x, double y, double z, float partialTicks, int destroyStage) {
TileEntity above = te.getWorld().getTileEntity(te.getPos().up()); TileEntity above = te.getWorld().getTileEntity(te.getPos().up());
if (above instanceof TileEntityImpl && ((TileEntityImpl) above).wantsLimitRemover()) { if (above instanceof TileEntityImpl && ((TileEntityImpl) above).wantsLimitRemover()) {
this.renderGlint(x, y + 1, z); this.renderGlint(matrixStack, iRenderTypeBuffer, 1, combinedOverlayIn);
this.renderGlint(x, y, z); this.renderGlint(matrixStack, iRenderTypeBuffer, 0, combinedOverlayIn);
} }
} }
private void renderGlint(double x, double y, double z) { private void renderGlint(MatrixStack stack, IRenderTypeBuffer buffer, double yOff, int combinedOverlayIn) {
RenderSystem.pushMatrix(); stack.push();
RenderHelper.enableStandardItemLighting();
RenderSystem.enableAlphaTest();
GlStateManager.enableBlend();
RenderSystem.alphaFunc(516, 0.003921569F);
GlStateManager.depthMask(false);
int brightness = 15 << 20 | 15 << 4; int brightness = 15 << 20 | 15 << 4;
int j = brightness % 65536;
int k = brightness / 65536;
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
float alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F; float alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F;
RenderSystem.color4f(alpha, alpha, alpha, alpha); stack.translate(-0.001F, yOff + 1 + 0.001F, 1 + 0.001F);
RenderSystem.translated(x - 0.001F, y + 1 + 0.001F, z + 1 + 0.001F); stack.rotate(Vector3f.XP.rotationDegrees(180F));
RenderSystem.rotatef(180F, 1, 0, 0); stack.scale(1.002F, 1.002F, 1.002F);
RenderSystem.scalef(1.002F, 1.002F, 1.002F); this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
this.bindTexture(RES); stack.pop();
this.model.render();
GlStateManager.depthMask(true);
RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.disableAlphaTest();
GlStateManager.disableBlend();
RenderSystem.popMatrix();
} }
private static class ModelLimitRemoverGlint extends Model { private static class ModelLimitRemoverGlint extends Model {
@ -65,15 +51,15 @@ public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGe
private final ModelRenderer box; private final ModelRenderer box;
public ModelLimitRemoverGlint() { public ModelLimitRemoverGlint() {
super(); super(RenderType::entityTranslucent);
this.box = new ModelRenderer(this, 0, 0); this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64); this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 16, 16); this.box.addBox(0, 0, 0, 16, 16, 16);
} }
@Override @Override
public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int i, int i1, float v, float v1, float v2, float v3) { public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStack, iVertexBuilder, i, i1, v, v1, v2, v3); this.box.render(matrixStack, iVertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, alpha);
} }
}*/ }
} }

View file

@ -2,9 +2,14 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> { public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) { public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) {
@ -13,23 +18,15 @@ public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar>
@Override @Override
public void render(TileEntityNatureAltar tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { public void render(TileEntityNatureAltar tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
}
// TODO TESR
/*@Override
public void render(TileEntityNatureAltar tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
ItemStack stack = tileEntityIn.items.getStackInSlot(0); ItemStack stack = tileEntityIn.items.getStackInSlot(0);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
GlStateManager.pushMatrix(); matrixStackIn.push();
float time = tileEntityIn.bobTimer + partialTicks; float time = tileEntityIn.bobTimer + partialTicks;
float bob = (float) Math.sin(time / 10F) * 0.1F; float bob = (float) Math.sin(time / 10F) * 0.1F;
GlStateManager.translated(x + 0.5F, y + 1.2F + bob, z + 0.5F); matrixStackIn.translate(0.5F, 1.2F + bob, 0.5F);
GlStateManager.rotatef((time * 3) % 360, 0F, 1F, 0F); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(time * 3 % 360));
float scale = stack.getItem() instanceof BlockItem ? 0.75F : 0.5F; Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn);
GlStateManager.scalef(scale, scale, scale); matrixStackIn.pop();
Helper.renderItemInWorld(stack);
GlStateManager.popMatrix();
} }
}*/ }
} }

View file

@ -2,9 +2,16 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import java.util.Random; import java.util.Random;
@ -17,29 +24,23 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
} }
@Override @Override
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) { public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
}
// TODO TESR
/*@Override
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int j, int i1) {
ItemStack stack = tileEntityOfferingTable.items.getStackInSlot(0); ItemStack stack = tileEntityOfferingTable.items.getStackInSlot(0);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
this.rand.setSeed(Item.getIdFromItem(stack.getItem()) + stack.getDamage()); this.rand.setSeed(Item.getIdFromItem(stack.getItem()) + stack.getDamage());
int amount = MathHelper.ceil(stack.getCount() / 2F); int amount = MathHelper.ceil(stack.getCount() / 2F);
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
GlStateManager.pushMatrix(); matrixStack.push();
Item item = stack.getItem(); Item item = stack.getItem();
float scale; float scale;
float yOff; float yOff;
if (item instanceof BlockItem) { if (item instanceof BlockItem) {
scale = 0.4F; scale = 0.5F;
yOff = 0.08F; yOff = 0.08F;
} else { } else {
scale = 0.25F; scale = 0.35F;
yOff = 0F; yOff = 0F;
} }
@ -47,13 +48,13 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
0.35F + this.rand.nextFloat() * 0.3F, 0.35F + this.rand.nextFloat() * 0.3F,
0.9F + yOff + i * 0.001F, 0.9F + yOff + i * 0.001F,
0.35F + this.rand.nextFloat() * 0.3F); 0.35F + this.rand.nextFloat() * 0.3F);
matrixStack.rotate(this.rand.nextFloat() * 360F, 0F, 1F, 0F); matrixStack.rotate(Vector3f.YP.rotationDegrees(this.rand.nextFloat() * 360));
matrixStack.rotate(90F, 1F, 0F, 0F); matrixStack.rotate(Vector3f.XP.rotationDegrees(90F));
matrixStack.scale(scale, scale, scale); matrixStack.scale(scale, scale, scale);
Helper.renderItemInWorld(stack); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStack, iRenderTypeBuffer);
GlStateManager.popMatrix(); matrixStack.pop();
} }
} }
}*/ }
} }

View file

@ -1,11 +1,17 @@
package de.ellpeck.naturesaura.blocks.tiles.render; package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -13,63 +19,46 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProjectileGenerator> { public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProjectileGenerator> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png"); private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
//private final ModelOverlay model = new ModelOverlay(); private final ModelOverlay model = new ModelOverlay();
public RenderProjectileGenerator(TileEntityRendererDispatcher rendererDispatcherIn) { public RenderProjectileGenerator(TileEntityRendererDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn); super(rendererDispatcherIn);
} }
@Override @Override
public void render(TileEntityProjectileGenerator tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { public void render(TileEntityProjectileGenerator te, float partialTicks, MatrixStack stack, IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) {
stack.push();
}
// TODO TESR
/*@Override
public void render(TileEntityProjectileGenerator te, double x, double y, double z, float partialTicks, int destroyStage) {
GlStateManager.pushMatrix();
GlStateManager.enableAlphaTest();
GlStateManager.enableBlend();
GlStateManager.alphaFunc(516, 0.003921569F);
GlStateManager.depthMask(false);
GlStateManager.translated(x, y, z);
if (te.nextSide == Direction.NORTH) { if (te.nextSide == Direction.NORTH) {
GlStateManager.rotatef(270, 0, 1, 0); stack.rotate(Vector3f.YP.rotationDegrees(270));
GlStateManager.translatef(-0.001F, 0, -1); stack.translate(-0.001F, 0, -1);
} else if (te.nextSide == Direction.EAST) { } else if (te.nextSide == Direction.EAST) {
GlStateManager.rotatef(180, 0, 1, 0); stack.rotate(Vector3f.YP.rotationDegrees(180));
GlStateManager.translatef(-1.001F, 0, -1); stack.translate(-1.001F, 0, -1);
} else if (te.nextSide == Direction.SOUTH) { } else if (te.nextSide == Direction.SOUTH) {
GlStateManager.rotatef(90, 0, 1, 0); stack.rotate(Vector3f.YP.rotationDegrees(90));
GlStateManager.translatef(-1.001F, 0, 0); stack.translate(-1.001F, 0, 0);
} else { } else {
GlStateManager.translatef(-0.001F, 0, 0); stack.translate(-0.001F, 0, 0);
} }
this.bindTexture(RES);
int brightness = 15 << 20 | 15 << 4; int brightness = 15 << 20 | 15 << 4;
int j = brightness % 65536; this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
int k = brightness / 65536; stack.pop();
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
this.model.render();
GlStateManager.depthMask(true);
GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.disableAlphaTest();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
} }
private static class ModelOverlay extends Model { private static class ModelOverlay extends Model {
private final RendererModel box; private final ModelRenderer box;
public ModelOverlay() { public ModelOverlay() {
this.box = new RendererModel(this, 0, 0); super(RenderType::entityTranslucent);
this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64); this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 16, 16); this.box.addBox(0, 0, 0, 16, 16, 16);
} }
public void render() { @Override
this.box.render(1 / 16F); public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
} }
}*/ }
} }

View file

@ -2,9 +2,15 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> { public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
@ -14,28 +20,22 @@ public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
@Override @Override
public void render(TileEntityWoodStand tileEntityWoodStand, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) { public void render(TileEntityWoodStand tileEntityWoodStand, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
ItemStack stack = tileEntityWoodStand.items.getStackInSlot(0);
}
// TODO TESR
/*@Override
public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage) {
ItemStack stack = tile.items.getStackInSlot(0);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
GlStateManager.pushMatrix(); matrixStack.push();
Item item = stack.getItem(); Item item = stack.getItem();
if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) { if (item instanceof BlockItem) {
GlStateManager.translated(x + 0.5F, y + 0.9735F, z + 0.5F); matrixStack.translate(0.5F, 0.9735F, 0.5F);
float scale = 0.65F; float scale = 0.65F;
GlStateManager.scalef(scale, scale, scale); matrixStack.scale(scale, scale, scale);
} else { } else {
GlStateManager.translated(x + 0.5F, y + 0.825F, z + 0.5F); matrixStack.translate(0.5F, 0.825F, 0.5F);
float scale = 0.4F; float scale = 0.4F;
GlStateManager.scalef(scale, scale, scale); matrixStack.scale(scale, scale, scale);
GlStateManager.rotatef(90F, 1F, 0F, 0F); matrixStack.rotate(Vector3f.XP.rotationDegrees(90));
} }
Helper.renderItemInWorld(stack); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, i, i1, matrixStack, iRenderTypeBuffer);
GlStateManager.popMatrix(); matrixStack.pop();
} }
}*/ }
} }

View file

@ -1,8 +1,17 @@
package de.ellpeck.naturesaura.entities.render; package de.ellpeck.naturesaura.entities.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.items.ItemEffectPowder;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -22,27 +31,20 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
@Override @Override
public ResourceLocation getEntityTexture(EntityEffectInhibitor entity) { public ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
return null;
}
// TODO Render entities
/* @Nullable
@Override
protected ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
return AtlasTexture.LOCATION_BLOCKS_TEXTURE; return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
} }
@Override @Override
public void doRender(EntityEffectInhibitor entity, double x, double y, double z, float entityYaw, float partialTicks) { public void render(EntityEffectInhibitor entity, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
GlStateManager.pushMatrix(); matrixStackIn.push();
float time = entity.renderTicks + entity.getEntityId() + partialTicks; float time = entity.renderTicks + entity.getEntityId() + partialTicks;
float bob = (float) Math.sin(time / 10F) * 0.05F; float bob = (float) Math.sin(time / 10F) * 0.05F;
GlStateManager.translated(x, y + 0.15F + bob, z); matrixStackIn.translate(0, 0.15F + bob, 0);
GlStateManager.rotatef((time * 3) % 360, 0F, 1F, 0F); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(time * 3 % 360));
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
ResourceLocation effect = entity.getInhibitedEffect(); ResourceLocation effect = entity.getInhibitedEffect();
Helper.renderItemInWorld(this.items.computeIfAbsent(effect, ItemStack stack = this.items.computeIfAbsent(effect,
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect))); res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect));
GlStateManager.popMatrix(); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLightIn, OverlayTexture.DEFAULT_LIGHT, matrixStackIn, bufferIn);
}*/ matrixStackIn.pop();
}
} }

View file

@ -1,17 +1,24 @@
package de.ellpeck.naturesaura.entities.render; package de.ellpeck.naturesaura.entities.render;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.entities.EntityMoverMinecart; import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MinecartRenderer; import net.minecraft.client.renderer.entity.MinecartRenderer;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> { public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/mover_cart.png"); private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/mover_cart.png");
//private final ModelMoverMinecart model = new ModelMoverMinecart(); private final ModelMoverMinecart model = new ModelMoverMinecart();
public RenderMoverMinecart(EntityRendererManager renderManagerIn) { public RenderMoverMinecart(EntityRendererManager renderManagerIn) {
super(renderManagerIn); super(renderManagerIn);
@ -22,29 +29,30 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
} }
// TODO Entity rendering @Override
/*@Override protected void renderBlockState(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) { matrixStackIn.push();
GlStateManager.pushMatrix(); matrixStackIn.translate(0, 22 / 16F, 0);
GlStateManager.translatef(0, 22 / 16F, 0); matrixStackIn.translate(0, 0, 1);
GlStateManager.rotatef(180, 1, 0, 0); matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180));
this.bindTexture(RES); this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.DEFAULT_LIGHT, 1, 1, 1, 1);
this.model.render(); matrixStackIn.pop();
GlStateManager.popMatrix();
} }
private static class ModelMoverMinecart extends Model { private static class ModelMoverMinecart extends Model {
private final RendererModel box; private final ModelRenderer box;
public ModelMoverMinecart() { public ModelMoverMinecart() {
this.box = new RendererModel(this, 0, 0); super(RenderType::entityCutout);
this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64); this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 24, 16); this.box.addBox(0, 0, 0, 16, 24, 16);
} }
public void render() { @Override
this.box.render(1 / 16F); public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
} }
}*/ }
} }

View file

@ -75,8 +75,6 @@ public class ClientEvents {
private static ItemStack heldCache = ItemStack.EMPTY; private static ItemStack heldCache = ItemStack.EMPTY;
private static ItemStack heldEye = ItemStack.EMPTY; private static ItemStack heldEye = ItemStack.EMPTY;
private static ItemStack heldOcular = ItemStack.EMPTY; private static ItemStack heldOcular = ItemStack.EMPTY;
private float height;
private float previousHeight;
@SubscribeEvent @SubscribeEvent
public void onTooltip(ItemTooltipEvent event) { public void onTooltip(ItemTooltipEvent event) {
@ -123,7 +121,7 @@ public class ClientEvents {
@SubscribeEvent @SubscribeEvent
public void onRenderLast(RenderWorldLastEvent event) { public void onRenderLast(RenderWorldLastEvent event) {
ParticleHandler.renderParticles(event.getMatrixStack(), event.getPartialTicks()); ParticleHandler.renderParticles(event.getMatrixStack(), Minecraft.getInstance().getRenderPartialTicks());
} }
@SubscribeEvent @SubscribeEvent
@ -141,11 +139,6 @@ public class ClientEvents {
} else { } else {
PENDING_AURA_CHUNKS.removeIf(next -> next.tryHandle(mc.world)); PENDING_AURA_CHUNKS.removeIf(next -> next.tryHandle(mc.world));
if (mc.player != null) {
this.previousHeight = this.height;
this.height += (mc.player.getEyeHeight() - this.height) * 0.5F;
}
if (!mc.isGamePaused()) { if (!mc.isGamePaused()) {
if (mc.world.getGameTime() % 20 == 0) { if (mc.world.getGameTime() % 20 == 0) {
int amount = MathHelper.floor(190 * ModConfig.instance.excessParticleAmount.get()); int amount = MathHelper.floor(190 * ModConfig.instance.excessParticleAmount.get());
@ -240,7 +233,7 @@ public class ClientEvents {
for (Map.Entry<BlockPos, Integer> spot : spots.entrySet()) { for (Map.Entry<BlockPos, Integer> spot : spots.entrySet()) {
BlockPos pos = spot.getKey(); BlockPos pos = spot.getKey();
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1) / scale, (pos.getZ() + 0.1) / scale); RenderSystem.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1.001) / scale, (pos.getZ() + 0.1) / scale);
RenderSystem.rotatef(90F, 1F, 0F, 0F); RenderSystem.rotatef(90F, 1F, 0F, 0F);
RenderSystem.scalef(0.65F, 0.65F, 0.65F); RenderSystem.scalef(0.65F, 0.65F, 0.65F);
mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0); mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0);
@ -289,7 +282,7 @@ public class ClientEvents {
return; return;
box = box.grow(0.05F); box = box.grow(0.05F);
int color = visualize.getVisualizationColor(world, pos); int color = visualize.getVisualizationColor(world, pos);
RenderSystem.color4f(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 0.5F); RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 0.5F);
Helper.renderWeirdBox(box.minX, box.minY, box.minZ, box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ); Helper.renderWeirdBox(box.minX, box.minY, box.minZ, box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ);
} }

View file

@ -114,10 +114,10 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty(); boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty();
GlStateManager.translatef(-0.15F, 0.65F, chest ? -0.195F : (legs ? -0.165F : -0.1475F)); GlStateManager.translatef(-0.15F, 0.65F, chest ? -0.195F : legs ? -0.165F : -0.1475F);
GlStateManager.scalef(0.25F, 0.25F, 0.25F); GlStateManager.scalef(0.25F, 0.25F, 0.25F);
GlStateManager.rotatef(180F, 1F, 0F, 0F); GlStateManager.rotatef(180F, 1F, 0F, 0F);
Helper.renderItemInWorld(stack); //Helper.renderItemInWorld(stack);
} }
} }
} }

View file

@ -24,7 +24,7 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
GlStateManager.translatef(0.1F, 0.225F, armor ? -0.195F : -0.1475F); GlStateManager.translatef(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
GlStateManager.scalef(0.15F, 0.15F, 0.15F); GlStateManager.scalef(0.15F, 0.15F, 0.15F);
GlStateManager.rotatef(180F, 1F, 0F, 0F); GlStateManager.rotatef(180F, 1F, 0F, 0F);
Helper.renderItemInWorld(stack); //Helper.renderItemInWorld(stack);
} }
} }
} }

View file

@ -9,11 +9,10 @@ import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.settings.ParticleStatus; import net.minecraft.client.settings.ParticleStatus;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -74,17 +73,21 @@ public final class ParticleHandler {
if (player != null) { if (player != null) {
ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo(); ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo();
LightTexture lightmap = mc.gameRenderer.getLightTexture();
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.multMatrix(stack.getLast().getPositionMatrix()); RenderSystem.multMatrix(stack.getLast().getPositionMatrix());
lightmap.enableLightmap();
RenderSystem.enableAlphaTest(); RenderSystem.enableAlphaTest();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
RenderSystem.alphaFunc(516, 0.003921569F); RenderSystem.alphaFunc(516, 0.003921569F);
GlStateManager.disableCull(); RenderSystem.disableCull();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
RenderSystem.enableFog();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.depthMask(false); RenderSystem.depthMask(false);
mc.getTextureManager().bindTexture(ParticleMagic.TEXTURE); mc.getTextureManager().bindTexture(ParticleMagic.TEXTURE);
Tessellator tessy = Tessellator.getInstance(); Tessellator tessy = Tessellator.getInstance();
@ -95,19 +98,21 @@ public final class ParticleHandler {
particle.renderParticle(buffer, info, partialTicks); particle.renderParticle(buffer, info, partialTicks);
tessy.draw(); tessy.draw();
GlStateManager.disableDepthTest(); RenderSystem.disableDepthTest();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
for (Particle particle : PARTICLES_NO_DEPTH) for (Particle particle : PARTICLES_NO_DEPTH)
particle.renderParticle(buffer, info, partialTicks); particle.renderParticle(buffer, info, partialTicks);
tessy.draw(); tessy.draw();
GlStateManager.enableDepthTest(); RenderSystem.enableDepthTest();
GlStateManager.enableCull(); RenderSystem.enableCull();
GlStateManager.depthMask(true); RenderSystem.depthMask(true);
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.disableBlend(); RenderSystem.disableBlend();
RenderSystem.alphaFunc(516, 0.1F); RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.disableFog();
lightmap.disableLightmap();
RenderSystem.popMatrix(); RenderSystem.popMatrix();
} }
} }

View file

@ -74,8 +74,6 @@ public class ParticleMagic extends Particle {
float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY()); float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY());
float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ()); float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ());
Quaternion quaternion = renderInfo.getRotation(); Quaternion quaternion = renderInfo.getRotation();
Vector3f vector3f1 = new Vector3f(-1.0F, -1.0F, 0.0F);
vector3f1.transform(quaternion);
Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)};
float f4 = 0.1F * this.particleScale; float f4 = 0.1F * this.particleScale;

View file

@ -33,7 +33,7 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
super(entityRendererIn); super(entityRendererIn);
} }
// TODO Test this // TODO Fix this
@Override @Override
public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (player.getActivePotionEffect(Effects.INVISIBILITY) != null) if (player.getActivePotionEffect(Effects.INVISIBILITY) != null)