2015-10-23 14:24:12 +02:00
|
|
|
/*
|
|
|
|
* This file ("RenderLaserRelay.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-01-03 16:05:51 +01:00
|
|
|
* http://ellpeck.de/actaddlicense/
|
2015-10-23 14:24:12 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-01-03 16:05:51 +01:00
|
|
|
* © 2016 Ellpeck
|
2015-10-23 14:24:12 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
2015-10-23 14:24:12 +02:00
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
2016-01-08 13:31:58 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
2016-01-08 15:21:05 +01:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2015-10-23 14:24:12 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
2015-10-25 22:16:54 +01:00
|
|
|
|
2015-10-23 14:24:12 +02:00
|
|
|
public class RenderLaserRelay extends RenderTileEntity{
|
|
|
|
|
|
|
|
public RenderLaserRelay(ModelBaseAA model){
|
|
|
|
super(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-01-07 23:42:42 +01:00
|
|
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.pushMatrix();
|
|
|
|
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
|
|
|
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GlStateManager.translate(0.0F, -2.0F, 0.0F);
|
2015-10-23 14:24:12 +02:00
|
|
|
this.bindTexture(resLoc);
|
|
|
|
|
2016-01-08 13:31:58 +01:00
|
|
|
int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
|
2015-12-01 20:38:45 +01:00
|
|
|
if(meta == 0){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
|
|
|
GlStateManager.translate(0F, -2F, 0F);
|
2015-12-01 20:38:45 +01:00
|
|
|
}
|
|
|
|
else if(meta == 3){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(-90, 1F, 0F, 0F);
|
|
|
|
GlStateManager.translate(0F, -1F, 1F);
|
2015-12-01 20:38:45 +01:00
|
|
|
}
|
|
|
|
else if(meta == 2){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(90, 1F, 0F, 0F);
|
|
|
|
GlStateManager.translate(0F, -1F, -1F);
|
2015-12-01 20:38:45 +01:00
|
|
|
}
|
|
|
|
else if(meta == 4){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(90, 0F, 0F, 1F);
|
|
|
|
GlStateManager.translate(1F, -1F, 0F);
|
2015-12-01 20:38:45 +01:00
|
|
|
}
|
|
|
|
else if(meta == 5){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(90, 0F, 0F, -1F);
|
|
|
|
GlStateManager.translate(-1F, -1F, 0F);
|
2015-10-23 14:24:12 +02:00
|
|
|
}
|
|
|
|
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.scale(0.85F, 0.85F, 0.85F);
|
|
|
|
GlStateManager.translate(0F, 0.2657F, 0F);
|
2015-10-23 14:24:12 +02:00
|
|
|
theModel.render(0.0625F);
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.popMatrix();
|
2015-10-23 14:24:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|