shredder model, fixed pylon cable lighting

This commit is contained in:
Bob 2021-08-04 23:11:53 +02:00
parent 358f8a1d43
commit 22dca2d355
8 changed files with 7195 additions and 2603 deletions

View File

@ -181,8 +181,7 @@ public class ResourceManager {
public static final IModelCustom forcefield_top = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/forcefield_top.obj"));
//Shredder
public static final IModelCustom shredder_body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shredder_body.obj"));
public static final IModelCustom shredder_blade = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shredder_blade.obj"));
public static final IModelCustom shredder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/shredder.obj"));
//Bombs
public static final IModelCustom bomb_gadget = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/TheGadget3.obj"));
@ -452,6 +451,9 @@ public class ResourceManager {
public static final ResourceLocation forcefield_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_base.png");
public static final ResourceLocation forcefield_top_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_top.png");
//Shredder
public static final ResourceLocation shredder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/shredder.png");
//Bombs
public static final ResourceLocation bomb_gadget_tex = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_tex.png");
public static final ResourceLocation bomb_boy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lilboy.png");

View File

@ -8,37 +8,36 @@ import net.minecraft.tileentity.TileEntity;
public class RenderMachineShredder extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glRotatef(180, 0F, 1F, 0F);
bindTexture(ResourceManager.universal);
ResourceManager.shredder_body.renderAll();
bindTexture(ResourceManager.shredder_tex);
ResourceManager.shredder.renderPart("Base");
double side = 0.3D;
double height = 2.75D;
float rot = (System.currentTimeMillis() / 5) % 360;
GL11.glPushMatrix();
GL11.glTranslated(-0.25, 2.85, 0.4375/2);
GL11.glPushMatrix();
GL11.glTranslated(side, height, 0);
GL11.glRotatef(rot, 0F, 0F, 1F);
ResourceManager.shredder.renderPart("Blades1");
GL11.glPopMatrix();
GL11.glRotatef((System.currentTimeMillis() / 4) % 360, 0F, 0F, -1F);
bindTexture(ResourceManager.turbofan_blades_tex);
ResourceManager.shredder_blade.renderAll();
GL11.glPushMatrix();
GL11.glTranslated(-side, height, 0);
GL11.glRotatef(rot, 0F, 0F, -1F);
ResourceManager.shredder.renderPart("Blades2");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.25, 2.85, 0);
GL11.glRotatef((System.currentTimeMillis() / 4) % 360, 0F, 0F, 1F);
bindTexture(ResourceManager.turbofan_blades_tex);
GL11.glScaled(-1, 1, 1);
ResourceManager.shredder_blade.renderAll();
GL11.glPopMatrix();
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
}

View File

@ -3,13 +3,18 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ModEventHandler;
import com.hbm.render.model.ModelPylon;
import com.hbm.tileentity.conductor.TileEntityPylonRedWire;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
public class RenderPylon extends TileEntitySpecialRenderer {
@ -22,8 +27,8 @@ public class RenderPylon extends TileEntitySpecialRenderer {
}
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
TileEntityPylonRedWire pyl = (TileEntityPylonRedWire)tileentity;
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
TileEntityPylonRedWire pyl = (TileEntityPylonRedWire)te;
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F - ((1F / 16F) * 14F), (float) z + 0.5F);
GL11.glRotatef(180, 0F, 0F, 1F);
@ -41,10 +46,24 @@ public class RenderPylon extends TileEntitySpecialRenderer {
float wZ = (wire[2] - pyl.zCoord) / 2F;
float count = 10;
Vec3 delta = Vec3.createVectorHelper((wire[0] - te.xCoord), (wire[1] - te.yCoord), (wire[2] - te.zCoord));
for(float j = 0; j < count; j++) {
float k = j + 1;
double ja = j + 0.5D;
double ix = te.xCoord + 0.5 + delta.xCoord / (double)(count * 2) * ja;
double iy = te.yCoord + 0.5 + delta.yCoord / (double)(count * 2) * ja + 5 - Math.sin(j / count * Math.PI * 0.5);
double iz = te.zCoord + 0.5 + delta.zCoord / (double)(count * 2) * ja;
//te.getWorldObj().spawnParticle("reddust", ix, iy, iz, 0.01 + j * 0.1, 0, 0);
int brightness = te.getWorldObj().getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0);
int lX = brightness % 65536;
int lY = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F);
drawPowerLine(
x + 0.5 + (wX * j / count),
y + 5.4 + (wY * j / count) - Math.sin(j / count * Math.PI * 0.5),
@ -58,37 +77,35 @@ public class RenderPylon extends TileEntitySpecialRenderer {
}
public void drawPowerLine(double x, double y, double z, double a, double b, double c) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
//tessellator.setColorRGBA_F(0.683F, 0.089F, 0.0F, 1.0F);
tessellator.addVertex(x, y + 0.05F, z);
tessellator.addVertex(x, y - 0.05F, z);
tessellator.addVertex(a, b + 0.05F, c);
tessellator.addVertex(a, b - 0.05F, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
//tessellator.setColorRGBA_F(0.683F, 0.089F, 0.0F, 1.0F);
tessellator.addVertex(x + 0.05F, y, z);
tessellator.addVertex(x - 0.05F, y, z);
tessellator.addVertex(a + 0.05F, b, c);
tessellator.addVertex(a - 0.05F, b, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
//tessellator.setColorRGBA_F(0.683F, 0.089F, 0.0F, 1.0F);
tessellator.addVertex(x, y, z + 0.05F);
tessellator.addVertex(x, y, z - 0.05F);
tessellator.addVertex(a, b, c + 0.05F);
tessellator.addVertex(a, b, c - 0.05F);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y + 0.05F, z);
tessellator.addVertex(x, y - 0.05F, z);
tessellator.addVertex(a, b + 0.05F, c);
tessellator.addVertex(a, b - 0.05F, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x + 0.05F, y, z);
tessellator.addVertex(x - 0.05F, y, z);
tessellator.addVertex(a + 0.05F, b, c);
tessellator.addVertex(a - 0.05F, b, c);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(0xBB3311);
tessellator.addVertex(x, y, z + 0.05F);
tessellator.addVertex(x, y, z - 0.05F);
tessellator.addVertex(a, b, c + 0.05F);
tessellator.addVertex(a, b, c - 0.05F);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
}
}

View File

@ -46,7 +46,7 @@ public class TileEntityPylonRedWire extends TileEntity implements IConductor, IN
TileEntity pylon = worldObj.getTileEntity(con[0], con[1], con[2]);
if(pylon.isInvalid()) {
if(worldObj.blockExists(con[0], con[1], con[2]) && (pylon == null || pylon.isInvalid())) {
connected.remove(i);
continue;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB