Added new conveyor belt state and attempted to fix crates
This commit is contained in:
parent
787da0aeae
commit
a68490ba6f
10 changed files with 398 additions and 276 deletions
|
@ -11,7 +11,7 @@ import assemblyline.client.gui.GuiImprinter;
|
|||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.client.render.RenderArmbot;
|
||||
import assemblyline.client.render.RenderConveyorBelt;
|
||||
import assemblyline.client.render.RenderCrate;
|
||||
import assemblyline.client.render.RenderCrateOld;
|
||||
import assemblyline.client.render.RenderDetector;
|
||||
import assemblyline.client.render.RenderManipulator;
|
||||
import assemblyline.client.render.RenderRejector;
|
||||
|
@ -49,7 +49,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRejector.class, new RenderRejector());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDetector.class, new RenderDetector());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityManipulator.class, new RenderManipulator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrate.class, new RenderCrate());
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrate.class, new RenderCrateOld());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmbot.class, new RenderArmbot());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package assemblyline.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
@ -16,7 +11,7 @@ import net.minecraft.client.model.ModelRenderer;
|
|||
|
||||
public class ModelAngledBelt extends ModelBase
|
||||
{
|
||||
//fields
|
||||
// fields
|
||||
ModelRenderer MRoller1;
|
||||
ModelRenderer bBELT;
|
||||
ModelRenderer MRoller2;
|
||||
|
@ -60,8 +55,13 @@ public class ModelAngledBelt extends ModelBase
|
|||
setRotation(MRoller3, 0.7853982F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
public void render(float f5, boolean slantAdjust)
|
||||
{
|
||||
if (slantAdjust)
|
||||
bBELT.setRotationPoint(-7F, 21.5F, -7F);
|
||||
else
|
||||
bBELT.setRotationPoint(-7F, 23.5F, -8F);
|
||||
|
||||
MRoller1.render(f5);
|
||||
bBELT.render(f5);
|
||||
MRoller2.render(f5);
|
||||
|
|
|
@ -163,7 +163,7 @@ public class ModelConveyorBelt extends ModelBase
|
|||
setRotation(c1, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5, float radians, boolean front, boolean back, boolean above)
|
||||
public void render(float f5, float radians, boolean front, boolean back, boolean above, boolean legs)
|
||||
{
|
||||
boolean mid = front && back ? true : false;
|
||||
boolean leftCap = !front && back ? true : false;
|
||||
|
@ -220,6 +220,8 @@ public class ModelConveyorBelt extends ModelBase
|
|||
BRoller.render(f5);
|
||||
FRoller.render(f5);
|
||||
|
||||
if (legs)
|
||||
{
|
||||
// legs
|
||||
BRL.render(f5);
|
||||
BML.render(f5);
|
||||
|
@ -228,6 +230,7 @@ public class ModelConveyorBelt extends ModelBase
|
|||
FRL.render(f5);
|
||||
MRL.render(f5);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
GL11.glTranslatef((float) 0.0F, (float) 1.5F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "belt/frame0.png"));
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false);
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.blockDetector.blockID)
|
||||
|
|
|
@ -49,18 +49,52 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
|
|||
break;
|
||||
}
|
||||
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/frame" + frame + ".png");
|
||||
|
||||
if (slantType == SlantType.UP)
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/frame" + frame + ".png");
|
||||
GL11.glTranslatef(0f, 0.8f, -0.8f);
|
||||
GL11.glRotatef(180f, 0f, 1f, 1f);
|
||||
MODEL2.render(0.0625F);
|
||||
boolean slantAdjust = false;
|
||||
TileEntity test = tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord + tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord + tileEntity.getDirection().offsetZ);
|
||||
if (test != null)
|
||||
{
|
||||
if (test instanceof TileEntityConveyorBelt)
|
||||
{
|
||||
if (((TileEntityConveyorBelt) test).getSlant() == SlantType.TOP)
|
||||
{
|
||||
GL11.glRotatef(10f, 1f, 0f, 0f);
|
||||
slantAdjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
MODEL2.render(0.0625F, true);
|
||||
}
|
||||
else if (slantType == SlantType.DOWN)
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/frame" + frame + ".png");
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
boolean slantAdjust = false;
|
||||
TileEntity test = tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord - tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord - tileEntity.getDirection().offsetZ);
|
||||
if (test != null)
|
||||
{
|
||||
if (test instanceof TileEntityConveyorBelt)
|
||||
{
|
||||
if (((TileEntityConveyorBelt) test).getSlant() == SlantType.TOP)
|
||||
{
|
||||
GL11.glRotatef(-10f, 1f, 0f, 0f);
|
||||
GL11.glTranslatef(0f, 0.25f, 0f);
|
||||
slantAdjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
MODEL2.render(0.0625F, slantAdjust);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
MODEL2.render(0.0625F);
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png");
|
||||
GL11.glRotatef(180, 0f, 1f, 0f);
|
||||
GL11.glTranslatef(0f, -0.68f, 0f);
|
||||
MODEL.render(0.0625f, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -82,7 +116,7 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
|
|||
}
|
||||
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png");
|
||||
MODEL.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false);
|
||||
MODEL.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,187 +1,35 @@
|
|||
package assemblyline.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
|
||||
public class RenderCrate extends TileEntitySpecialRenderer
|
||||
public class RenderCrate implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
private final RenderBlocks renderBlocks = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8)
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (var1 instanceof TileEntityCrate)
|
||||
{
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) var1;
|
||||
|
||||
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||
|
||||
String itemName = "Empty";
|
||||
String amount = "";
|
||||
ItemStack itemStack = tileEntity.getStackInSlot(0);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
itemName = itemStack.getDisplayName();
|
||||
amount = itemStack.stackSize + "";
|
||||
}
|
||||
|
||||
for (int side = 2; side < 6; side++)
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||
this.setupLight(tileEntity, direction.offsetX, direction.offsetZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (side)
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
case 2:
|
||||
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
|
||||
float scale = 0.03125F;
|
||||
GL11.glScalef(0.6f * scale, 0.6f * scale, 0);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
|
||||
RenderEngine renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F))
|
||||
{
|
||||
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
this.renderText(itemName, side, 0.02f, x, y - 0.35f, z);
|
||||
|
||||
if (amount != "")
|
||||
{
|
||||
this.renderText(amount, side, 0.02f, x, y - 0.15f, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
|
||||
{
|
||||
World world = tileEntity.worldObj;
|
||||
|
||||
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference)) { return; }
|
||||
|
||||
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
float scale = 0.6F;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
|
||||
}
|
||||
|
||||
private void renderText(String text, int side, float maxScale, double x, double y, double z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glPolygonOffset(-10, -10);
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
float displayX = 1 / 16;
|
||||
float displayY = 1 / 16;
|
||||
float displayWidth = 1 - (2 / 16);
|
||||
float displayHeight = 1 - (2 / 16);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 3:
|
||||
GL11.glTranslatef(0, 1, 0);
|
||||
GL11.glRotatef(0, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
GL11.glTranslatef(1, 1, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslatef(0, 1, 1);
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(1, 1, 0);
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// Find Center
|
||||
GL11.glTranslatef(displayWidth / 2, 1F, displayHeight / 2);
|
||||
GL11.glRotatef(-90, 1, 0, 0);
|
||||
FontRenderer fontRenderer = this.getFontRenderer();
|
||||
|
||||
int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1);
|
||||
int lineHeight = fontRenderer.FONT_HEIGHT + 2;
|
||||
int requiredHeight = lineHeight * 1;
|
||||
float scaler = 0.8f;
|
||||
float scaleX = (displayWidth / requiredWidth);
|
||||
float scaleY = (displayHeight / requiredHeight);
|
||||
float scale = (float) scaleX * scaler;
|
||||
|
||||
if (maxScale > 0)
|
||||
{
|
||||
scale = Math.min(scale, maxScale);
|
||||
}
|
||||
|
||||
GL11.glScalef(scale, -scale, scale);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
int realHeight = (int) Math.floor(displayHeight / scale);
|
||||
int realWidth = (int) Math.floor(displayWidth / scale);
|
||||
|
||||
offsetX = (realWidth - requiredWidth) / 2;
|
||||
offsetY = (realHeight - requiredHeight) / 2;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
fontRenderer.drawString("\u00a7f" + text, offsetX - (realWidth / 2), 1 + offsetY - (realHeight / 2), 1);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
187
src/minecraft/assemblyline/client/render/RenderCrateOld.java
Normal file
187
src/minecraft/assemblyline/client/render/RenderCrateOld.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
package assemblyline.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
|
||||
public class RenderCrateOld extends TileEntitySpecialRenderer
|
||||
{
|
||||
private final RenderBlocks renderBlocks = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8)
|
||||
{
|
||||
if (var1 instanceof TileEntityCrate)
|
||||
{
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) var1;
|
||||
|
||||
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||
|
||||
String itemName = "Empty";
|
||||
String amount = "";
|
||||
ItemStack itemStack = tileEntity.getStackInSlot(0);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
itemName = itemStack.getDisplayName();
|
||||
amount = Integer.toString(itemStack.stackSize);
|
||||
}
|
||||
|
||||
for (int side = 2; side < 6; side++)
|
||||
{
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||
this.setupLight(tileEntity, direction.offsetX, direction.offsetZ);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 2:
|
||||
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
float scale = 0.03125F;
|
||||
GL11.glScalef(0.6f * scale, 0.6f * scale, 0);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
|
||||
RenderEngine renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||
EntityItem ei = new EntityItem(tileEntity.worldObj, 0.0, 0.0, 0.0, itemStack);
|
||||
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F))
|
||||
{
|
||||
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
this.renderText(itemName, side, 0.02f, x, y - 0.35f, z);
|
||||
|
||||
if (amount != "")
|
||||
{
|
||||
this.renderText(amount, side, 0.02f, x, y - 0.15f, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
|
||||
{
|
||||
World world = tileEntity.worldObj;
|
||||
|
||||
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference)) { return; }
|
||||
|
||||
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
float scale = 0.6F;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
|
||||
}
|
||||
|
||||
private void renderText(String text, int side, float maxScale, double x, double y, double z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glPolygonOffset(-10, -10);
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
float displayX = 1 / 16;
|
||||
float displayY = 1 / 16;
|
||||
float displayWidth = 1 - (2 / 16);
|
||||
float displayHeight = 1 - (2 / 16);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 3:
|
||||
GL11.glTranslatef(0, 1, 0);
|
||||
GL11.glRotatef(0, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
GL11.glTranslatef(1, 1, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslatef(0, 1, 1);
|
||||
GL11.glRotatef(90, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(1, 1, 0);
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
// Find Center
|
||||
GL11.glTranslatef(displayWidth / 2, 1F, displayHeight / 2);
|
||||
GL11.glRotatef(-90, 1, 0, 0);
|
||||
FontRenderer fontRenderer = this.getFontRenderer();
|
||||
|
||||
int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1);
|
||||
int lineHeight = fontRenderer.FONT_HEIGHT + 2;
|
||||
int requiredHeight = lineHeight * 1;
|
||||
float scaler = 0.8f;
|
||||
float scaleX = (displayWidth / requiredWidth);
|
||||
float scaleY = (displayHeight / requiredHeight);
|
||||
float scale = (float) scaleX * scaler;
|
||||
|
||||
if (maxScale > 0)
|
||||
{
|
||||
scale = Math.min(scale, maxScale);
|
||||
}
|
||||
|
||||
GL11.glScalef(scale, -scale, scale);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
int realHeight = (int) Math.floor(displayHeight / scale);
|
||||
int realWidth = (int) Math.floor(displayWidth / scale);
|
||||
|
||||
offsetX = (realWidth - requiredWidth) / 2;
|
||||
offsetY = (realHeight - requiredHeight) / 2;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
fontRenderer.drawString("\u00a7f" + text, offsetX - (realWidth / 2), 1 + offsetY - (realHeight / 2), 1);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -91,6 +91,12 @@ public class BlockCrate extends BlockMachine
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return super.getRenderType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a the itemStack the player is holding into the crate.
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package assemblyline.common.machine.belt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
@ -9,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
@ -33,6 +35,30 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
this.setCreativeTab(TabAssemblyLine.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (t != null && t instanceof TileEntityConveyorBelt)
|
||||
{
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
|
||||
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.98f, 1f);
|
||||
return;
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
this.setBlockBounds(0f, 0.68f, 0f, 1f, 0.98f, 1f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.3f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
|
@ -42,7 +68,14 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
{
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
|
||||
|
||||
if (tileEntity.getSlant() != SlantType.NONE) { return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1); }
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1);
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + 0.68f, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.98f, (double) z + this.maxZ);
|
||||
}
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
|
@ -57,7 +90,7 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
{
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
|
||||
|
||||
if (tileEntity.getSlant() != SlantType.NONE)
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
AxisAlignedBB boundBottom = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.3, z + 1);
|
||||
AxisAlignedBB boundTop = null;
|
||||
|
@ -83,7 +116,7 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
boundTop = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / -2);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
if (direction.offsetX > 0)
|
||||
{
|
||||
|
@ -115,6 +148,17 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
return;
|
||||
}
|
||||
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y + 0.68, z, x + 1, y + 0.98, z + 1);
|
||||
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(x, y, z, x + 1, y + 0.3, z + 1);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
{
|
||||
public enum SlantType
|
||||
{
|
||||
NONE, UP, DOWN
|
||||
NONE, UP, DOWN, TOP
|
||||
}
|
||||
|
||||
public static final int MAX_FRAME = 13;
|
||||
|
@ -120,7 +120,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
|
||||
if (this.isRunning())
|
||||
{
|
||||
if (this.ticks % (80) == 0) //sound is 4 seconds long (20 ticks/second)
|
||||
if (this.ticks % (10) == 0) //sound is 0.5 seconds long (20 ticks/second)
|
||||
Minecraft.getMinecraft().sndManager.playSound("assemblyline.conveyor", this.xCoord, this.yCoord, this.zCoord, 0.125f, 0.3f);
|
||||
|
||||
this.wheelRotation += 40;
|
||||
|
@ -131,7 +131,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
float wheelRotPct = wheelRotation / 360f;
|
||||
|
||||
// Sync the animation. Slant belts are slower.
|
||||
if (this.getSlant() == SlantType.NONE)
|
||||
if (this.getSlant() == SlantType.NONE || this.getSlant() == SlantType.TOP)
|
||||
{
|
||||
this.animFrame = (int) (wheelRotPct * MAX_FRAME);
|
||||
if (this.animFrame < 0)
|
||||
|
|
Loading…
Reference in a new issue