mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
rendering stuff is almost finally fixed yaaaaaaaay
This commit is contained in:
parent
0ac27ff2bb
commit
161e38187e
15 changed files with 185 additions and 290 deletions
|
@ -63,8 +63,8 @@ import java.util.function.Predicate;
|
|||
public final class Helper {
|
||||
|
||||
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 z = (pos.getZ() - radius) >> 4; z <= (pos.getZ() + radius) >> 4; z++) {
|
||||
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++) {
|
||||
Chunk chunk = getLoadedChunk(world, x, z);
|
||||
if (chunk != null) {
|
||||
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) {
|
||||
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 x = pos.getX() - radius >> 4; x <= pos.getX() + radius >> 4; x++) {
|
||||
for (int z = pos.getZ() - radius >> 4; z <= pos.getZ() + radius >> 4; z++) {
|
||||
Chunk chunk = getLoadedChunk(world, x, z);
|
||||
if (chunk != 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 g = (int) ((c1 >> 8 & 0xFF) * ratio + (c2 >> 8 & 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) {
|
||||
|
@ -125,20 +125,6 @@ public final class Helper {
|
|||
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)
|
||||
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
|
||||
RenderSystem.pushMatrix();
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
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.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
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 FloatBuffer MODELVIEW = GLAllocation.createDirectFloatBuffer(16);
|
||||
private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16);
|
||||
private final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
private static final List<RenderType> RENDER_TYPES = IntStream.range(0, 16).mapToObj(i -> RenderType.endPortal(i + 1)).collect(ImmutableList.toImmutableList());
|
||||
|
||||
public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
|
@ -28,93 +27,31 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
|
|||
|
||||
@Override
|
||||
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);
|
||||
GlStateManager.getMatrix(2982, MODELVIEW);
|
||||
GlStateManager.getMatrix(2983, PROJECTION);
|
||||
double d0 = x * x + y * y + z * z;
|
||||
double d0 = tileEntityIn.getPos().distanceSq(this.renderDispatcher.renderInfo.getProjectedView(), true);
|
||||
int i = this.getPasses(d0);
|
||||
float f = this.getOffset();
|
||||
boolean flag = false;
|
||||
GameRenderer gamerenderer = Minecraft.getInstance().gameRenderer;
|
||||
Matrix4f matrix4f = matrixStackIn.getLast().getPositionMatrix();
|
||||
this.renderCube(f, 0.15F, matrix4f, bufferIn.getBuffer(RENDER_TYPES.get(0)));
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
GlStateManager.pushMatrix();
|
||||
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);
|
||||
for (int j = 1; j < i; ++j) {
|
||||
this.renderCube(f, 2.0F / (float) (18 - j), matrix4f, bufferIn.getBuffer(RENDER_TYPES.get(j)));
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableTexGen(GlStateManager.TexGen.S);
|
||||
GlStateManager.disableTexGen(GlStateManager.TexGen.T);
|
||||
GlStateManager.disableTexGen(GlStateManager.TexGen.R);
|
||||
GlStateManager.enableLighting();
|
||||
if (flag) {
|
||||
gamerenderer.setupFogColor(false);
|
||||
}
|
||||
}*/
|
||||
private void renderCube(float g, float h, Matrix4f mat, IVertexBuilder builder) {
|
||||
float f = (RANDOM.nextFloat() * 0.5F + 0.1F) * h;
|
||||
float f1 = (RANDOM.nextFloat() * 0.5F + 0.4F) * h;
|
||||
float f2 = (RANDOM.nextFloat() * 0.5F + 0.5F) * h;
|
||||
this.renderFace(mat, builder, g, g, f, f1, f2);
|
||||
}
|
||||
|
||||
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) {
|
||||
int i;
|
||||
|
@ -145,11 +82,4 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
|
|||
protected float getOffset() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
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.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.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -13,51 +20,30 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGeneratorLimitRemover> {
|
||||
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) {
|
||||
super(disp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityGeneratorLimitRemover tileEntityGeneratorLimitRemover, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*
|
||||
@Override
|
||||
public void render(TileEntityGeneratorLimitRemover te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
public void render(TileEntityGeneratorLimitRemover te, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
|
||||
TileEntity above = te.getWorld().getTileEntity(te.getPos().up());
|
||||
if (above instanceof TileEntityImpl && ((TileEntityImpl) above).wantsLimitRemover()) {
|
||||
this.renderGlint(x, y + 1, z);
|
||||
this.renderGlint(x, y, z);
|
||||
this.renderGlint(matrixStack, iRenderTypeBuffer, 1, combinedOverlayIn);
|
||||
this.renderGlint(matrixStack, iRenderTypeBuffer, 0, combinedOverlayIn);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint(double x, double y, double z) {
|
||||
RenderSystem.pushMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderSystem.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.alphaFunc(516, 0.003921569F);
|
||||
GlStateManager.depthMask(false);
|
||||
private void renderGlint(MatrixStack stack, IRenderTypeBuffer buffer, double yOff, int combinedOverlayIn) {
|
||||
stack.push();
|
||||
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;
|
||||
RenderSystem.color4f(alpha, alpha, alpha, alpha);
|
||||
RenderSystem.translated(x - 0.001F, y + 1 + 0.001F, z + 1 + 0.001F);
|
||||
RenderSystem.rotatef(180F, 1, 0, 0);
|
||||
RenderSystem.scalef(1.002F, 1.002F, 1.002F);
|
||||
this.bindTexture(RES);
|
||||
this.model.render();
|
||||
GlStateManager.depthMask(true);
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
stack.translate(-0.001F, yOff + 1 + 0.001F, 1 + 0.001F);
|
||||
stack.rotate(Vector3f.XP.rotationDegrees(180F));
|
||||
stack.scale(1.002F, 1.002F, 1.002F);
|
||||
this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
private static class ModelLimitRemoverGlint extends Model {
|
||||
|
@ -65,15 +51,15 @@ public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGe
|
|||
private final ModelRenderer box;
|
||||
|
||||
public ModelLimitRemoverGlint() {
|
||||
super();
|
||||
super(RenderType::entityTranslucent);
|
||||
this.box = new ModelRenderer(this, 0, 0);
|
||||
this.box.setTextureSize(64, 64);
|
||||
this.box.addBox(0, 0, 0, 16, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int i, int i1, float v, float v1, float v2, float v3) {
|
||||
this.box.render(matrixStack, iVertexBuilder, i, i1, v, v1, v2, 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, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,14 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
|
||||
public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
|
@ -13,23 +18,15 @@ public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar>
|
|||
|
||||
@Override
|
||||
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);
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
matrixStackIn.push();
|
||||
float time = tileEntityIn.bobTimer + partialTicks;
|
||||
float bob = (float) Math.sin(time / 10F) * 0.1F;
|
||||
GlStateManager.translated(x + 0.5F, y + 1.2F + bob, z + 0.5F);
|
||||
GlStateManager.rotatef((time * 3) % 360, 0F, 1F, 0F);
|
||||
float scale = stack.getItem() instanceof BlockItem ? 0.75F : 0.5F;
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
matrixStackIn.translate(0.5F, 1.2F + bob, 0.5F);
|
||||
matrixStackIn.rotate(Vector3f.YP.rotationDegrees(time * 3 % 360));
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn);
|
||||
matrixStackIn.pop();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,16 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.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;
|
||||
|
||||
|
@ -17,29 +24,23 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int j, int i1) {
|
||||
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
|
||||
ItemStack stack = tileEntityOfferingTable.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
this.rand.setSeed(Item.getIdFromItem(stack.getItem()) + stack.getDamage());
|
||||
|
||||
int amount = MathHelper.ceil(stack.getCount() / 2F);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
GlStateManager.pushMatrix();
|
||||
matrixStack.push();
|
||||
Item item = stack.getItem();
|
||||
|
||||
float scale;
|
||||
float yOff;
|
||||
if (item instanceof BlockItem) {
|
||||
scale = 0.4F;
|
||||
scale = 0.5F;
|
||||
yOff = 0.08F;
|
||||
} else {
|
||||
scale = 0.25F;
|
||||
scale = 0.35F;
|
||||
yOff = 0F;
|
||||
}
|
||||
|
||||
|
@ -47,13 +48,13 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
|
|||
0.35F + this.rand.nextFloat() * 0.3F,
|
||||
0.9F + yOff + i * 0.001F,
|
||||
0.35F + this.rand.nextFloat() * 0.3F);
|
||||
matrixStack.rotate(this.rand.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
matrixStack.rotate(90F, 1F, 0F, 0F);
|
||||
matrixStack.rotate(Vector3f.YP.rotationDegrees(this.rand.nextFloat() * 360));
|
||||
matrixStack.rotate(Vector3f.XP.rotationDegrees(90F));
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
|
||||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStack, iRenderTypeBuffer);
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
|
||||
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.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -13,63 +19,46 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProjectileGenerator> {
|
||||
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) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityProjectileGenerator tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
|
||||
}
|
||||
|
||||
// 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);
|
||||
public void render(TileEntityProjectileGenerator te, float partialTicks, MatrixStack stack, IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) {
|
||||
stack.push();
|
||||
if (te.nextSide == Direction.NORTH) {
|
||||
GlStateManager.rotatef(270, 0, 1, 0);
|
||||
GlStateManager.translatef(-0.001F, 0, -1);
|
||||
stack.rotate(Vector3f.YP.rotationDegrees(270));
|
||||
stack.translate(-0.001F, 0, -1);
|
||||
} else if (te.nextSide == Direction.EAST) {
|
||||
GlStateManager.rotatef(180, 0, 1, 0);
|
||||
GlStateManager.translatef(-1.001F, 0, -1);
|
||||
stack.rotate(Vector3f.YP.rotationDegrees(180));
|
||||
stack.translate(-1.001F, 0, -1);
|
||||
} else if (te.nextSide == Direction.SOUTH) {
|
||||
GlStateManager.rotatef(90, 0, 1, 0);
|
||||
GlStateManager.translatef(-1.001F, 0, 0);
|
||||
stack.rotate(Vector3f.YP.rotationDegrees(90));
|
||||
stack.translate(-1.001F, 0, 0);
|
||||
} else {
|
||||
GlStateManager.translatef(-0.001F, 0, 0);
|
||||
stack.translate(-0.001F, 0, 0);
|
||||
}
|
||||
this.bindTexture(RES);
|
||||
int brightness = 15 << 20 | 15 << 4;
|
||||
int j = brightness % 65536;
|
||||
int k = brightness / 65536;
|
||||
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();
|
||||
this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
private static class ModelOverlay extends Model {
|
||||
|
||||
private final RendererModel box;
|
||||
private final ModelRenderer box;
|
||||
|
||||
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.addBox(0, 0, 0, 16, 16, 16);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.box.render(1 / 16F);
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,15 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
|
||||
|
||||
|
@ -14,28 +20,22 @@ public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
|
|||
|
||||
@Override
|
||||
public void render(TileEntityWoodStand tileEntityWoodStand, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
ItemStack stack = tile.items.getStackInSlot(0);
|
||||
ItemStack stack = tileEntityWoodStand.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
matrixStack.push();
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
GlStateManager.translated(x + 0.5F, y + 0.9735F, z + 0.5F);
|
||||
if (item instanceof BlockItem) {
|
||||
matrixStack.translate(0.5F, 0.9735F, 0.5F);
|
||||
float scale = 0.65F;
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
} else {
|
||||
GlStateManager.translated(x + 0.5F, y + 0.825F, z + 0.5F);
|
||||
matrixStack.translate(0.5F, 0.825F, 0.5F);
|
||||
float scale = 0.4F;
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
GlStateManager.rotatef(90F, 1F, 0F, 0F);
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
matrixStack.rotate(Vector3f.XP.rotationDegrees(90));
|
||||
}
|
||||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, i, i1, matrixStack, iRenderTypeBuffer);
|
||||
matrixStack.pop();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package de.ellpeck.naturesaura.entities.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
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.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.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -22,27 +31,20 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
|
|||
|
||||
@Override
|
||||
public ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO Render entities
|
||||
/* @Nullable
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
|
||||
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityEffectInhibitor entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
GlStateManager.pushMatrix();
|
||||
public void render(EntityEffectInhibitor entity, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
|
||||
matrixStackIn.push();
|
||||
float time = entity.renderTicks + entity.getEntityId() + partialTicks;
|
||||
float bob = (float) Math.sin(time / 10F) * 0.05F;
|
||||
GlStateManager.translated(x, y + 0.15F + bob, z);
|
||||
GlStateManager.rotatef((time * 3) % 360, 0F, 1F, 0F);
|
||||
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
|
||||
matrixStackIn.translate(0, 0.15F + bob, 0);
|
||||
matrixStackIn.rotate(Vector3f.YP.rotationDegrees(time * 3 % 360));
|
||||
ResourceLocation effect = entity.getInhibitedEffect();
|
||||
Helper.renderItemInWorld(this.items.computeIfAbsent(effect,
|
||||
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect)));
|
||||
GlStateManager.popMatrix();
|
||||
}*/
|
||||
ItemStack stack = this.items.computeIfAbsent(effect,
|
||||
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect));
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLightIn, OverlayTexture.DEFAULT_LIGHT, matrixStackIn, bufferIn);
|
||||
matrixStackIn.pop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
package de.ellpeck.naturesaura.entities.render;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
|
||||
import net.minecraft.block.BlockState;
|
||||
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.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;
|
||||
|
||||
public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
||||
|
||||
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) {
|
||||
super(renderManagerIn);
|
||||
|
@ -22,29 +29,30 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
|||
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
|
||||
}
|
||||
|
||||
// TODO Entity rendering
|
||||
/*@Override
|
||||
protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, 22 / 16F, 0);
|
||||
GlStateManager.rotatef(180, 1, 0, 0);
|
||||
this.bindTexture(RES);
|
||||
this.model.render();
|
||||
GlStateManager.popMatrix();
|
||||
@Override
|
||||
protected void renderBlockState(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
|
||||
matrixStackIn.push();
|
||||
matrixStackIn.translate(0, 22 / 16F, 0);
|
||||
matrixStackIn.translate(0, 0, 1);
|
||||
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180));
|
||||
this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.DEFAULT_LIGHT, 1, 1, 1, 1);
|
||||
matrixStackIn.pop();
|
||||
}
|
||||
|
||||
private static class ModelMoverMinecart extends Model {
|
||||
|
||||
private final RendererModel box;
|
||||
private final ModelRenderer box;
|
||||
|
||||
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.addBox(0, 0, 0, 16, 24, 16);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.box.render(1 / 16F);
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,6 @@ public class ClientEvents {
|
|||
private static ItemStack heldCache = ItemStack.EMPTY;
|
||||
private static ItemStack heldEye = ItemStack.EMPTY;
|
||||
private static ItemStack heldOcular = ItemStack.EMPTY;
|
||||
private float height;
|
||||
private float previousHeight;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTooltip(ItemTooltipEvent event) {
|
||||
|
@ -123,7 +121,7 @@ public class ClientEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onRenderLast(RenderWorldLastEvent event) {
|
||||
ParticleHandler.renderParticles(event.getMatrixStack(), event.getPartialTicks());
|
||||
ParticleHandler.renderParticles(event.getMatrixStack(), Minecraft.getInstance().getRenderPartialTicks());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -141,11 +139,6 @@ public class ClientEvents {
|
|||
} else {
|
||||
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.world.getGameTime() % 20 == 0) {
|
||||
int amount = MathHelper.floor(190 * ModConfig.instance.excessParticleAmount.get());
|
||||
|
@ -240,7 +233,7 @@ public class ClientEvents {
|
|||
for (Map.Entry<BlockPos, Integer> spot : spots.entrySet()) {
|
||||
BlockPos pos = spot.getKey();
|
||||
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.scalef(0.65F, 0.65F, 0.65F);
|
||||
mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0);
|
||||
|
@ -289,7 +282,7 @@ public class ClientEvents {
|
|||
return;
|
||||
box = box.grow(0.05F);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,10 +114,10 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
|||
if (type == RenderType.BODY && !isHolding) {
|
||||
boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.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.rotatef(180F, 1F, 0F, 0F);
|
||||
Helper.renderItemInWorld(stack);
|
||||
//Helper.renderItemInWorld(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
|
|||
GlStateManager.translatef(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
|
||||
GlStateManager.scalef(0.15F, 0.15F, 0.15F);
|
||||
GlStateManager.rotatef(180F, 1F, 0F, 0F);
|
||||
Helper.renderItemInWorld(stack);
|
||||
//Helper.renderItemInWorld(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ import net.minecraft.client.entity.player.ClientPlayerEntity;
|
|||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
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;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -74,17 +73,21 @@ public final class ParticleHandler {
|
|||
|
||||
if (player != null) {
|
||||
ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo();
|
||||
LightTexture lightmap = mc.gameRenderer.getLightTexture();
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.multMatrix(stack.getLast().getPositionMatrix());
|
||||
lightmap.enableLightmap();
|
||||
|
||||
RenderSystem.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.alphaFunc(516, 0.003921569F);
|
||||
GlStateManager.disableCull();
|
||||
RenderSystem.disableCull();
|
||||
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);
|
||||
Tessellator tessy = Tessellator.getInstance();
|
||||
|
@ -95,19 +98,21 @@ public final class ParticleHandler {
|
|||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
|
||||
GlStateManager.disableDepthTest();
|
||||
RenderSystem.disableDepthTest();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
for (Particle particle : PARTICLES_NO_DEPTH)
|
||||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.depthMask(true);
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableBlend();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.disableFog();
|
||||
|
||||
lightmap.disableLightmap();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,8 +74,6 @@ public class ParticleMagic extends Particle {
|
|||
float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY());
|
||||
float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ());
|
||||
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)};
|
||||
float f4 = 0.1F * this.particleScale;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
|
|||
super(entityRendererIn);
|
||||
}
|
||||
|
||||
// TODO Test this
|
||||
// TODO Fix this
|
||||
@Override
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue