mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-21 20:42:12 +00:00
added colored cubes to manipulator
This commit is contained in:
1 parent
bd1ec252e7
commit
0d59f9b90a
8 files changed
+118
-15
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package makeo.gadomancy.client.models;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by makeo @ 27.10.2015 23:40
|
||||
*/
|
||||
public class ModelSmallCube extends ModelBase {
|
||||
//fields
|
||||
ModelRenderer shape1;
|
||||
|
||||
public ModelSmallCube() {
|
||||
textureWidth = 8;
|
||||
textureHeight = 4;
|
||||
|
||||
shape1 = new ModelRenderer(this, 0, 0);
|
||||
shape1.addBox(-1F, -3F, -1F, 2, 2, 2);
|
||||
shape1.setRotationPoint(0F, 0F, 0F);
|
||||
shape1.setTextureSize(8, 4);
|
||||
shape1.mirror = true;
|
||||
setRotation(shape1, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
shape1.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
+45
-14
@@ -1,12 +1,12 @@
|
||||
package makeo.gadomancy.client.renderers.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileNodeManipulator;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.renderers.block.BlockStoneDeviceRenderer;
|
||||
import thaumcraft.common.blocks.BlockStoneDevice;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -16,30 +16,61 @@ import thaumcraft.client.renderers.block.BlockStoneDeviceRenderer;
|
||||
* <p/>
|
||||
* Created by makeo @ 27.10.2015 13:46
|
||||
*/
|
||||
public class BlockNodeManipulatorRenderer implements ISimpleBlockRenderingHandler {
|
||||
public static final BlockStoneDeviceRenderer PARENT_RENDERER = new BlockStoneDeviceRenderer();
|
||||
|
||||
public class BlockNodeManipulatorRenderer extends BlockStoneDeviceRenderer {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0, -0.1f, 0);
|
||||
GL11.glScalef(0.85f, 0.85f, 0.85f);
|
||||
|
||||
PARENT_RENDERER.renderInventoryBlock(block, 5, modelId, renderer);
|
||||
super.renderInventoryBlock(block, 5, modelId, renderer);
|
||||
|
||||
GL11.glTranslatef(0, 1f, 0);
|
||||
PARENT_RENDERER.renderInventoryBlock(block, 8, modelId, renderer);
|
||||
|
||||
renderWandPedestalFocus(block, renderer);
|
||||
RenderTileNodeManipulator.renderColorCubes(1, 1, 1, 1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return PARENT_RENDERER.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
}
|
||||
public static void renderWandPedestalFocus(Block block, RenderBlocks renderer) {
|
||||
block.setBlockBounds(W5, 0.0F, W5, W11, W1, W11);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
block.setBlockBounds(W1, 0.0F, W7, W5, W1, W9);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W11, 0.0F, W7, W15, W1, W9);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W7, 0.0F, W1, W9, W1, W5);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W7, 0.0F, W11, W9, W1, W15);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
float height = W7 - (2/16f);
|
||||
|
||||
block.setBlockBounds(W1, W1, W7, W3, height, W9);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W7, W1, W1, W9, height, W3);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W13, W1, W7, W15, height, W9);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
|
||||
block.setBlockBounds(W7, W1, W13, W9, height, W15);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
drawFaces(renderer, block, ((BlockStoneDevice) block).iconWandPedestalFocus[2], ((BlockStoneDevice) block).iconWandPedestalFocus[1], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], ((BlockStoneDevice) block).iconWandPedestalFocus[0], true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package makeo.gadomancy.client.renderers.tile;
|
||||
|
||||
import makeo.gadomancy.client.models.ModelSmallCube;
|
||||
import makeo.gadomancy.client.renderers.block.BlockNodeManipulatorRenderer;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.renderers.tile.TileWandPedestalRenderer;
|
||||
|
||||
@@ -17,6 +21,9 @@ import thaumcraft.client.renderers.tile.TileWandPedestalRenderer;
|
||||
* Created by makeo @ 27.10.2015 15:19
|
||||
*/
|
||||
public class RenderTileNodeManipulator extends TileWandPedestalRenderer {
|
||||
private static final ModelSmallCube MODEL = new ModelSmallCube();
|
||||
private static final SimpleResourceLocation TEXTURE = new SimpleResourceLocation("models/small_cube.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partitalTicks) {
|
||||
super.renderTileEntityAt(tile, x, y, z, partitalTicks);
|
||||
@@ -27,8 +34,31 @@ public class RenderTileNodeManipulator extends TileWandPedestalRenderer {
|
||||
GL11.glTranslatef(0.5f, 1.5f, 0.5f);
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
BlockNodeManipulatorRenderer.PARENT_RENDERER.renderInventoryBlock(RegisteredBlocks.blockNodeManipulator, 8, 0, RenderBlocks.getInstance());
|
||||
BlockNodeManipulatorRenderer.renderWandPedestalFocus(RegisteredBlocks.blockNodeManipulator, RenderBlocks.getInstance());
|
||||
|
||||
//TODO: add color
|
||||
renderColorCubes(1, 0.5f, 0, 1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderColorCubes(float r, float g, float b, float a) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(r, g, b, a);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||
GL11.glTranslatef(dir.offsetX * (-6/16f), 0, dir.offsetZ * (-6/16f));
|
||||
|
||||
MODEL.render(null, 0, 0, 0, 0, 0, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user