-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11adda7
commit 9acd2ec
Showing
8 changed files
with
2,708 additions
and
2,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/zmaster587/advancedRocketry/client/render/multiblocks/RendererSolarArray.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package zmaster587.advancedRocketry.client.render.multiblocks; | ||
|
||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.ResourceLocation; | ||
import org.lwjgl.opengl.GL11; | ||
import zmaster587.advancedRocketry.backwardCompat.ModelFormatException; | ||
import zmaster587.advancedRocketry.backwardCompat.WavefrontObject; | ||
import zmaster587.advancedRocketry.tile.multiblock.energy.TileSolarArray; | ||
import zmaster587.libVulpes.block.RotatableBlock; | ||
import zmaster587.libVulpes.tile.multiblock.TileMultiPowerConsumer; | ||
|
||
public class RendererSolarArray extends TileEntitySpecialRenderer { | ||
|
||
WavefrontObject model; | ||
|
||
ResourceLocation texture = new ResourceLocation("advancedrocketry:textures/models/solararray.png"); | ||
|
||
public RendererSolarArray(){ | ||
try { | ||
model = new WavefrontObject(new ResourceLocation("advancedrocketry:models/solar_array.obj")); | ||
} catch (ModelFormatException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void render(TileEntity tile, double x, | ||
double y, double z, float f, int distance, float a) { | ||
TileSolarArray multiBlockTile = (TileSolarArray)tile; | ||
|
||
if(!multiBlockTile.canRender()) | ||
return; | ||
|
||
GL11.glPushMatrix(); | ||
|
||
//Rotate and move the model into position | ||
EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); | ||
GL11.glTranslated(x + .5, y, z + .5); | ||
GL11.glRotatef((front.getFrontOffsetX() == 1 ? 0 : 180) + front.getFrontOffsetZ()*90f, 0, 1, 0); | ||
|
||
GL11.glTranslated(-0.5f, 0f, 0.5f); | ||
|
||
bindTexture(texture); | ||
|
||
model.renderAll(); | ||
|
||
GL11.glPopMatrix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.