mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 03:05:10 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
a314fccd1b
commit
8f026dad8f
161 files changed
+14073
-12846
No files matched your search
@@ -9,6 +9,7 @@ import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.particle.EntityLavaFX;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import team.chisel.block.BlockGrimstone;
|
||||
import team.chisel.block.BlockHolystone;
|
||||
import team.chisel.block.BlockLavastone;
|
||||
@@ -24,226 +25,269 @@ import team.chisel.utils.GeneralClient;
|
||||
|
||||
public class GeneralChiselClient {
|
||||
|
||||
public static Random rand = new Random();
|
||||
public static int tick = 0;
|
||||
public static Random rand = new Random();
|
||||
public static int tick = 0;
|
||||
|
||||
public static void spawnLavastoneFX(World world, BlockLavastone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
||||
return;
|
||||
public static void spawnLavastoneFX(World world, BlockLavastone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0
|
||||
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
||||
return;
|
||||
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
||||
return;
|
||||
if (world.getBlock(x, y, z).isOpaqueCube()) return;
|
||||
|
||||
EntityLavaFX res = new EntityLavaFX(world, x1, y1, z1);
|
||||
double multiplier = 0.45;
|
||||
res.motionX = -multiplier * (x1 - x - 0.5);
|
||||
res.motionY = multiplier * (y1 - y - 0.5);
|
||||
res.motionZ = -multiplier * (z1 - z - 0.5);
|
||||
EntityLavaFX res = new EntityLavaFX(world, x1, y1, z1);
|
||||
double multiplier = 0.45;
|
||||
res.motionX = -multiplier * (x1 - x - 0.5);
|
||||
res.motionY = multiplier * (y1 - y - 0.5);
|
||||
res.motionZ = -multiplier * (z1 - z - 0.5);
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
|
||||
public static void spawnHolystoneFX(World world, BlockHolystone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
||||
return;
|
||||
public static void spawnHolystoneFX(World world, BlockHolystone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0
|
||||
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
||||
return;
|
||||
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
||||
return;
|
||||
if (world.getBlock(x, y, z).isOpaqueCube()) return;
|
||||
|
||||
EntityHolystoneFX res = new EntityHolystoneFX(world, block, x1, y1, z1);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
EntityHolystoneFX res = new EntityHolystoneFX(world, block, x1, y1, z1);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
|
||||
public static void spawnGrimstoneFX(World world, BlockGrimstone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0)
|
||||
return;
|
||||
public static void spawnGrimstoneFX(World world, BlockGrimstone block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 && tick++ % Configurations.particlesTickrate != 0) return;
|
||||
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
||||
float f = 0.15F;
|
||||
double x1 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinX();
|
||||
double y1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinY();
|
||||
double z1 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
switch (rand.nextInt(6)) {
|
||||
case 0:
|
||||
y1 = y + block.getBlockBoundsMinY() - f;
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y1 = y + block.getBlockBoundsMaxY() + f;
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z1 = z + block.getBlockBoundsMinZ() - f;
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z1 = z + block.getBlockBoundsMaxZ() + f;
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x1 = x + block.getBlockBoundsMinX() - f;
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x1 = x + block.getBlockBoundsMaxX() + f;
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z).isOpaqueCube())
|
||||
return;
|
||||
if (world.getBlock(x, y, z).isOpaqueCube()) return;
|
||||
|
||||
EntityGrimstoneFX res = new EntityGrimstoneFX(world, block, x1, y1, z1);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
EntityGrimstoneFX res = new EntityGrimstoneFX(world, block, x1, y1, z1);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
|
||||
public static void spawnSnakestoneObsidianFX(World world, BlockSnakestoneObsidian block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 || tick++ % Configurations.particlesTickrate != 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||
EntitySnakestoneObsidianFX res = new EntitySnakestoneObsidianFX(world, block, x, y, z);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
}
|
||||
public static void spawnSnakestoneObsidianFX(World world, BlockSnakestoneObsidian block, int x, int y, int z) {
|
||||
if (Configurations.particlesTickrate != 0 || tick++ % Configurations.particlesTickrate != 0
|
||||
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||
EntitySnakestoneObsidianFX res = new EntitySnakestoneObsidianFX(world, block, x, y, z);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnBallOMossFX(World world, double x, double y, double z) {
|
||||
if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0 || Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||
EntityBallOMossFX res = new EntityBallOMossFX(world, x, y, z);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
}
|
||||
public static void spawnBallOMossFX(World world, double x, double y, double z) {
|
||||
if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0
|
||||
|| Minecraft.getMinecraft().gameSettings.particleSetting != 0) {
|
||||
EntityBallOMossFX res = new EntityBallOMossFX(world, x, y, z);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(res);
|
||||
}
|
||||
}
|
||||
|
||||
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0)
|
||||
return null;
|
||||
public static EntityDiggingFX addBlockHitEffects(World world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block.isAir(world, x, y, z) || Minecraft.getMinecraft().gameSettings.particleSetting != 0) return null;
|
||||
|
||||
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
|
||||
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
|
||||
|
||||
float f = 0.1F;
|
||||
double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F) + f + block.getBlockBoundsMinX();
|
||||
double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F) + f + block.getBlockBoundsMinY();
|
||||
double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F) + f + block.getBlockBoundsMinZ();
|
||||
float f = 0.1F;
|
||||
double d0 = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinX();
|
||||
double d1 = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinY();
|
||||
double d2 = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - f * 2.0F)
|
||||
+ f
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
switch (side) {
|
||||
case 0:
|
||||
d1 = y + block.getBlockBoundsMinY() - f;
|
||||
break;
|
||||
case 1:
|
||||
d1 = y + block.getBlockBoundsMaxY() + f;
|
||||
break;
|
||||
case 2:
|
||||
d2 = z + block.getBlockBoundsMinZ() - f;
|
||||
break;
|
||||
case 3:
|
||||
d2 = z + block.getBlockBoundsMaxZ() + f;
|
||||
break;
|
||||
case 4:
|
||||
d0 = x + block.getBlockBoundsMinX() - f;
|
||||
break;
|
||||
case 5:
|
||||
d0 = x + block.getBlockBoundsMaxX() + f;
|
||||
break;
|
||||
}
|
||||
switch (side) {
|
||||
case 0:
|
||||
d1 = y + block.getBlockBoundsMinY() - f;
|
||||
break;
|
||||
case 1:
|
||||
d1 = y + block.getBlockBoundsMaxY() + f;
|
||||
break;
|
||||
case 2:
|
||||
d2 = z + block.getBlockBoundsMinZ() - f;
|
||||
break;
|
||||
case 3:
|
||||
d2 = z + block.getBlockBoundsMaxZ() + f;
|
||||
break;
|
||||
case 4:
|
||||
d0 = x + block.getBlockBoundsMinX() - f;
|
||||
break;
|
||||
case 5:
|
||||
d0 = x + block.getBlockBoundsMaxX() + f;
|
||||
break;
|
||||
}
|
||||
|
||||
EntityDiggingFX res = new EntityDiggingFX(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, world.getBlockMetadata(x, y, z), side);
|
||||
res.motionX = d0 - (x + 0.5);
|
||||
res.motionY = d1 - (y + 0.5);
|
||||
res.motionZ = d2 - (z + 0.5);
|
||||
EntityDiggingFX res = new EntityDiggingFX(
|
||||
world,
|
||||
d0,
|
||||
d1,
|
||||
d2,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
block,
|
||||
world.getBlockMetadata(x, y, z),
|
||||
side);
|
||||
res.motionX = d0 - (x + 0.5);
|
||||
res.motionY = d1 - (y + 0.5);
|
||||
res.motionZ = d2 - (z + 0.5);
|
||||
|
||||
renderer.addEffect(res);
|
||||
renderer.addEffect(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void spawnChiselEffect(int x, int y, int z, String sound) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
for (int side = 0; side < 6; side++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side);
|
||||
if (fx == null)
|
||||
return;
|
||||
public static void spawnChiselEffect(int x, int y, int z, String sound) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
for (int side = 0; side < 6; side++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
EntityDiggingFX fx = addBlockHitEffects(Minecraft.getMinecraft().theWorld, x, y, z, side);
|
||||
if (fx == null) return;
|
||||
|
||||
fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat());
|
||||
fx.multiplyVelocity(0.3f * rand.nextFloat());
|
||||
}
|
||||
}
|
||||
fx.multipleParticleScaleBy(0.25f + 0.5f * rand.nextFloat());
|
||||
fx.multiplyVelocity(0.3f * rand.nextFloat());
|
||||
}
|
||||
}
|
||||
|
||||
GeneralClient.playChiselSound(world, x, y, z, sound);
|
||||
}
|
||||
GeneralClient.playChiselSound(world, x, y, z, sound);
|
||||
}
|
||||
|
||||
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) {
|
||||
if (base != null && Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
EntityDiggingFX particle = new EntityDiggingFX(te.getWorldObj(), te.xCoord + 0.5, te.yCoord + 0.95, te.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()),
|
||||
base.getItemDamage());
|
||||
particle.setVelocity((te.getWorldObj().rand.nextDouble() / 4) - 0.125, te.getWorldObj().rand.nextDouble() / 8, (te.getWorldObj().rand.nextDouble() / 4) - 0.125);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||
}
|
||||
String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage());
|
||||
GeneralClient.playChiselSound(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, sound);
|
||||
}
|
||||
}
|
||||
public static void spawnAutoChiselFX(TileEntityAutoChisel te, ItemStack base) {
|
||||
if (base != null && Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
EntityDiggingFX particle = new EntityDiggingFX(
|
||||
te.getWorldObj(),
|
||||
te.xCoord + 0.5,
|
||||
te.yCoord + 0.95,
|
||||
te.zCoord + 0.5,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Block.getBlockFromItem(base.getItem()),
|
||||
base.getItemDamage());
|
||||
particle.setVelocity(
|
||||
(te.getWorldObj().rand.nextDouble() / 4) - 0.125,
|
||||
te.getWorldObj().rand.nextDouble() / 8,
|
||||
(te.getWorldObj().rand.nextDouble() / 4) - 0.125);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||
}
|
||||
String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage());
|
||||
GeneralClient.playChiselSound(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, sound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,66 +18,74 @@ import com.google.common.collect.Lists;
|
||||
|
||||
public class GuiAutoChisel extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||
|
||||
private TileEntityAutoChisel autochisel;
|
||||
private TileEntityAutoChisel autochisel;
|
||||
|
||||
public GuiAutoChisel(InventoryPlayer inventoryPlayer, TileEntityAutoChisel tileEntityAutoChisel) {
|
||||
super(new ContainerAutoChisel(inventoryPlayer, tileEntityAutoChisel));
|
||||
autochisel = tileEntityAutoChisel;
|
||||
}
|
||||
public GuiAutoChisel(InventoryPlayer inventoryPlayer, TileEntityAutoChisel tileEntityAutoChisel) {
|
||||
super(new ContainerAutoChisel(inventoryPlayer, tileEntityAutoChisel));
|
||||
autochisel = tileEntityAutoChisel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick) {
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick) {
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
|
||||
for (Slot slot : (List<Slot>) inventorySlots.inventorySlots) {
|
||||
if (!slot.getHasStack() && mouseInside(slot, mouseX - x, mouseY - y)) {
|
||||
if (slot.slotNumber < autochisel.getSizeInventory()) {
|
||||
String tt = autochisel.getSlotTooltipUnloc(slot.slotNumber);
|
||||
if (!Strings.isNullOrEmpty(tt)) {
|
||||
this.func_146283_a(Lists.newArrayList(tt), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
}
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
|
||||
private boolean mouseInside(Slot slot, int x, int y) {
|
||||
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16 && y >= slot.yDisplayPosition && y <= slot.yDisplayPosition + 16;
|
||||
}
|
||||
for (Slot slot : (List<Slot>) inventorySlots.inventorySlots) {
|
||||
if (!slot.getHasStack() && mouseInside(slot, mouseX - x, mouseY - y)) {
|
||||
if (slot.slotNumber < autochisel.getSizeInventory()) {
|
||||
String tt = autochisel.getSlotTooltipUnloc(slot.slotNumber);
|
||||
if (!Strings.isNullOrEmpty(tt)) {
|
||||
this.func_146283_a(Lists.newArrayList(tt), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(gui);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
private boolean mouseInside(Slot slot, int x, int y) {
|
||||
return x >= slot.xDisplayPosition && x <= slot.xDisplayPosition + 16
|
||||
&& y >= slot.yDisplayPosition
|
||||
&& y <= slot.yDisplayPosition + 16;
|
||||
}
|
||||
|
||||
for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) {
|
||||
if (autochisel.getStackInSlot(i) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(gui);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0);
|
||||
}
|
||||
}
|
||||
for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) {
|
||||
if (autochisel.getStackInSlot(i) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||
padding /= 2;
|
||||
gui.drawTexturedModalRect(x + (slot.xDisplayPosition - padding), y + (slot.yDisplayPosition - padding), u, v, 18 + padding, 18 + padding);
|
||||
}
|
||||
if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||
padding /= 2;
|
||||
gui.drawTexturedModalRect(
|
||||
x + (slot.xDisplayPosition - padding),
|
||||
y + (slot.yDisplayPosition - padding),
|
||||
u,
|
||||
v,
|
||||
18 + padding,
|
||||
18 + padding);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static team.chisel.Chisel.MOD_ID;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -13,8 +10,10 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.client.gui.widgets.GuiButtonChiselMode;
|
||||
import team.chisel.inventory.ContainerChisel;
|
||||
import team.chisel.inventory.InventoryChiselSelection;
|
||||
@@ -24,12 +23,19 @@ import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessageChiselMode;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
import static team.chisel.Chisel.MOD_ID;
|
||||
import com.cricketcraft.chisel.api.IAdvancedChisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.IChiselMode;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiChisel extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||
MOD_ID,
|
||||
"textures/chisel2GuiScroll.png");
|
||||
public static final int TEXTURE_WIDTH = 266;
|
||||
public static final int TEXTURE_HEIGHT = 250;
|
||||
public static final int GUI_WIDTH = 266;
|
||||
@@ -84,8 +90,7 @@ public class GuiChisel extends GuiContainer {
|
||||
}
|
||||
|
||||
private boolean showMode() {
|
||||
return container.chisel != null
|
||||
&& container.chisel.getItem() instanceof IChiselItem
|
||||
return container.chisel != null && container.chisel.getItem() instanceof IChiselItem
|
||||
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
|
||||
}
|
||||
|
||||
@@ -94,11 +99,16 @@ public class GuiChisel extends GuiContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
|
||||
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||
fontRendererObj
|
||||
.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
|
||||
|
||||
if (showMode()) {
|
||||
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
|
||||
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
modeText,
|
||||
12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2,
|
||||
122,
|
||||
0x404040);
|
||||
}
|
||||
|
||||
scrollBar.draw(this);
|
||||
@@ -115,7 +125,15 @@ public class GuiChisel extends GuiContainer {
|
||||
|
||||
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
||||
if (main.getStack() == null) {
|
||||
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
func_146110_a(
|
||||
guiLeft + 8,
|
||||
guiTop + 8,
|
||||
0,
|
||||
GUI_HEIGHT,
|
||||
CHISEL_INPUT_SIZE,
|
||||
CHISEL_INPUT_SIZE,
|
||||
TEXTURE_WIDTH,
|
||||
TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.config.Configurations;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
|
||||
public class GuiChiselConfig extends GuiConfig {
|
||||
|
||||
public GuiChiselConfig(GuiScreen parent) {
|
||||
super(parent, new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Chisel.MOD_ID, false, false, GuiConfig
|
||||
.getAbridgedConfigPath(Configurations.config.toString()));
|
||||
}
|
||||
public GuiChiselConfig(GuiScreen parent) {
|
||||
super(
|
||||
parent,
|
||||
new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL))
|
||||
.getChildElements(),
|
||||
Chisel.MOD_ID,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(Configurations.config.toString()));
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,28 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return GuiChiselConfig.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return GuiChiselConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,22 +11,22 @@ import team.chisel.inventory.ContainerPresent;
|
||||
|
||||
public class GuiPresent extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/present-gui.png");
|
||||
private int rows;
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/present-gui.png");
|
||||
private int rows;
|
||||
|
||||
public GuiPresent(InventoryPlayer inventoryPlayer, TileEntityPresent tileEntityPresent) {
|
||||
super(new ContainerPresent(inventoryPlayer, tileEntityPresent));
|
||||
rows = tileEntityPresent.getSizeInventory() / 9;
|
||||
this.ySize = 114 + rows * 18;
|
||||
}
|
||||
public GuiPresent(InventoryPlayer inventoryPlayer, TileEntityPresent tileEntityPresent) {
|
||||
super(new ContainerPresent(inventoryPlayer, tileEntityPresent));
|
||||
rows = tileEntityPresent.getSizeInventory() / 9;
|
||||
this.ySize = 114 + rows * 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(gui);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
||||
this.drawTexturedModalRect(x, y + this.rows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(gui);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
|
||||
this.drawTexturedModalRect(x, y + this.rows * 18 + 17, 0, 126, this.xSize, 96);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
package team.chisel.client.gui;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.inventory.ContainerChisel;
|
||||
import team.chisel.network.PacketHandler;
|
||||
import team.chisel.network.message.MessageScrollUpdate;
|
||||
|
||||
public class GuiScrollbar {
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation("minecraft", "textures/gui/container/creative_inventory/tabs.png");
|
||||
|
||||
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(
|
||||
"minecraft",
|
||||
"textures/gui/container/creative_inventory/tabs.png");
|
||||
|
||||
private int displayX = 0;
|
||||
private int displayY = 0;
|
||||
@@ -21,7 +26,8 @@ public class GuiScrollbar {
|
||||
private ContainerChisel container;
|
||||
|
||||
public void draw(GuiChisel g) {
|
||||
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking vanilla one
|
||||
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking
|
||||
// vanilla one
|
||||
g.mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
|
||||
@@ -1,106 +1,119 @@
|
||||
package team.chisel.client.gui.widgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import team.chisel.item.chisel.ChiselMode;
|
||||
|
||||
import static team.chisel.client.gui.GuiChisel.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.client.gui.GuiChisel;
|
||||
import team.chisel.item.chisel.ChiselMode;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonChiselMode extends GuiButton {
|
||||
public static final int BUTTON_WIDTH = 48;
|
||||
public static final int BUTTON_HEIGHT = 48;
|
||||
private static final float BUTTON_BACKGROUND_U = 48;
|
||||
private static final float BUTTON_BACKGROUND_V = 202;
|
||||
private static final float MODE_VIGNETTE_U = BUTTON_BACKGROUND_U + 2 * BUTTON_WIDTH + 3;
|
||||
private static final float MODE_VIGNETTE_V = BUTTON_BACKGROUND_V + 3;
|
||||
private static final int MODE_VIGNETTE_WIDTH = 14;
|
||||
private static final int MODE_VIGNETTE_ROW_WIDTH = 3 * MODE_VIGNETTE_WIDTH;
|
||||
private static final int MODE_VIGNETTE_HEIGHT = 14;
|
||||
private static final int MODE_VIGNETTE_COL_HEIGHT = 3 * MODE_VIGNETTE_HEIGHT;
|
||||
private final GuiChisel guiChisel;
|
||||
|
||||
public GuiButtonChiselMode(int id, int x, int y, GuiChisel guiChisel) {
|
||||
super(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, "");
|
||||
this.guiChisel = guiChisel;
|
||||
}
|
||||
public static final int BUTTON_WIDTH = 48;
|
||||
public static final int BUTTON_HEIGHT = 48;
|
||||
private static final float BUTTON_BACKGROUND_U = 48;
|
||||
private static final float BUTTON_BACKGROUND_V = 202;
|
||||
private static final float MODE_VIGNETTE_U = BUTTON_BACKGROUND_U + 2 * BUTTON_WIDTH + 3;
|
||||
private static final float MODE_VIGNETTE_V = BUTTON_BACKGROUND_V + 3;
|
||||
private static final int MODE_VIGNETTE_WIDTH = 14;
|
||||
private static final int MODE_VIGNETTE_ROW_WIDTH = 3 * MODE_VIGNETTE_WIDTH;
|
||||
private static final int MODE_VIGNETTE_HEIGHT = 14;
|
||||
private static final int MODE_VIGNETTE_COL_HEIGHT = 3 * MODE_VIGNETTE_HEIGHT;
|
||||
private final GuiChisel guiChisel;
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*
|
||||
* @param mc The Minecraft instance
|
||||
* @param mouseX The horizontal location of the mouse within the GuiScreen
|
||||
* @param mouseY The vertical location of the mouse relative to the GuiScreen
|
||||
*/
|
||||
@Override
|
||||
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Mouse Hover State
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
drawButtonBackgroundLayer();
|
||||
drawButtonForegroundLayer();
|
||||
}
|
||||
}
|
||||
public GuiButtonChiselMode(int id, int x, int y, GuiChisel guiChisel) {
|
||||
super(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, "");
|
||||
this.guiChisel = guiChisel;
|
||||
}
|
||||
|
||||
private void drawButtonBackgroundLayer() {
|
||||
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(this.xPosition, this.yPosition, u, BUTTON_BACKGROUND_V, this.width, this.height, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*
|
||||
* @param mc The Minecraft instance
|
||||
* @param mouseX The horizontal location of the mouse within the GuiScreen
|
||||
* @param mouseY The vertical location of the mouse relative to the GuiScreen
|
||||
*/
|
||||
@Override
|
||||
public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
|
||||
if (this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Mouse Hover State
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
drawButtonBackgroundLayer();
|
||||
drawButtonForegroundLayer();
|
||||
}
|
||||
}
|
||||
|
||||
private void drawButtonForegroundLayer() {
|
||||
final int xBase = this.xPosition + 3;
|
||||
final int yBase = this.yPosition + 3;
|
||||
final float uBase = MODE_VIGNETTE_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
final float u;
|
||||
final float v;
|
||||
final int w;
|
||||
final int h;
|
||||
final int x;
|
||||
final int y;
|
||||
switch ((ChiselMode) guiChisel.getCurrentMode()) {
|
||||
case SINGLE:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case ROW:
|
||||
x = xBase;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case COLUMN:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
case PANEL:
|
||||
x = xBase;
|
||||
y = yBase;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(x, y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
private void drawButtonBackgroundLayer() {
|
||||
final float u = BUTTON_BACKGROUND_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
u,
|
||||
BUTTON_BACKGROUND_V,
|
||||
this.width,
|
||||
this.height,
|
||||
TEXTURE_WIDTH,
|
||||
TEXTURE_HEIGHT);
|
||||
}
|
||||
|
||||
private void drawButtonForegroundLayer() {
|
||||
final int xBase = this.xPosition + 3;
|
||||
final int yBase = this.yPosition + 3;
|
||||
final float uBase = MODE_VIGNETTE_U + (this.field_146123_n ? BUTTON_WIDTH : 0);
|
||||
final float u;
|
||||
final float v;
|
||||
final int w;
|
||||
final int h;
|
||||
final int x;
|
||||
final int y;
|
||||
switch ((ChiselMode) guiChisel.getCurrentMode()) {
|
||||
case SINGLE:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case ROW:
|
||||
x = xBase;
|
||||
y = yBase + MODE_VIGNETTE_HEIGHT;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V + MODE_VIGNETTE_HEIGHT;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_HEIGHT;
|
||||
break;
|
||||
case COLUMN:
|
||||
x = xBase + MODE_VIGNETTE_WIDTH;
|
||||
y = yBase;
|
||||
u = uBase + MODE_VIGNETTE_WIDTH;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
case PANEL:
|
||||
x = xBase;
|
||||
y = yBase;
|
||||
u = uBase;
|
||||
v = MODE_VIGNETTE_V;
|
||||
w = MODE_VIGNETTE_ROW_WIDTH;
|
||||
h = MODE_VIGNETTE_COL_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
|
||||
func_146110_a(x, y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
@@ -7,288 +7,296 @@ import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksEldritch extends RenderBlocks {
|
||||
|
||||
RenderBlocksEldritch() {
|
||||
super();
|
||||
}
|
||||
RenderBlocksEldritch() {
|
||||
super();
|
||||
}
|
||||
|
||||
static double displacementMap[] = { +0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548, -0.1077, +0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136, +0.0307,
|
||||
+0.0316, -0.1066, -0.0237, +0.0614, -0.0864, +0.0837, +0.1218, +0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255, +0.0830, -0.0361, +0.0965, +0.0646, +0.1124,
|
||||
+0.0890, -0.0037, +0.0467, +0.1025, +0.1161, +0.0014, +0.0365, +0.0755, -0.0025, +0.0739, +0.0656, +0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138, -0.0899,
|
||||
-0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638, +0.0865, +0.0029, -0.0084, +0.1132, -0.0433, +0.0115, +0.0850, +0.0439, +0.0748, +0.0460, -0.0441, +0.0839, +0.0162,
|
||||
-0.0229, +0.0774, -0.0647, -0.0636, -0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996, -0.0298, -0.1035, -0.0006, +0.0530, -0.0939, -0.1210, +0.0176, +0.0924, +0.0343,
|
||||
-0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042, +0.0232, +0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491, +0.0017, -0.1240, +0.0687, -0.1160, +0.1123,
|
||||
-0.0332, -0.0260, +0.0476, -0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781, -0.0648, +0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152, +0.0131,
|
||||
-0.0754, +0.0607, +0.0876, -0.0657, +0.0366, -0.0981, +0.1164, -0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041, +0.1011, +0.0042, -0.0045, -0.1031, +0.0110,
|
||||
+0.0058, +0.0083, -0.0782, -0.1003, -0.0082, -0.0304, -0.0971, -0.0097, -0.0208, -0.1059, -0.0239, -0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208, +0.0305,
|
||||
+0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015, +0.0061, +0.0861, -0.1057, -0.0889, -0.0972, +0.0783, -0.1052, -0.0932, -0.1103, +0.0497, +0.1222, -0.0146, +0.0632,
|
||||
-0.0240, -0.0193, +0.0676, -0.1128, -0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124, -0.0820, -0.1013, -0.0836, -0.0981, -0.0502, +0.0573, +0.0616, -0.0458, +0.0294,
|
||||
+0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505, -0.0313, +0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100, -0.0897, -0.0409, -0.1161, +0.0212, +0.1229,
|
||||
-0.0945, +0.0341, +0.1238, +0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408, +0.0920, +0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991, };
|
||||
static double displacementMap[] = { +0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548, -0.1077,
|
||||
+0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136, +0.0307, +0.0316, -0.1066, -0.0237, +0.0614,
|
||||
-0.0864, +0.0837, +0.1218, +0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255, +0.0830,
|
||||
-0.0361, +0.0965, +0.0646, +0.1124, +0.0890, -0.0037, +0.0467, +0.1025, +0.1161, +0.0014, +0.0365, +0.0755,
|
||||
-0.0025, +0.0739, +0.0656, +0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138, -0.0899,
|
||||
-0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638, +0.0865, +0.0029, -0.0084, +0.1132, -0.0433,
|
||||
+0.0115, +0.0850, +0.0439, +0.0748, +0.0460, -0.0441, +0.0839, +0.0162, -0.0229, +0.0774, -0.0647, -0.0636,
|
||||
-0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996, -0.0298, -0.1035, -0.0006, +0.0530, -0.0939,
|
||||
-0.1210, +0.0176, +0.0924, +0.0343, -0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042, +0.0232,
|
||||
+0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491, +0.0017, -0.1240, +0.0687, -0.1160, +0.1123,
|
||||
-0.0332, -0.0260, +0.0476, -0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781, -0.0648,
|
||||
+0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152, +0.0131, -0.0754, +0.0607, +0.0876, -0.0657,
|
||||
+0.0366, -0.0981, +0.1164, -0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041, +0.1011,
|
||||
+0.0042, -0.0045, -0.1031, +0.0110, +0.0058, +0.0083, -0.0782, -0.1003, -0.0082, -0.0304, -0.0971, -0.0097,
|
||||
-0.0208, -0.1059, -0.0239, -0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208, +0.0305,
|
||||
+0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015, +0.0061, +0.0861, -0.1057, -0.0889, -0.0972,
|
||||
+0.0783, -0.1052, -0.0932, -0.1103, +0.0497, +0.1222, -0.0146, +0.0632, -0.0240, -0.0193, +0.0676, -0.1128,
|
||||
-0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124, -0.0820, -0.1013, -0.0836, -0.0981, -0.0502,
|
||||
+0.0573, +0.0616, -0.0458, +0.0294, +0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505, -0.0313,
|
||||
+0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100, -0.0897, -0.0409, -0.1161, +0.0212, +0.1229,
|
||||
-0.0945, +0.0341, +0.1238, +0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408, +0.0920,
|
||||
+0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991, };
|
||||
|
||||
static int dmap1 = displacementMap.length * 1 / 6;
|
||||
static int dmap2 = displacementMap.length * 2 / 6;
|
||||
static int dmap3 = displacementMap.length * 3 / 6;
|
||||
static int dmap4 = displacementMap.length * 4 / 6;
|
||||
static int dmap5 = displacementMap.length * 5 / 6;
|
||||
static int dmap = displacementMap.length;
|
||||
static int dmap1 = displacementMap.length * 1 / 6;
|
||||
static int dmap2 = displacementMap.length * 2 / 6;
|
||||
static int dmap3 = displacementMap.length * 3 / 6;
|
||||
static int dmap4 = displacementMap.length * 4 / 6;
|
||||
static int dmap5 = displacementMap.length * 5 / 6;
|
||||
static int dmap = displacementMap.length;
|
||||
|
||||
Tessellator tessellator;
|
||||
double[] X = new double[14];
|
||||
double[] Y = new double[14];
|
||||
double[] Z = new double[14];
|
||||
double[] U = new double[14];
|
||||
double[] V = new double[14];
|
||||
int[] L = new int[14];
|
||||
float[] R = new float[14];
|
||||
float[] G = new float[14];
|
||||
float[] B = new float[14];
|
||||
Tessellator tessellator;
|
||||
double[] X = new double[14];
|
||||
double[] Y = new double[14];
|
||||
double[] Z = new double[14];
|
||||
double[] U = new double[14];
|
||||
double[] V = new double[14];
|
||||
int[] L = new int[14];
|
||||
float[] R = new float[14];
|
||||
float[] G = new float[14];
|
||||
float[] B = new float[14];
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
int index = x + y * 34573 + z * 32465781;
|
||||
if (index < 0)
|
||||
index = -index;
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
int index = x + y * 34573 + z * 32465781;
|
||||
if (index < 0) index = -index;
|
||||
|
||||
X[0] = x;
|
||||
Z[0] = z;
|
||||
Y[0] = y;
|
||||
X[0] = x;
|
||||
Z[0] = z;
|
||||
Y[0] = y;
|
||||
|
||||
X[1] = x;
|
||||
Z[1] = z;
|
||||
Y[1] = y + 1;
|
||||
X[1] = x;
|
||||
Z[1] = z;
|
||||
Y[1] = y + 1;
|
||||
|
||||
X[2] = x + 1;
|
||||
Z[2] = z;
|
||||
Y[2] = y + 1;
|
||||
X[2] = x + 1;
|
||||
Z[2] = z;
|
||||
Y[2] = y + 1;
|
||||
|
||||
X[3] = x + 1;
|
||||
Z[3] = z;
|
||||
Y[3] = y;
|
||||
X[3] = x + 1;
|
||||
Z[3] = z;
|
||||
Y[3] = y;
|
||||
|
||||
X[4] = x;
|
||||
Z[4] = z + 1;
|
||||
Y[4] = y;
|
||||
X[4] = x;
|
||||
Z[4] = z + 1;
|
||||
Y[4] = y;
|
||||
|
||||
X[5] = x;
|
||||
Z[5] = z + 1;
|
||||
Y[5] = y + 1;
|
||||
X[5] = x;
|
||||
Z[5] = z + 1;
|
||||
Y[5] = y + 1;
|
||||
|
||||
X[6] = x + 1;
|
||||
Z[6] = z + 1;
|
||||
Y[6] = y + 1;
|
||||
X[6] = x + 1;
|
||||
Z[6] = z + 1;
|
||||
Y[6] = y + 1;
|
||||
|
||||
X[7] = x + 1;
|
||||
Z[7] = z + 1;
|
||||
Y[7] = y;
|
||||
X[7] = x + 1;
|
||||
Z[7] = z + 1;
|
||||
Y[7] = y;
|
||||
|
||||
X[8] = x + 0.5 + displacementMap[(index + 0) % dmap];
|
||||
Z[8] = z - displacementMap[(index + 10) % dmap];
|
||||
Y[8] = y + 0.5 + displacementMap[(index + 20) % dmap];
|
||||
X[8] = x + 0.5 + displacementMap[(index + 0) % dmap];
|
||||
Z[8] = z - displacementMap[(index + 10) % dmap];
|
||||
Y[8] = y + 0.5 + displacementMap[(index + 20) % dmap];
|
||||
|
||||
X[9] = x - displacementMap[(index + 0 + dmap1) % dmap];
|
||||
Z[9] = z + 0.5 + displacementMap[(index + 10 + dmap1) % dmap];
|
||||
Y[9] = y + 0.5 + displacementMap[(index + 20 + dmap1) % dmap];
|
||||
X[9] = x - displacementMap[(index + 0 + dmap1) % dmap];
|
||||
Z[9] = z + 0.5 + displacementMap[(index + 10 + dmap1) % dmap];
|
||||
Y[9] = y + 0.5 + displacementMap[(index + 20 + dmap1) % dmap];
|
||||
|
||||
X[10] = x + 0.5 + displacementMap[(index + 0 + dmap2) % dmap];
|
||||
Z[10] = z + 1 + displacementMap[(index + 10 + dmap2) % dmap];
|
||||
Y[10] = y + 0.5 + displacementMap[(index + 20 + dmap2) % dmap];
|
||||
X[10] = x + 0.5 + displacementMap[(index + 0 + dmap2) % dmap];
|
||||
Z[10] = z + 1 + displacementMap[(index + 10 + dmap2) % dmap];
|
||||
Y[10] = y + 0.5 + displacementMap[(index + 20 + dmap2) % dmap];
|
||||
|
||||
X[11] = x + 1 + displacementMap[(index + 0 + dmap3) % dmap];
|
||||
Z[11] = z + 0.5 + displacementMap[(index + 10 + dmap3) % dmap];
|
||||
Y[11] = y + 0.5 + displacementMap[(index + 20 + dmap3) % dmap];
|
||||
X[11] = x + 1 + displacementMap[(index + 0 + dmap3) % dmap];
|
||||
Z[11] = z + 0.5 + displacementMap[(index + 10 + dmap3) % dmap];
|
||||
Y[11] = y + 0.5 + displacementMap[(index + 20 + dmap3) % dmap];
|
||||
|
||||
X[12] = x + 0.5 + displacementMap[(index + 0 + dmap4) % dmap];
|
||||
Z[12] = z + 0.5 + displacementMap[(index + 10 + dmap4) % dmap];
|
||||
Y[12] = y + 1;// +displacementMap[(index+20+dmap4)%dmap];
|
||||
X[12] = x + 0.5 + displacementMap[(index + 0 + dmap4) % dmap];
|
||||
Z[12] = z + 0.5 + displacementMap[(index + 10 + dmap4) % dmap];
|
||||
Y[12] = y + 1;// +displacementMap[(index+20+dmap4)%dmap];
|
||||
|
||||
X[13] = x + 0.5 + displacementMap[(index + 0 + dmap5) % dmap];
|
||||
Z[13] = z + 0.5 + displacementMap[(index + 10 + dmap5) % dmap];
|
||||
Y[13] = y + 0;// +displacementMap[(index+20+dmap5)%dmap];
|
||||
X[13] = x + 0.5 + displacementMap[(index + 0 + dmap5) % dmap];
|
||||
Z[13] = z + 0.5 + displacementMap[(index + 10 + dmap5) % dmap];
|
||||
Y[13] = y + 0;// +displacementMap[(index+20+dmap5)%dmap];
|
||||
|
||||
tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
|
||||
return super.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return super.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td) {
|
||||
L[a] = brightnessBottomLeft;
|
||||
L[b] = brightnessBottomRight;
|
||||
L[c] = brightnessTopRight;
|
||||
L[d] = brightnessTopLeft;
|
||||
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
|
||||
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td) {
|
||||
L[a] = brightnessBottomLeft;
|
||||
L[b] = brightnessBottomRight;
|
||||
L[c] = brightnessTopRight;
|
||||
L[d] = brightnessTopLeft;
|
||||
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
|
||||
|
||||
R[a] = colorRedBottomLeft;
|
||||
R[b] = colorRedBottomRight;
|
||||
R[c] = colorRedTopRight;
|
||||
R[d] = colorRedTopLeft;
|
||||
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
|
||||
R[a] = colorRedBottomLeft;
|
||||
R[b] = colorRedBottomRight;
|
||||
R[c] = colorRedTopRight;
|
||||
R[d] = colorRedTopLeft;
|
||||
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
|
||||
|
||||
G[a] = colorGreenBottomLeft;
|
||||
G[b] = colorGreenBottomRight;
|
||||
G[c] = colorGreenTopRight;
|
||||
G[d] = colorGreenTopLeft;
|
||||
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
|
||||
G[a] = colorGreenBottomLeft;
|
||||
G[b] = colorGreenBottomRight;
|
||||
G[c] = colorGreenTopRight;
|
||||
G[d] = colorGreenTopLeft;
|
||||
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
|
||||
|
||||
B[a] = colorBlueBottomLeft;
|
||||
B[b] = colorBlueBottomRight;
|
||||
B[c] = colorBlueTopRight;
|
||||
B[d] = colorBlueTopLeft;
|
||||
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
|
||||
B[a] = colorBlueBottomLeft;
|
||||
B[b] = colorBlueBottomRight;
|
||||
B[c] = colorBlueTopRight;
|
||||
B[d] = colorBlueTopLeft;
|
||||
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
|
||||
|
||||
double u0 = icon.getMaxU();
|
||||
double u1 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double v1 = icon.getMinV();
|
||||
double u0 = icon.getMaxU();
|
||||
double u1 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double v1 = icon.getMinV();
|
||||
|
||||
U[ta] = u0;
|
||||
U[tb] = u0;
|
||||
U[tc] = u1;
|
||||
U[td] = u1;
|
||||
U[e] = icon.getInterpolatedU(8.0D);
|
||||
U[ta] = u0;
|
||||
U[tb] = u0;
|
||||
U[tc] = u1;
|
||||
U[td] = u1;
|
||||
U[e] = icon.getInterpolatedU(8.0D);
|
||||
|
||||
V[ta] = v0;
|
||||
V[tb] = v1;
|
||||
V[tc] = v1;
|
||||
V[td] = v0;
|
||||
V[e] = icon.getInterpolatedV(8.0D);
|
||||
}
|
||||
V[ta] = v0;
|
||||
V[tb] = v1;
|
||||
V[tc] = v1;
|
||||
V[td] = v0;
|
||||
V[e] = icon.getInterpolatedV(8.0D);
|
||||
}
|
||||
|
||||
void vert(int index) {
|
||||
if (enableAO) {
|
||||
tessellator.setColorOpaque_F(R[index], G[index], B[index]);
|
||||
tessellator.setBrightness(L[index]);
|
||||
}
|
||||
void vert(int index) {
|
||||
if (enableAO) {
|
||||
tessellator.setColorOpaque_F(R[index], G[index], B[index]);
|
||||
tessellator.setBrightness(L[index]);
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]);
|
||||
}
|
||||
tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 1, 0, 4, 5, 9, 4, 5, 1, 0);
|
||||
vert(1);
|
||||
vert(0);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(0);
|
||||
vert(4);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(4);
|
||||
vert(5);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(5);
|
||||
vert(1);
|
||||
vert(9);
|
||||
vert(9);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 1, 0, 4, 5, 9, 4, 5, 1, 0);
|
||||
vert(1);
|
||||
vert(0);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(0);
|
||||
vert(4);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(4);
|
||||
vert(5);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(5);
|
||||
vert(1);
|
||||
vert(9);
|
||||
vert(9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 3, 2, 6, 7, 11, 3, 2, 6, 7);
|
||||
vert(6);
|
||||
vert(7);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(7);
|
||||
vert(3);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(3);
|
||||
vert(2);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(2);
|
||||
vert(6);
|
||||
vert(11);
|
||||
vert(11);
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 3, 2, 6, 7, 11, 3, 2, 6, 7);
|
||||
vert(6);
|
||||
vert(7);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(7);
|
||||
vert(3);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(3);
|
||||
vert(2);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(2);
|
||||
vert(6);
|
||||
vert(11);
|
||||
vert(11);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 3, 0, 1, 8, 0, 1, 2, 3);
|
||||
vert(0);
|
||||
vert(1);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(1);
|
||||
vert(2);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(2);
|
||||
vert(3);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(3);
|
||||
vert(0);
|
||||
vert(8);
|
||||
vert(8);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 3, 0, 1, 8, 0, 1, 2, 3);
|
||||
vert(0);
|
||||
vert(1);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(1);
|
||||
vert(2);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(2);
|
||||
vert(3);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(3);
|
||||
vert(0);
|
||||
vert(8);
|
||||
vert(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 4, 7, 6, 5, 10, 7, 6, 5, 4);
|
||||
vert(5);
|
||||
vert(4);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(6);
|
||||
vert(5);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(7);
|
||||
vert(6);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(4);
|
||||
vert(7);
|
||||
vert(10);
|
||||
vert(10);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 4, 7, 6, 5, 10, 7, 6, 5, 4);
|
||||
vert(5);
|
||||
vert(4);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(6);
|
||||
vert(5);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(7);
|
||||
vert(6);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(4);
|
||||
vert(7);
|
||||
vert(10);
|
||||
vert(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 0, 3, 7, 4, 13, 0, 3, 7, 4);
|
||||
vert(0);
|
||||
vert(3);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(3);
|
||||
vert(7);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(7);
|
||||
vert(4);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(4);
|
||||
vert(0);
|
||||
vert(13);
|
||||
vert(13);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 0, 3, 7, 4, 13, 0, 3, 7, 4);
|
||||
vert(0);
|
||||
vert(3);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(3);
|
||||
vert(7);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(7);
|
||||
vert(4);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(4);
|
||||
vert(0);
|
||||
vert(13);
|
||||
vert(13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 1, 5, 6, 12, 2, 1, 5, 6);
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 1, 5, 6, 12, 2, 1, 5, 6);
|
||||
|
||||
vert(2);
|
||||
vert(1);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(1);
|
||||
vert(5);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(5);
|
||||
vert(6);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(6);
|
||||
vert(2);
|
||||
vert(12);
|
||||
vert(12);
|
||||
}
|
||||
vert(2);
|
||||
vert(1);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(1);
|
||||
vert(5);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(5);
|
||||
vert(6);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(6);
|
||||
vert(2);
|
||||
vert(12);
|
||||
vert(12);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.model.ModelSnowMan;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -15,53 +18,52 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.entity.EntityChiselSnowman;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
|
||||
public class RenderChiselSnowman extends RenderLiving {
|
||||
|
||||
private static final ResourceLocation snowManTextures = new ResourceLocation("textures/entity/snowman.png");
|
||||
private ModelSnowMan snowMan;
|
||||
private static final ResourceLocation snowManTextures = new ResourceLocation("textures/entity/snowman.png");
|
||||
private ModelSnowMan snowMan;
|
||||
|
||||
public RenderChiselSnowman() {
|
||||
super(new ModelSnowMan(), 0.5F);
|
||||
snowMan = (ModelSnowMan) super.mainModel;
|
||||
setRenderPassModel(this.snowMan);
|
||||
}
|
||||
public RenderChiselSnowman() {
|
||||
super(new ModelSnowMan(), 0.5F);
|
||||
snowMan = (ModelSnowMan) super.mainModel;
|
||||
setRenderPassModel(this.snowMan);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderEquippedItems(EntityLivingBase entityLivingBase, float size) {
|
||||
this.renderEquippedItems((EntityChiselSnowman) entityLivingBase, size);
|
||||
}
|
||||
@Override
|
||||
protected void renderEquippedItems(EntityLivingBase entityLivingBase, float size) {
|
||||
this.renderEquippedItems((EntityChiselSnowman) entityLivingBase, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntityChiselSnowman) entity);
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntityChiselSnowman) entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityChiselSnowman snowman) {
|
||||
return snowManTextures;
|
||||
}
|
||||
protected ResourceLocation getEntityTexture(EntityChiselSnowman snowman) {
|
||||
return snowManTextures;
|
||||
}
|
||||
|
||||
protected void renderEquippedItems(EntityChiselSnowman snowman, float size) {
|
||||
super.renderEquippedItems(snowman, size);
|
||||
ItemStack itemStack = snowman.getEquipmentInSlot(2);
|
||||
protected void renderEquippedItems(EntityChiselSnowman snowman, float size) {
|
||||
super.renderEquippedItems(snowman, size);
|
||||
ItemStack itemStack = snowman.getEquipmentInSlot(2);
|
||||
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
GL11.glPushMatrix();
|
||||
this.snowMan.head.postRender(0.0625F);
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
GL11.glPushMatrix();
|
||||
this.snowMan.head.postRender(0.0625F);
|
||||
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
|
||||
boolean is3D = (customRenderer != null
|
||||
&& customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));
|
||||
|
||||
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())) {
|
||||
float f1 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f1, -f1, f1);
|
||||
}
|
||||
this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())) {
|
||||
float f1 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(f1, -f1, f1);
|
||||
}
|
||||
this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,12 @@ package team.chisel.client.render;
|
||||
import team.chisel.ctmlib.CTMRenderer;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererCTM extends CTMRenderer {
|
||||
|
||||
public RendererCTM() {
|
||||
super(RenderingRegistry.getNextAvailableRenderId());
|
||||
ClientUtils.renderCTMId = getRenderId();
|
||||
}
|
||||
public RendererCTM() {
|
||||
super(RenderingRegistry.getNextAvailableRenderId());
|
||||
ClientUtils.renderCTMId = getRenderId();
|
||||
}
|
||||
}
|
||||
@@ -16,308 +16,312 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererCTMPane implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
public static int id;
|
||||
|
||||
public RendererCTMPane() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererCTMPane() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glScalef(1.25f, 1.25f, 1.25f);
|
||||
renderer.setRenderBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glScalef(1.25f, 1.25f, 1.25f);
|
||||
renderer.setRenderBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
class PaneRenderer {
|
||||
class PaneRenderer {
|
||||
|
||||
Tessellator tessellator;
|
||||
Tessellator tessellator;
|
||||
|
||||
double i0u0;
|
||||
double i0uh;
|
||||
double i0u1;
|
||||
double i0v0;
|
||||
double i0v1;
|
||||
double i0u0;
|
||||
double i0uh;
|
||||
double i0u1;
|
||||
double i0v0;
|
||||
double i0v1;
|
||||
|
||||
double i1u0;
|
||||
double i1u1;
|
||||
double i1v0;
|
||||
double i1vh;
|
||||
double i1v1;
|
||||
double i1v;
|
||||
double i1u0;
|
||||
double i1u1;
|
||||
double i1v0;
|
||||
double i1vh;
|
||||
double i1v1;
|
||||
double i1v;
|
||||
|
||||
double i2u0;
|
||||
double i2u1;
|
||||
double i2v0;
|
||||
double i2v1;
|
||||
double i2v;
|
||||
double i2u0;
|
||||
double i2u1;
|
||||
double i2v0;
|
||||
double i2v1;
|
||||
double i2v;
|
||||
|
||||
double x0;
|
||||
double xh;
|
||||
double x1;
|
||||
double xp0;
|
||||
double xp1;
|
||||
double x0;
|
||||
double xh;
|
||||
double x1;
|
||||
double xp0;
|
||||
double xp1;
|
||||
|
||||
double z0;
|
||||
double zh;
|
||||
double z1;
|
||||
double zp0;
|
||||
double zp1;
|
||||
double z0;
|
||||
double zh;
|
||||
double z1;
|
||||
double zp0;
|
||||
double zp1;
|
||||
|
||||
double y0;
|
||||
double y1;
|
||||
double y0;
|
||||
double y1;
|
||||
|
||||
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
|
||||
tessellator = Tessellator.instance;
|
||||
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
|
||||
tessellator = Tessellator.instance;
|
||||
|
||||
i0u0 = icon.getMinU();
|
||||
i0uh = icon.getInterpolatedU(8.0D);
|
||||
i0u1 = icon.getMaxU();
|
||||
i0v0 = icon.getMinV();
|
||||
i0v1 = icon.getMaxV();
|
||||
i0u0 = icon.getMinU();
|
||||
i0uh = icon.getInterpolatedU(8.0D);
|
||||
i0u1 = icon.getMaxU();
|
||||
i0v0 = icon.getMinV();
|
||||
i0v1 = icon.getMaxV();
|
||||
|
||||
i1u0 = icon1.getInterpolatedU(7.0D);
|
||||
i1u1 = icon1.getInterpolatedU(9.0D);
|
||||
i1v0 = icon1.getMinV();
|
||||
i1vh = icon1.getInterpolatedV(8.0D);
|
||||
i1v1 = icon1.getMaxV();
|
||||
i1v = i1v1 - i1v0;
|
||||
i1u0 = icon1.getInterpolatedU(7.0D);
|
||||
i1u1 = icon1.getInterpolatedU(9.0D);
|
||||
i1v0 = icon1.getMinV();
|
||||
i1vh = icon1.getInterpolatedV(8.0D);
|
||||
i1v1 = icon1.getMaxV();
|
||||
i1v = i1v1 - i1v0;
|
||||
|
||||
i2u0 = icon2.getInterpolatedU(7.0D);
|
||||
i2u1 = icon2.getInterpolatedU(9.0D);
|
||||
i2v0 = icon2.getMinV();
|
||||
i2v1 = icon2.getMaxV();
|
||||
i2v = i2v1 - i2v0;
|
||||
i2u0 = icon2.getInterpolatedU(7.0D);
|
||||
i2u1 = icon2.getInterpolatedU(9.0D);
|
||||
i2v0 = icon2.getMinV();
|
||||
i2v1 = icon2.getMaxV();
|
||||
i2v = i2v1 - i2v0;
|
||||
|
||||
x0 = x;
|
||||
xh = x0 + 0.5D;
|
||||
x1 = x + 1;
|
||||
xp0 = x0 + 0.5D - 0.0625D;
|
||||
xp1 = x0 + 0.5D + 0.0625D;
|
||||
x0 = x;
|
||||
xh = x0 + 0.5D;
|
||||
x1 = x + 1;
|
||||
xp0 = x0 + 0.5D - 0.0625D;
|
||||
xp1 = x0 + 0.5D + 0.0625D;
|
||||
|
||||
z0 = z;
|
||||
zh = z0 + 0.5D;
|
||||
z1 = z + 1;
|
||||
zp0 = z0 + 0.5D - 0.0625D;
|
||||
zp1 = z0 + 0.5D + 0.0625D;
|
||||
z0 = z;
|
||||
zh = z0 + 0.5D;
|
||||
z1 = z + 1;
|
||||
zp0 = z0 + 0.5D - 0.0625D;
|
||||
zp1 = z0 + 0.5D + 0.0625D;
|
||||
|
||||
y0 = y;
|
||||
y1 = y + 1;
|
||||
}
|
||||
y0 = y;
|
||||
y1 = y + 1;
|
||||
}
|
||||
|
||||
public void renderNorthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
}
|
||||
public void renderNorthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
}
|
||||
|
||||
public void renderSouthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
public void renderSouthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
|
||||
public void renderWestPane() {
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
}
|
||||
public void renderWestPane() {
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
}
|
||||
|
||||
public void renderEastPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
public void renderEastPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
|
||||
public void renderVerticalNS(double y, double zoff0, double zoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
}
|
||||
public void renderVerticalNS(double y, double zoff0, double zoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
}
|
||||
|
||||
public void renderVerticalWE(double y, double xoff0, double xoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
}
|
||||
public void renderVerticalWE(double y, double xoff0, double xoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
}
|
||||
|
||||
public void renderHorizontalNS(double zoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
public void renderHorizontalNS(double zoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void renderHorizontalWE(double xoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
}
|
||||
}
|
||||
public void renderHorizontalWE(double xoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
}
|
||||
}
|
||||
|
||||
PaneRenderer paneRenderer = new PaneRenderer();
|
||||
PaneRenderer paneRenderer = new PaneRenderer();
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
|
||||
BlockPane block = (BlockPane) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
BlockPane block = (BlockPane) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconPane = block.getIcon(2, meta);
|
||||
IIcon iconTop = block.getIcon(1, meta);
|
||||
IIcon iconSide = block.getIcon(0, meta);
|
||||
if (iconPane == null || iconTop == null || iconSide == null)
|
||||
return false;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconPane = block.getIcon(2, meta);
|
||||
IIcon iconTop = block.getIcon(1, meta);
|
||||
IIcon iconSide = block.getIcon(0, meta);
|
||||
if (iconPane == null || iconTop == null || iconSide == null) return false;
|
||||
|
||||
if (renderer.hasOverrideBlockTexture()) {
|
||||
paneRenderer.set(x, y, z, renderer.overrideBlockTexture, renderer.overrideBlockTexture, renderer.overrideBlockTexture);
|
||||
} else {
|
||||
paneRenderer.set(x, y, z, iconPane, iconTop, iconSide);
|
||||
}
|
||||
if (renderer.hasOverrideBlockTexture()) {
|
||||
paneRenderer.set(
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer.overrideBlockTexture,
|
||||
renderer.overrideBlockTexture,
|
||||
renderer.overrideBlockTexture);
|
||||
} else {
|
||||
paneRenderer.set(x, y, z, iconPane, iconTop, iconSide);
|
||||
}
|
||||
|
||||
boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1));
|
||||
boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1));
|
||||
boolean connectsWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y, z));
|
||||
boolean connectsEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y, z));
|
||||
boolean connectsTop = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z));
|
||||
boolean connectsBottom = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z));
|
||||
boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1));
|
||||
boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1));
|
||||
boolean connectsWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y, z));
|
||||
boolean connectsEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y, z));
|
||||
boolean connectsTop = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z));
|
||||
boolean connectsBottom = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z));
|
||||
|
||||
boolean connectsTopNorth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z - 1));
|
||||
boolean connectsTopSouth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z + 1));
|
||||
boolean connectsTopWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y + 1, z));
|
||||
boolean connectsTopEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y + 1, z));
|
||||
boolean connectsTopNorth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z - 1));
|
||||
boolean connectsTopSouth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z + 1));
|
||||
boolean connectsTopWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y + 1, z));
|
||||
boolean connectsTopEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y + 1, z));
|
||||
|
||||
boolean connectsBottomNorth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z - 1));
|
||||
boolean connectsBottomSouth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z + 1));
|
||||
boolean connectsBottomWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y - 1, z));
|
||||
boolean connectsBottomEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y - 1, z));
|
||||
boolean connectsBottomNorth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z - 1));
|
||||
boolean connectsBottomSouth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z + 1));
|
||||
boolean connectsBottomWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y - 1, z));
|
||||
boolean connectsBottomEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y - 1, z));
|
||||
|
||||
boolean isolatedTop = !connectsTopNorth && !connectsTopSouth && !connectsTopWest && !connectsTopEast;
|
||||
boolean isolatedBottom = !connectsBottomNorth && !connectsBottomSouth && !connectsBottomWest && !connectsBottomEast;
|
||||
boolean isolatedTop = !connectsTopNorth && !connectsTopSouth && !connectsTopWest && !connectsTopEast;
|
||||
boolean isolatedBottom = !connectsBottomNorth && !connectsBottomSouth
|
||||
&& !connectsBottomWest
|
||||
&& !connectsBottomEast;
|
||||
|
||||
if (!connectsNorth && !connectsSouth && !connectsWest && !connectsEast) {
|
||||
connectsNorth = connectsSouth = connectsWest = connectsEast = true;
|
||||
}
|
||||
if (!connectsNorth && !connectsSouth && !connectsWest && !connectsEast) {
|
||||
connectsNorth = connectsSouth = connectsWest = connectsEast = true;
|
||||
}
|
||||
|
||||
int connections = 0;
|
||||
if (connectsNorth) {
|
||||
paneRenderer.renderNorthPane();
|
||||
if (!connectsBottom || !connectsBottomNorth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopNorth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsSouth) {
|
||||
paneRenderer.renderSouthPane();
|
||||
if (!connectsBottom || !connectsBottomSouth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopSouth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
if (connectsWest) {
|
||||
paneRenderer.renderWestPane();
|
||||
if (!connectsBottom || !connectsBottomWest && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopWest && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsEast) {
|
||||
paneRenderer.renderEastPane();
|
||||
if (!connectsBottom || !connectsBottomEast && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopEast && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
int connections = 0;
|
||||
if (connectsNorth) {
|
||||
paneRenderer.renderNorthPane();
|
||||
if (!connectsBottom || !connectsBottomNorth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopNorth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsSouth) {
|
||||
paneRenderer.renderSouthPane();
|
||||
if (!connectsBottom || !connectsBottomSouth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopSouth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
if (connectsWest) {
|
||||
paneRenderer.renderWestPane();
|
||||
if (!connectsBottom || !connectsBottomWest && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopWest && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsEast) {
|
||||
paneRenderer.renderEastPane();
|
||||
if (!connectsBottom || !connectsBottomEast && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopEast && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
|
||||
if (connections == 1) {
|
||||
if (connectsNorth)
|
||||
paneRenderer.renderHorizontalNS(0.5, 1.0, 0.0);
|
||||
if (connectsSouth)
|
||||
paneRenderer.renderHorizontalNS(0.5, 0.0, 1.0);
|
||||
if (connectsEast)
|
||||
paneRenderer.renderHorizontalWE(0.5, 0.0, 1.0);
|
||||
if (connectsWest)
|
||||
paneRenderer.renderHorizontalWE(0.5, 1.0, 0.0);
|
||||
} else if (connections == 4) {
|
||||
paneRenderer.renderHorizontalNS(0.0, 1.0, 0.0);
|
||||
paneRenderer.renderHorizontalNS(1.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(0.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(1.0, 1.0, 0.0);
|
||||
}
|
||||
if (connections == 1) {
|
||||
if (connectsNorth) paneRenderer.renderHorizontalNS(0.5, 1.0, 0.0);
|
||||
if (connectsSouth) paneRenderer.renderHorizontalNS(0.5, 0.0, 1.0);
|
||||
if (connectsEast) paneRenderer.renderHorizontalWE(0.5, 0.0, 1.0);
|
||||
if (connectsWest) paneRenderer.renderHorizontalWE(0.5, 1.0, 0.0);
|
||||
} else if (connections == 4) {
|
||||
paneRenderer.renderHorizontalNS(0.0, 1.0, 0.0);
|
||||
paneRenderer.renderHorizontalNS(1.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(0.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(1.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -13,76 +13,63 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererEldritch implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererEldritch() {
|
||||
Chisel.renderEldritchId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererEldritch() {
|
||||
Chisel.renderEldritchId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
RenderBlocksEldritch renderer = new RenderBlocksEldritch();
|
||||
RenderBlocksEldritch renderer = new RenderBlocksEldritch();
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld) {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks rendererOld) {
|
||||
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x,
|
||||
// y, z));
|
||||
/*
|
||||
* double d0 = 0.4000000059604645D; double d1 = 0.5D - d0; double d2 = 0.20000000298023224D;
|
||||
*/
|
||||
// renderer.renderTorchAtAngle(Block.torchWood, x - d1, y + d2, z, -d0,
|
||||
// 0.0D, 0);
|
||||
/*
|
||||
* Icon icon = block.getIcon(2, meta); double u0 = icon.getMinU(); double v0 = icon.getMaxV(); double u1 = icon.getMaxU(); double v1 = icon.getMinV(); double uu = icon.getInterpolatedU(8.0D);
|
||||
* double vv = icon.getInterpolatedV(8.0D);
|
||||
*
|
||||
*
|
||||
* int lyp=block.getMixedBrightnessForBlock(world, x, y+1, z); int lym=block.getMixedBrightnessForBlock(world, x, y-1, z); int lxp=block.getMixedBrightnessForBlock(world, x+1, y, z); int
|
||||
* lxm=block.getMixedBrightnessForBlock(world, x-1, y, z); int lzp=block.getMixedBrightnessForBlock(world, x, y, z+1); int lzm=block.getMixedBrightnessForBlock(world, x, y, z-1);
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* icon = block.getIcon(0, meta); u0 = icon.getMinU(); v0 = icon.getMinV(); u1 = icon.getMaxU(); v1 = icon.getMaxV(); vertex(1,u0,v0); vertex(5,u1,v0); vertex(6,u1,v1); vertex(2,u0,v1);
|
||||
*
|
||||
* icon = block.getIcon(1, meta); u0 = icon.getMinU(); v0 = icon.getMinV(); u1 = icon.getMaxU(); v1 = icon.getMaxV(); vertex(0,u0,v0); vertex(3,u0,v1); vertex(7,u1,v1); vertex(4,u1,v0);
|
||||
*/
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x,
|
||||
// y, z));
|
||||
/*
|
||||
* double d0 = 0.4000000059604645D; double d1 = 0.5D - d0; double d2 = 0.20000000298023224D;
|
||||
*/
|
||||
// renderer.renderTorchAtAngle(Block.torchWood, x - d1, y + d2, z, -d0,
|
||||
// 0.0D, 0);
|
||||
/*
|
||||
* Icon icon = block.getIcon(2, meta); double u0 = icon.getMinU(); double v0 = icon.getMaxV(); double u1 =
|
||||
* icon.getMaxU(); double v1 = icon.getMinV(); double uu = icon.getInterpolatedU(8.0D); double vv =
|
||||
* icon.getInterpolatedV(8.0D); int lyp=block.getMixedBrightnessForBlock(world, x, y+1, z); int
|
||||
* lym=block.getMixedBrightnessForBlock(world, x, y-1, z); int lxp=block.getMixedBrightnessForBlock(world, x+1,
|
||||
* y, z); int lxm=block.getMixedBrightnessForBlock(world, x-1, y, z); int
|
||||
* lzp=block.getMixedBrightnessForBlock(world, x, y, z+1); int lzm=block.getMixedBrightnessForBlock(world, x, y,
|
||||
* z-1); icon = block.getIcon(0, meta); u0 = icon.getMinU(); v0 = icon.getMinV(); u1 = icon.getMaxU(); v1 =
|
||||
* icon.getMaxV(); vertex(1,u0,v0); vertex(5,u1,v0); vertex(6,u1,v1); vertex(2,u0,v1); icon = block.getIcon(1,
|
||||
* meta); u0 = icon.getMinU(); v0 = icon.getMinV(); u1 = icon.getMaxU(); v1 = icon.getMaxV(); vertex(0,u0,v0);
|
||||
* vertex(3,u0,v1); vertex(7,u1,v1); vertex(4,u1,v0);
|
||||
*/
|
||||
|
||||
renderer.blockAccess = world;
|
||||
renderer.renderMaxX = 1.0;
|
||||
renderer.renderMaxY = 1.0;
|
||||
renderer.renderMaxZ = 1.0;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.blockAccess = world;
|
||||
renderer.renderMaxX = 1.0;
|
||||
renderer.renderMaxY = 1.0;
|
||||
renderer.renderMaxZ = 1.0;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
return true;
|
||||
/*
|
||||
*
|
||||
* boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
*
|
||||
* return flag;
|
||||
*/
|
||||
}
|
||||
return true;
|
||||
/*
|
||||
* boolean flag = renderer.renderStandardBlock(block, x, y, z); return flag;
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderEldritchId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderEldritchId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,38 +17,39 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererLayeredGlow implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererLayeredGlow() {
|
||||
Chisel.renderGlowId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererLayeredGlow() {
|
||||
Chisel.renderGlowId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GeneralClient.setGLColorFromInt(Configurations.configColors[metadata]);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, ((BlockCarvableGlow) block).getGlowTexture(), renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GeneralClient.setGLColorFromInt(Configurations.configColors[metadata]);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, ((BlockCarvableGlow) block).getGlowTexture(), renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
|
||||
Tessellator.instance.setBrightness(0xF000F0);
|
||||
Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture());
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
|
||||
Tessellator.instance.setBrightness(0xF000F0);
|
||||
Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture());
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderGlowId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderGlowId;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +1,82 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.block.BlockMultiLayerBase;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import team.chisel.block.BlockMultiLayerBase;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class RendererMultiLayer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
public static int id;
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
public static int id;
|
||||
|
||||
public RendererMultiLayer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererMultiLayer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase))
|
||||
return;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase)) return;
|
||||
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockAsItem(block.base, meta, 1.0f);
|
||||
}
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockAsItem(block.base, meta, 1.0f);
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
glDisable(GL_BLEND);
|
||||
glPopMatrix();
|
||||
}
|
||||
glPushMatrix();
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
glDisable(GL_BLEND);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase))
|
||||
return false;
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockMultiLayerBase)) return false;
|
||||
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
|
||||
|
||||
if (MinecraftForgeClient.getRenderPass() == 0) {
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockByRenderType(block.base, x, y, z);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
return renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (MinecraftForgeClient.getRenderPass() == 0) {
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockByRenderType(block.base, x, y, z);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
return renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,120 +1,122 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.BlockRoadLine;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.BlockRoadLine;
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererRoadLine implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererRoadLine() {
|
||||
Chisel.roadLineId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererRoadLine() {
|
||||
Chisel.roadLineId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
public void renderTopFace(double y, IIcon icon) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
public void renderTopFace(double y, IIcon icon) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.addVertexWithUV(1, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 1, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(1, y, 1, icon.getMaxU(), icon.getMaxV());
|
||||
}
|
||||
tessellator.addVertexWithUV(1, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 1, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(1, y, 1, icon.getMaxU(), icon.getMaxV());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
BlockRoadLine block = (BlockRoadLine) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
BlockRoadLine block = (BlockRoadLine) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block) && world.getBlockMetadata(x, y, z - 1) == meta;
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block) && world.getBlockMetadata(x, y, z + 1) == meta;
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block) && world.getBlockMetadata(x - 1, y, z) == meta;
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block) && world.getBlockMetadata(x + 1, y, z) == meta;
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block) && world.getBlockMetadata(x, y, z - 1) == meta;
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block) && world.getBlockMetadata(x, y, z + 1) == meta;
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block) && world.getBlockMetadata(x - 1, y, z) == meta;
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block) && world.getBlockMetadata(x + 1, y, z) == meta;
|
||||
|
||||
if (!N && !S && !W && !E) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
if (!N && !S && !W && !E) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (N && S) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
if (N && S) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
} else {
|
||||
if (N) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (S) {
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
} else {
|
||||
if (N) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (S) {
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (E && W) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else {
|
||||
if (E) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (W) {
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
if (E && W) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else {
|
||||
if (E) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (W) {
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
}
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
}
|
||||
@@ -14,36 +14,37 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererSimpleLayered implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public RendererSimpleLayered() {
|
||||
Chisel.renderLayeredId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererSimpleLayered() {
|
||||
Chisel.renderLayeredId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, ((BlockCarvableLayered) block).getBaseTex(), renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, ((BlockCarvableLayered) block).getBaseTex(), renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
renderer.setOverrideBlockTexture(((BlockCarvableLayered) block).getBaseTex());
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
renderer.setOverrideBlockTexture(((BlockCarvableLayered) block).getBaseTex());
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
}
|
||||
@@ -13,113 +13,114 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererSnakeStone implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
public static int id;
|
||||
|
||||
public RendererSnakeStone() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererSnakeStone() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
restoreRendererRotate(renderer);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
restoreRendererRotate(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
boolean didRender = renderer.renderStandardBlock(block, x, y, z);
|
||||
restoreRendererRotate(renderer);
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
boolean didRender = renderer.renderStandardBlock(block, x, y, z);
|
||||
restoreRendererRotate(renderer);
|
||||
|
||||
return didRender;
|
||||
}
|
||||
return didRender;
|
||||
}
|
||||
|
||||
private void restoreRendererRotate(RenderBlocks renderer) {
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
private void restoreRendererRotate(RenderBlocks renderer) {
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
|
||||
private void setRenderRotate(RenderBlocks renderer, BlockSnakestone block, int meta) {
|
||||
int type = meta & 0xC;
|
||||
int orient = meta & 0x3;
|
||||
private void setRenderRotate(RenderBlocks renderer, BlockSnakestone block, int meta) {
|
||||
int type = meta & 0xC;
|
||||
int orient = meta & 0x3;
|
||||
|
||||
if (type == 0) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 3;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
if (type == 0) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 3;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
|
||||
} else if ((type == 4) || (type == 8)) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 1 : 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 2;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 0 : 3;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
}
|
||||
} else if ((type == 4) || (type == 8)) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 1 : 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 2;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 0 : 3;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
}
|
||||
|
||||
} else if (type == 12) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == 12) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -13,44 +13,44 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RendererStairs implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
public static int id;
|
||||
|
||||
public RendererStairs() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RendererStairs() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockCarvableStairs))
|
||||
return false;
|
||||
BlockCarvableStairs block = (BlockCarvableStairs) blck;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockCarvableStairs)) return false;
|
||||
BlockCarvableStairs block = (BlockCarvableStairs) blck;
|
||||
|
||||
renderer.renderBlockStairs(block, x, y, z);
|
||||
renderer.renderBlockStairs(block, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -13,94 +7,104 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import team.chisel.ctmlib.Drawing;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerAntiblock extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class AntiblockItemRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class AntiblockItemRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(ChiselBlocks.antiBlock, ChiselBlocks.antiBlock.getIcon(0, item.getItemDamage()), (RenderBlocks) data[0]);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class RenderBlocksCTMFullbright extends RenderBlocksCTM {
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(
|
||||
ChiselBlocks.antiBlock,
|
||||
ChiselBlocks.antiBlock.getIcon(0, item.getItemDamage()),
|
||||
(RenderBlocks) data[0]);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
ao();
|
||||
int maxLight = 0xF000F0;
|
||||
super.fillLightmap(maxLight, maxLight, maxLight, maxLight);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class RenderBlocksCTMFullbright extends RenderBlocksCTM {
|
||||
|
||||
@Override
|
||||
protected void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
ao();
|
||||
int color = 0xFFFFFF;
|
||||
super.fillColormap(color, color, color, color, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
boolean ret = super.renderStandardBlock(block, x, y, z);
|
||||
this.enableAO = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void ao() {
|
||||
if (this.inWorld) {
|
||||
this.enableAO = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void fillLightmap(int bottomLeft, int bottomRight, int topRight, int topLeft) {
|
||||
ao();
|
||||
int maxLight = 0xF000F0;
|
||||
super.fillLightmap(maxLight, maxLight, maxLight, maxLight);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTMFullbright rb;
|
||||
@Override
|
||||
protected void fillColormap(float bottomLeft, float bottomRight, float topRight, float topLeft, float[][] map) {
|
||||
ao();
|
||||
int color = 0xFFFFFF;
|
||||
super.fillColormap(color, color, color, color, map);
|
||||
}
|
||||
|
||||
private String color;
|
||||
private TextureSubmap submap, submapSmall;
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
boolean ret = super.renderStandardBlock(block, x, y, z);
|
||||
this.enableAO = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public SubmapManagerAntiblock(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
private void ao() {
|
||||
if (this.inWorld) {
|
||||
this.enableAO = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTMFullbright rb;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
submap = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock"), 2, 2);
|
||||
}
|
||||
private String color;
|
||||
private TextureSubmap submap, submapSmall;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTMFullbright();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
public SubmapManagerAntiblock(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
submap = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(modName + ":antiblock/" + color + "-antiBlock"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTMFullbright();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,33 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class SubmapManagerBase implements ISubmapManager {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {}
|
||||
}
|
||||
@@ -1,55 +1,56 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private String color;
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private String color;
|
||||
|
||||
public SubmapManagerCarpetFloor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
public SubmapManagerCarpetFloor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":carpet/" + color;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":carpet/" + color;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
@@ -22,133 +22,141 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerCombinedCTM extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class RenderBlocksCombinedCTM extends RenderBlocksCTM {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class RenderBlocksCombinedCTM extends RenderBlocksCTM {
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.WEST);
|
||||
super.renderFaceXNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.WEST);
|
||||
super.renderFaceXNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.EAST);
|
||||
super.renderFaceXPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.EAST);
|
||||
super.renderFaceXPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.DOWN);
|
||||
super.renderFaceYNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.DOWN);
|
||||
super.renderFaceYNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.UP);
|
||||
super.renderFaceYPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.UP);
|
||||
super.renderFaceYPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.NORTH);
|
||||
super.renderFaceZNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.NORTH);
|
||||
super.renderFaceZNeg(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.SOUTH);
|
||||
super.renderFaceZPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setIcons(rType, x, y, z, ForgeDirection.SOUTH);
|
||||
super.renderFaceZPos(block, x, y, z, inWorld ? submapSmall.getSubIcon(0, 0) : icon);
|
||||
}
|
||||
|
||||
private void setIcons(TextureType type, double x, double y, double z, ForgeDirection side) {
|
||||
int ix = MathHelper.floor_double(x);
|
||||
int iy = MathHelper.floor_double(y);
|
||||
int iz = MathHelper.floor_double(z);
|
||||
if (type == TextureType.V4 || type == TextureType.V9) {
|
||||
submap = (TextureSubmap) TextureType.getVIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
|
||||
submapSmall = (TextureSubmap) TextureType.getVIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
|
||||
} else {
|
||||
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
|
||||
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
|
||||
}
|
||||
}
|
||||
}
|
||||
private void setIcons(TextureType type, double x, double y, double z, ForgeDirection side) {
|
||||
int ix = MathHelper.floor_double(x);
|
||||
int iy = MathHelper.floor_double(y);
|
||||
int iz = MathHelper.floor_double(z);
|
||||
if (type == TextureType.V4 || type == TextureType.V9) {
|
||||
submap = (TextureSubmap) TextureType
|
||||
.getVIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
|
||||
submapSmall = (TextureSubmap) TextureType
|
||||
.getVIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
|
||||
} else {
|
||||
submap = (TextureSubmap) TextureType
|
||||
.getRIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
|
||||
submapSmall = (TextureSubmap) TextureType
|
||||
.getRIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Submap extends TextureSubmap {
|
||||
private class Submap extends TextureSubmap {
|
||||
|
||||
private TextureSubmap[][] submap;
|
||||
private TextureSubmap[][] submap;
|
||||
|
||||
public Submap(IIcon base, int wh, TextureSubmap[][] submap) {
|
||||
super(base, wh, wh);
|
||||
this.submap = submap;
|
||||
}
|
||||
public Submap(IIcon base, int wh, TextureSubmap[][] submap) {
|
||||
super(base, wh, wh);
|
||||
this.submap = submap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texturesStitched() {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
for (int j = 0; j < icons[i].length; j++) {
|
||||
icons[i][j] = submap[i][j];
|
||||
submap[i][j].texturesStitched();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void texturesStitched() {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
for (int j = 0; j < icons[i].length; j++) {
|
||||
icons[i][j] = submap[i][j];
|
||||
submap[i][j].texturesStitched();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksCTM rb;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap, smallSubmap;
|
||||
private int size;
|
||||
private String texturePath;
|
||||
private int meta;
|
||||
private IIcon defaultIcon;
|
||||
private TextureType rType;
|
||||
private TextureSubmap submap, smallSubmap;
|
||||
private int size;
|
||||
private String texturePath;
|
||||
private int meta;
|
||||
private IIcon defaultIcon;
|
||||
private TextureType rType;
|
||||
|
||||
public SubmapManagerCombinedCTM(int meta, String texturePath, TextureType rType) {
|
||||
assert rType == TextureType.R16 || rType == TextureType.R9 || rType == TextureType.R4 || rType == TextureType.V4 || rType == TextureType.V9 : "Not a valid random type!";
|
||||
public SubmapManagerCombinedCTM(int meta, String texturePath, TextureType rType) {
|
||||
assert rType == TextureType.R16 || rType == TextureType.R9
|
||||
|| rType == TextureType.R4
|
||||
|| rType == TextureType.V4
|
||||
|| rType == TextureType.V9 : "Not a valid random type!";
|
||||
|
||||
this.meta = meta;
|
||||
this.texturePath = texturePath;
|
||||
this.size = Integer.parseInt(rType.name().substring(1, rType.name().length())); // >.>
|
||||
this.rType = rType;
|
||||
}
|
||||
this.meta = meta;
|
||||
this.texturePath = texturePath;
|
||||
this.size = Integer.parseInt(rType.name().substring(1, rType.name().length())); // >.>
|
||||
this.rType = rType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return defaultIcon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return defaultIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCombinedCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCombinedCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
IIcon base = register.registerIcon(modName + ":" + texturePath);
|
||||
int wh = (int) Math.sqrt(size);
|
||||
TextureSubmap[][] submaps = new TextureSubmap[wh][wh];
|
||||
TextureSubmap[][] submapsSmall = new TextureSubmap[wh][wh];
|
||||
for (int i = 0; i < size; i++) {
|
||||
AbstractSubmapManager manager = (AbstractSubmapManager) TextureType.CTMX.createManagerFor(CarvingUtils.getDefaultVariationFor(block, meta, 0), texturePath + "-" + i);
|
||||
manager.registerIcons(modName, block, register);
|
||||
Object cached = manager.getCachedObject();
|
||||
Triple<IIcon, TextureSubmap, TextureSubmap> triple = (Triple<IIcon, TextureSubmap, TextureSubmap>) cached;
|
||||
submaps[i % wh][i / wh] = triple.getMiddle();
|
||||
submapsSmall[i % wh][i / wh] = triple.getRight();
|
||||
if (i == 0) {
|
||||
defaultIcon = triple.getRight().getBaseIcon();
|
||||
}
|
||||
}
|
||||
submap = new Submap(base, wh, submaps);
|
||||
smallSubmap = new Submap(base, wh, submapsSmall);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
IIcon base = register.registerIcon(modName + ":" + texturePath);
|
||||
int wh = (int) Math.sqrt(size);
|
||||
TextureSubmap[][] submaps = new TextureSubmap[wh][wh];
|
||||
TextureSubmap[][] submapsSmall = new TextureSubmap[wh][wh];
|
||||
for (int i = 0; i < size; i++) {
|
||||
AbstractSubmapManager manager = (AbstractSubmapManager) TextureType.CTMX
|
||||
.createManagerFor(CarvingUtils.getDefaultVariationFor(block, meta, 0), texturePath + "-" + i);
|
||||
manager.registerIcons(modName, block, register);
|
||||
Object cached = manager.getCachedObject();
|
||||
Triple<IIcon, TextureSubmap, TextureSubmap> triple = (Triple<IIcon, TextureSubmap, TextureSubmap>) cached;
|
||||
submaps[i % wh][i / wh] = triple.getMiddle();
|
||||
submapsSmall[i % wh][i / wh] = triple.getRight();
|
||||
if (i == 0) {
|
||||
defaultIcon = triple.getRight().getBaseIcon();
|
||||
}
|
||||
}
|
||||
submap = new Submap(base, wh, submaps);
|
||||
smallSubmap = new Submap(base, wh, submapsSmall);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,71 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.ctmlib.CTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
import static team.chisel.ctmlib.Dir.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.ctmlib.CTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
import static team.chisel.ctmlib.Dir.*;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerFakeController extends SubmapManagerBase {
|
||||
|
||||
private TextureSubmap map;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
private int meta;
|
||||
private String texturePath;
|
||||
private TextureSubmap map;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
private int meta;
|
||||
private String texturePath;
|
||||
|
||||
public SubmapManagerFakeController(int meta, String texture) {
|
||||
ctm.disableObscuredFaceCheck = Optional.of(true);
|
||||
this.meta = meta;
|
||||
texturePath = texture;
|
||||
}
|
||||
public SubmapManagerFakeController(int meta, String texture) {
|
||||
ctm.disableObscuredFaceCheck = Optional.of(true);
|
||||
this.meta = meta;
|
||||
texturePath = texture;
|
||||
}
|
||||
|
||||
public SubmapManagerFakeController(int meta) {
|
||||
ctm.disableObscuredFaceCheck = Optional.of(true);
|
||||
this.meta = meta;
|
||||
}
|
||||
public SubmapManagerFakeController(int meta) {
|
||||
ctm.disableObscuredFaceCheck = Optional.of(true);
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, meta);
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, meta);
|
||||
|
||||
if (ctm.connectedAnd(TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT)) {
|
||||
return map.getSubIcon(1, 1);
|
||||
} else if (ctm.connectedAnd(TOP, BOTTOM)) {
|
||||
return map.getSubIcon(0, 1);
|
||||
} else if (ctm.connectedAnd(LEFT, RIGHT)) {
|
||||
return map.getSubIcon(1, 0);
|
||||
} else {
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
}
|
||||
if (ctm.connectedAnd(TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT)) {
|
||||
return map.getSubIcon(1, 1);
|
||||
} else if (ctm.connectedAnd(TOP, BOTTOM)) {
|
||||
return map.getSubIcon(0, 1);
|
||||
} else if (ctm.connectedAnd(LEFT, RIGHT)) {
|
||||
return map.getSubIcon(1, 0);
|
||||
} else {
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
|
||||
if (texturePath != null) {
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":" + texturePath), 2, 2);
|
||||
} else {
|
||||
Chisel.logger.info("SubmapManagerFakeController was called on block " + block.getUnlocalizedName() + " without declaring texture, using a default texture instead.");
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controller"), 2, 2);
|
||||
}
|
||||
}
|
||||
if (texturePath != null) {
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":" + texturePath), 2, 2);
|
||||
} else {
|
||||
Chisel.logger.info(
|
||||
"SubmapManagerFakeController was called on block " + block.getUnlocalizedName()
|
||||
+ " without declaring texture, using a default texture instead.");
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controller"), 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,21 @@ import net.minecraft.util.IIcon;
|
||||
|
||||
public class SubmapManagerLeaves extends SubmapManagerBase {
|
||||
|
||||
private String name;
|
||||
private IIcon normal, opaque;
|
||||
private String name;
|
||||
private IIcon normal, opaque;
|
||||
|
||||
public SubmapManagerLeaves(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public SubmapManagerLeaves(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.leaves.isOpaqueCube() ? opaque : normal;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.leaves.isOpaqueCube() ? opaque : normal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
this.normal = register.registerIcon(modName + ":" + name);
|
||||
this.opaque = register.registerIcon(modName + ":" + name + "_opaque");
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
this.normal = register.registerIcon(modName + ":" + name);
|
||||
this.opaque = register.registerIcon(modName + ":" + name + "_opaque");
|
||||
}
|
||||
}
|
||||
@@ -1,81 +1,82 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerSlab implements ISubmapManager {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private IIcon sideTexture;
|
||||
private String texture;
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private IIcon sideTexture;
|
||||
private String texture;
|
||||
|
||||
public SubmapManagerSlab(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
public SubmapManagerSlab(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":" + texture;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
||||
sideTexture = register.registerIcon(path + "-side");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":" + texture;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
||||
sideTexture = register.registerIcon(path + "-side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
}
|
||||
|
||||
private boolean hadOverride = false;
|
||||
private boolean hadOverride = false;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
RenderBlocksCTM rbctm = (RenderBlocksCTM) renderer;
|
||||
if (side.ordinal() < 2 && !rbctm.rendererOld.hasOverrideBlockTexture()) {
|
||||
rbctm.rendererOld.setOverrideBlockTexture(sideTexture);
|
||||
hadOverride = false;
|
||||
} else {
|
||||
hadOverride = true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
RenderBlocksCTM rbctm = (RenderBlocksCTM) renderer;
|
||||
if (side.ordinal() < 2 && !rbctm.rendererOld.hasOverrideBlockTexture()) {
|
||||
rbctm.rendererOld.setOverrideBlockTexture(sideTexture);
|
||||
hadOverride = false;
|
||||
} else {
|
||||
hadOverride = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
if (!hadOverride) {
|
||||
((RenderBlocksCTM) renderer).rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
if (!hadOverride) {
|
||||
((RenderBlocksCTM) renderer).rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package team.chisel.client.render;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -11,6 +8,10 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import team.chisel.ctmlib.ISubmapManager;
|
||||
import team.chisel.ctmlib.RenderBlocksCTM;
|
||||
import team.chisel.ctmlib.TextureSubmap;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
@@ -19,112 +20,119 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerVoidstone extends SubmapManagerBase {
|
||||
|
||||
// TODO there must be a better more generic way to do this...
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class RenderBlocksVoidstone extends RenderBlocksCTM {
|
||||
// TODO there must be a better more generic way to do this...
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class RenderBlocksVoidstone extends RenderBlocksCTM {
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderMinX += 0.001;
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.WEST.ordinal()));
|
||||
super.renderFaceXNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderMinX += 0.001;
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.WEST.ordinal()));
|
||||
super.renderFaceXNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.EAST.ordinal()));
|
||||
renderMaxX -= 0.001;
|
||||
super.renderFaceXPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.EAST.ordinal()));
|
||||
renderMaxX -= 0.001;
|
||||
super.renderFaceXPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYNeg(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.DOWN.ordinal()));
|
||||
renderMinY += 0.001;
|
||||
super.renderFaceYNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYNeg(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.DOWN.ordinal()));
|
||||
renderMinY += 0.001;
|
||||
super.renderFaceYNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.UP.ordinal()));
|
||||
renderMaxY -= 0.001;
|
||||
super.renderFaceYPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.UP.ordinal()));
|
||||
renderMaxY -= 0.001;
|
||||
super.renderFaceYPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZNeg(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.NORTH.ordinal()));
|
||||
renderMinZ += 0.001;
|
||||
super.renderFaceZNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZNeg(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.NORTH.ordinal()));
|
||||
renderMinZ += 0.001;
|
||||
super.renderFaceZNeg(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.SOUTH.ordinal()));
|
||||
renderMaxZ -= 0.001;
|
||||
super.renderFaceZPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZPos(block, x, y, z, icon);
|
||||
setOverrideBlockTexture(getBase(x, y, z, ForgeDirection.SOUTH.ordinal()));
|
||||
renderMaxZ -= 0.001;
|
||||
super.renderFaceZPos(block, x, y, z, null);
|
||||
clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksVoidstone rb;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksVoidstone rb;
|
||||
|
||||
private ISubmapManager overlay;
|
||||
private TextureSubmap base;
|
||||
private ISubmapManager overlay;
|
||||
private TextureSubmap base;
|
||||
|
||||
private IIcon getBase(double x, double y, double z, int side) {
|
||||
return TextureType.getVIcon(TextureType.V4, base, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), side);
|
||||
}
|
||||
private IIcon getBase(double x, double y, double z, int side) {
|
||||
return TextureType.getVIcon(
|
||||
TextureType.V4,
|
||||
base,
|
||||
MathHelper.floor_double(x),
|
||||
MathHelper.floor_double(y),
|
||||
MathHelper.floor_double(z),
|
||||
side);
|
||||
}
|
||||
|
||||
private String texture;
|
||||
private int meta;
|
||||
private String texture;
|
||||
private int meta;
|
||||
|
||||
public SubmapManagerVoidstone(String texture, int meta) {
|
||||
this.texture = texture;
|
||||
this.meta = meta;
|
||||
}
|
||||
public SubmapManagerVoidstone(String texture, int meta) {
|
||||
this.texture = texture;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return overlay.getIcon(side, meta);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return overlay.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return overlay.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return overlay.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
overlay = TextureType.getTypeFor(null, modName, texture).createManagerFor(CarvingUtils.getDefaultVariationFor(block, meta, 0), texture);
|
||||
overlay.registerIcons(modName, block, register);
|
||||
base = new TextureSubmap(register.registerIcon(modName + ":" + "animations/hadesX32"), 2, 2);
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
overlay = TextureType.getTypeFor(null, modName, texture)
|
||||
.createManagerFor(CarvingUtils.getDefaultVariationFor(block, meta, 0), texture);
|
||||
overlay.registerIcons(modName, block, register);
|
||||
base = new TextureSubmap(register.registerIcon(modName + ":" + "animations/hadesX32"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksVoidstone();
|
||||
}
|
||||
RenderBlocks ctx = overlay.createRenderContext(rendererOld, block, world);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
if (ctx instanceof RenderBlocksCTM) {
|
||||
rb.submap = ((RenderBlocksCTM) ctx).submap;
|
||||
rb.submapSmall = ((RenderBlocksCTM) ctx).submapSmall;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksVoidstone();
|
||||
}
|
||||
RenderBlocks ctx = overlay.createRenderContext(rendererOld, block, world);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
if (ctx instanceof RenderBlocksCTM) {
|
||||
rb.submap = ((RenderBlocksCTM) ctx).submap;
|
||||
rb.submapSmall = ((RenderBlocksCTM) ctx).submapSmall;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
@@ -10,39 +10,50 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemChiselRenderer implements IItemRenderer {
|
||||
|
||||
RenderBlocks renderBlock = new RenderBlocks();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
RenderBlocks renderBlock = new RenderBlocks();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Fixes potential render bug with blocks that draw this item
|
||||
renderItem.zLevel = 10f;
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (stack.stackTagCompound != null) {
|
||||
// Fixes potential render bug with blocks that draw this item
|
||||
renderItem.zLevel = 10f;
|
||||
renderItem.renderItemIntoGUI(
|
||||
Minecraft.getMinecraft().fontRenderer,
|
||||
Minecraft.getMinecraft().renderEngine,
|
||||
stack,
|
||||
0,
|
||||
0);
|
||||
|
||||
ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
|
||||
if (chiselTarget != null) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
|
||||
GL11.glScalef(0.65f, 0.65f, 0.65f);
|
||||
GL11.glTranslatef(-8f, -8f, 0.0f);
|
||||
ItemStack chiselTarget = ItemStack
|
||||
.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
|
||||
if (chiselTarget != null) {
|
||||
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glScalef(0.65f, 0.65f, 0.65f);
|
||||
GL11.glTranslatef(-8f, -8f, 0.0f);
|
||||
|
||||
renderItem.renderItemIntoGUI(
|
||||
Minecraft.getMinecraft().fontRenderer,
|
||||
Minecraft.getMinecraft().renderEngine,
|
||||
chiselTarget,
|
||||
8,
|
||||
8);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package team.chisel.client.render.tile;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -24,169 +24,187 @@ import net.minecraftforge.client.model.obj.GroupObject;
|
||||
import net.minecraftforge.client.model.obj.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.Vertex;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
import team.chisel.Chisel;
|
||||
import team.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class RenderAutoChisel extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
private static final WavefrontObject model = new WavefrontObject(new ResourceLocation(Chisel.MOD_ID, "models/autoChisel/autoChisel.obj"));
|
||||
private static final ResourceLocation texture = new ResourceLocation(Chisel.MOD_ID, "textures/blocks/autoChisel/autoChisel.png");
|
||||
private static final WavefrontObject model = new WavefrontObject(
|
||||
new ResourceLocation(Chisel.MOD_ID, "models/autoChisel/autoChisel.obj"));
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
Chisel.MOD_ID,
|
||||
"textures/blocks/autoChisel/autoChisel.png");
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return helper == ItemRendererHelper.INVENTORY_BLOCK || helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return helper == ItemRendererHelper.INVENTORY_BLOCK || helper == ItemRendererHelper.ENTITY_BOBBING
|
||||
|| helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
glTranslatef(-0.5f, 0, 0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
glRotatef(20, 0, 1, 0);
|
||||
glRotatef(-15, 1, 0, -1);
|
||||
glScalef(0.65f, 0.65f, 0.65f);
|
||||
glTranslatef(0.75f, -0.5f, 1.25f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
glRotatef(20, 0, 0, 1);
|
||||
glRotatef(30, 0, 1, 0);
|
||||
glTranslatef(0.2f, 0, -0.1f);
|
||||
glScalef(0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
case INVENTORY:
|
||||
glTranslatef(-0.5f, -0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
glTranslatef(-0.5f, 0, 0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
glRotatef(20, 0, 1, 0);
|
||||
glRotatef(-15, 1, 0, -1);
|
||||
glScalef(0.65f, 0.65f, 0.65f);
|
||||
glTranslatef(0.75f, -0.5f, 1.25f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
glRotatef(20, 0, 0, 1);
|
||||
glRotatef(30, 0, 1, 0);
|
||||
glTranslatef(0.2f, 0, -0.1f);
|
||||
glScalef(0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
case INVENTORY:
|
||||
glTranslatef(-0.5f, -0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
model.renderAll();
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
model.renderAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
;
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tes = Tessellator.instance;
|
||||
IIcon icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : block.getIcon(0, 0);
|
||||
tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tes.setColorOpaque_F(1, 1, 1);
|
||||
tes.addTranslation(x, y, z + 1);
|
||||
for (GroupObject go : model.groupObjects) {
|
||||
for (Face f : go.faces) {
|
||||
Vertex n = f.faceNormal;
|
||||
tes.setNormal(n.x, n.y, n.z);
|
||||
for (int i = 0; i < f.vertices.length; i++) {
|
||||
Vertex vert = f.vertices[i];
|
||||
TextureCoordinate t = f.textureCoordinates[i];
|
||||
if (!renderer.hasOverrideBlockTexture()) {
|
||||
tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16));
|
||||
} else {
|
||||
tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU((t.u * 64) % 16), icon.getInterpolatedV((t.v * 64) % 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tes.addTranslation(-x, -y, -z - 1);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
Tessellator tes = Tessellator.instance;
|
||||
IIcon icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : block.getIcon(0, 0);
|
||||
tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tes.setColorOpaque_F(1, 1, 1);
|
||||
tes.addTranslation(x, y, z + 1);
|
||||
for (GroupObject go : model.groupObjects) {
|
||||
for (Face f : go.faces) {
|
||||
Vertex n = f.faceNormal;
|
||||
tes.setNormal(n.x, n.y, n.z);
|
||||
for (int i = 0; i < f.vertices.length; i++) {
|
||||
Vertex vert = f.vertices[i];
|
||||
TextureCoordinate t = f.textureCoordinates[i];
|
||||
if (!renderer.hasOverrideBlockTexture()) {
|
||||
tes.addVertexWithUV(
|
||||
vert.x,
|
||||
vert.y,
|
||||
vert.z,
|
||||
icon.getInterpolatedU(t.u * 16),
|
||||
icon.getInterpolatedV(t.v * 16));
|
||||
} else {
|
||||
tes.addVertexWithUV(
|
||||
vert.x,
|
||||
vert.y,
|
||||
vert.z,
|
||||
icon.getInterpolatedU((t.u * 64) % 16),
|
||||
icon.getInterpolatedV((t.v * 64) % 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tes.addTranslation(-x, -y, -z - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderAutoChiselId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderAutoChiselId;
|
||||
}
|
||||
|
||||
private final RenderItem renderItem;
|
||||
private final RenderItem renderItem;
|
||||
|
||||
public RenderAutoChisel() {
|
||||
Chisel.renderAutoChiselId = RenderingRegistry.getNextAvailableRenderId();
|
||||
public RenderAutoChisel() {
|
||||
Chisel.renderAutoChiselId = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
renderItem = new RenderItem() {
|
||||
renderItem = new RenderItem() {
|
||||
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
renderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
renderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
private static final Random rand = new Random();
|
||||
private static final Random rand = new Random();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
|
||||
// Render Blocks
|
||||
TileEntityAutoChisel autoChisel = (TileEntityAutoChisel) tile;
|
||||
EntityItem item = autoChisel.getItemForRendering(TileEntityAutoChisel.TARGET);
|
||||
// Render Blocks
|
||||
TileEntityAutoChisel autoChisel = (TileEntityAutoChisel) tile;
|
||||
EntityItem item = autoChisel.getItemForRendering(TileEntityAutoChisel.TARGET);
|
||||
|
||||
rand.setSeed(tile.xCoord + tile.yCoord + tile.zCoord);
|
||||
rand.nextBoolean();
|
||||
rand.setSeed(tile.xCoord + tile.yCoord + tile.zCoord);
|
||||
rand.nextBoolean();
|
||||
|
||||
float max = 0.35f;
|
||||
float max = 0.35f;
|
||||
|
||||
if (!Minecraft.getMinecraft().isGamePaused()) {
|
||||
autoChisel.xRot += (rand.nextFloat() * max) - (max / 2);
|
||||
autoChisel.yRot += (rand.nextFloat() * max) - (max / 2);
|
||||
autoChisel.zRot += (rand.nextFloat() * max) - (max / 2);
|
||||
}
|
||||
if (!Minecraft.getMinecraft().isGamePaused()) {
|
||||
autoChisel.xRot += (rand.nextFloat() * max) - (max / 2);
|
||||
autoChisel.yRot += (rand.nextFloat() * max) - (max / 2);
|
||||
autoChisel.zRot += (rand.nextFloat() * max) - (max / 2);
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
glRotatef(autoChisel.xRot, 1, 0, 0);
|
||||
glRotatef(autoChisel.yRot, 0, 1, 0);
|
||||
glRotatef(autoChisel.zRot, 0, 0, 1);
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(false);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
glRotatef(autoChisel.xRot, 1, 0, 0);
|
||||
glRotatef(autoChisel.yRot, 0, 1, 0);
|
||||
glRotatef(autoChisel.zRot, 0, 0, 1);
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(false);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
item = autoChisel.getItemForRendering(TileEntityAutoChisel.BASE);
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.35, y + 0.934, z + 0.5);
|
||||
item.getEntityItem().stackSize = autoChisel.getLastBase() == null ? 1 : autoChisel.getLastBase().stackSize;
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
glPopMatrix();
|
||||
}
|
||||
item = autoChisel.getItemForRendering(TileEntityAutoChisel.BASE);
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.35, y + 0.934, z + 0.5);
|
||||
item.getEntityItem().stackSize = autoChisel.getLastBase() == null ? 1 : autoChisel.getLastBase().stackSize;
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
GameSettings settings = Minecraft.getMinecraft().gameSettings;
|
||||
item = autoChisel.getItemForRendering(TileEntityAutoChisel.CHISEL);
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.7, y + 1.01, z + 0.5);
|
||||
float rot = autoChisel.chiselRot == 0 ? 0 : autoChisel.chiseling ? autoChisel.chiselRot + (TileEntityAutoChisel.rotAmnt * scale) : autoChisel.chiselRot
|
||||
- (TileEntityAutoChisel.rotAmnt * scale);
|
||||
glRotatef(rot, 0, 0, 1);
|
||||
glTranslated(-0.12, 0, 0);
|
||||
glScalef(0.9f, 0.9f, 0.9f);
|
||||
boolean was = settings.fancyGraphics;
|
||||
settings.fancyGraphics = true;
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
settings.fancyGraphics = was;
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
GameSettings settings = Minecraft.getMinecraft().gameSettings;
|
||||
item = autoChisel.getItemForRendering(TileEntityAutoChisel.CHISEL);
|
||||
if (item != null) {
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.7, y + 1.01, z + 0.5);
|
||||
float rot = autoChisel.chiselRot == 0 ? 0
|
||||
: autoChisel.chiseling ? autoChisel.chiselRot + (TileEntityAutoChisel.rotAmnt * scale)
|
||||
: autoChisel.chiselRot - (TileEntityAutoChisel.rotAmnt * scale);
|
||||
glRotatef(rot, 0, 0, 1);
|
||||
glTranslated(-0.12, 0, 0);
|
||||
glScalef(0.9f, 0.9f, 0.9f);
|
||||
boolean was = settings.fancyGraphics;
|
||||
settings.fancyGraphics = true;
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
settings.fancyGraphics = was;
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,162 +24,163 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class RenderCarvableBeacon extends TileEntityBeaconRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("textures/entity/beacon_beam.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation("textures/entity/beacon_beam.png");
|
||||
|
||||
private int renderId;
|
||||
private int renderId;
|
||||
|
||||
public RenderCarvableBeacon() {
|
||||
this.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public RenderCarvableBeacon() {
|
||||
this.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) {
|
||||
float f1 = beacon.func_146002_i();
|
||||
if (f1 > 0.1F) {
|
||||
renderBeam(f1, beacon.getWorldObj(), x, y, z, beacon.getBlockMetadata(), partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBeam(float f1, World world, double x, double y, double z, int meta, float partialTicks) {
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
Color color;
|
||||
if (meta < 15) {
|
||||
color = new Color(ItemDye.field_150922_c[meta]);
|
||||
} else {
|
||||
float hue = ((float) world.getTotalWorldTime() % 256) / 256;
|
||||
color = new Color(Color.HSBtoRGB(hue + (partialTicks / 256), 1, 1));
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
this.bindTexture(texture);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
|
||||
float f2 = world.getTotalWorldTime() + partialTicks;
|
||||
float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F);
|
||||
byte b0 = 1;
|
||||
double d3 = f2 * 0.025D * (1.0D - (b0 & 1) * 2.5D);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
|
||||
double d5 = b0 * 0.2D;
|
||||
double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
|
||||
double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
|
||||
double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
|
||||
double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
|
||||
double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
|
||||
double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
|
||||
double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
|
||||
double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
|
||||
double d23 = 256.0F * f1;
|
||||
double d25 = 0.0D;
|
||||
double d27 = 1.0D;
|
||||
double d28 = -1.0F + f3;
|
||||
double d29 = 256.0F * f1 * (0.5D / d5) + d28;
|
||||
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glDepthMask(false);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
|
||||
double d30 = 0.2D;
|
||||
double d4 = 0.2D;
|
||||
double d6 = 0.8D;
|
||||
double d8 = 0.2D;
|
||||
double d10 = 0.2D;
|
||||
double d12 = 0.8D;
|
||||
double d14 = 0.8D;
|
||||
double d16 = 0.8D;
|
||||
double d18 = 256.0F * f1;
|
||||
double d20 = 0.0D;
|
||||
double d22 = 1.0D;
|
||||
double d24 = -1.0F + f3;
|
||||
double d26 = 256.0F * f1 + d24;
|
||||
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) {
|
||||
float f1 = beacon.func_146002_i();
|
||||
if (f1 > 0.1F) {
|
||||
renderBeam(f1, beacon.getWorldObj(), x, y, z, beacon.getBlockMetadata(), partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityCarvableBeacon) tile, x, y, z, partialTicks);
|
||||
}
|
||||
private void renderBeam(float f1, World world, double x, double y, double z, int meta, float partialTicks) {
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
Color color;
|
||||
if (meta < 15) {
|
||||
color = new Color(ItemDye.field_150922_c[meta]);
|
||||
} else {
|
||||
float hue = ((float) world.getTotalWorldTime() % 256) / 256;
|
||||
color = new Color(Color.HSBtoRGB(hue + (partialTicks / 256), 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
renderer.renderBlockAsItem(Blocks.beacon, 0, 1);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5f, 0, -0.5f);
|
||||
renderBeam(0.00195f, Minecraft.getMinecraft().theWorld, 0, 0, 0, metadata, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
this.bindTexture(texture);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
|
||||
float f2 = world.getTotalWorldTime() + partialTicks;
|
||||
float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F);
|
||||
byte b0 = 1;
|
||||
double d3 = f2 * 0.025D * (1.0D - (b0 & 1) * 2.5D);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
|
||||
double d5 = b0 * 0.2D;
|
||||
double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
|
||||
double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
|
||||
double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
|
||||
double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
|
||||
double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
|
||||
double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
|
||||
double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
|
||||
double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
|
||||
double d23 = 256.0F * f1;
|
||||
double d25 = 0.0D;
|
||||
double d27 = 1.0D;
|
||||
double d28 = -1.0F + f3;
|
||||
double d29 = 256.0F * f1 * (0.5D / d5) + d28;
|
||||
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
|
||||
tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
|
||||
tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28);
|
||||
tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28);
|
||||
tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glDepthMask(false);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
|
||||
double d30 = 0.2D;
|
||||
double d4 = 0.2D;
|
||||
double d6 = 0.8D;
|
||||
double d8 = 0.2D;
|
||||
double d10 = 0.2D;
|
||||
double d12 = 0.8D;
|
||||
double d14 = 0.8D;
|
||||
double d16 = 0.8D;
|
||||
double d18 = 256.0F * f1;
|
||||
double d20 = 0.0D;
|
||||
double d22 = 1.0D;
|
||||
double d24 = -1.0F + f3;
|
||||
double d26 = 256.0F * f1 + d24;
|
||||
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
|
||||
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
|
||||
tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
|
||||
tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
|
||||
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
float f = 0.1875F;
|
||||
boolean breaking = renderer.hasOverrideBlockTexture();
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.glass));
|
||||
}
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
renderer.renderAllFaces = true;
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.obsidian));
|
||||
}
|
||||
renderer.setRenderBounds(0.125D, 0.00625D, 0.125D, 0.875D, f, 0.875D);
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.beacon));
|
||||
}
|
||||
renderer.setRenderBounds(0.1875D, f, 0.1875D, 0.8125D, 0.875D, 0.8125D);
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
renderer.renderAllFaces = false;
|
||||
renderer.clearOverrideBlockTexture();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityCarvableBeacon) tile, x, y, z, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
renderer.renderBlockAsItem(Blocks.beacon, 0, 1);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5f, 0, -0.5f);
|
||||
renderBeam(0.00195f, Minecraft.getMinecraft().theWorld, 0, 0, 0, metadata, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderId;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
float f = 0.1875F;
|
||||
boolean breaking = renderer.hasOverrideBlockTexture();
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.glass));
|
||||
}
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
renderer.renderAllFaces = true;
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.obsidian));
|
||||
}
|
||||
renderer.setRenderBounds(0.125D, 0.00625D, 0.125D, 0.875D, f, 0.875D);
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
if (!breaking) {
|
||||
renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.beacon));
|
||||
}
|
||||
renderer.setRenderBounds(0.1875D, f, 0.1875D, 0.8125D, 0.875D, 0.8125D);
|
||||
renderer.renderStandardBlockWithAmbientOcclusion(block, x, y, z, 1, 1, 1);
|
||||
renderer.renderAllFaces = false;
|
||||
renderer.clearOverrideBlockTexture();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderId;
|
||||
}
|
||||
}
|
||||
@@ -19,127 +19,130 @@ import team.chisel.block.tileentity.TileEntityPresent;
|
||||
import team.chisel.init.ChiselBlocks;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderPresent extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
|
||||
private ModelChest smallChest = new ModelChest();
|
||||
private ModelChest largeChest = new ModelLargeChest();
|
||||
private ModelChest smallChest = new ModelChest();
|
||||
private ModelChest largeChest = new ModelLargeChest();
|
||||
|
||||
private HashMap<Integer, ResourceLocation> textureCache = Maps.newHashMap();
|
||||
private HashMap<Integer, ResourceLocation> textureCache = Maps.newHashMap();
|
||||
|
||||
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
||||
int rotation = present.getRotation();
|
||||
bindTexture(present);
|
||||
if (!present.isConnected()) {
|
||||
GL11.glRotatef(90 * rotation + 180, 0, 1, 0);
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
GL11.glTranslatef(-1, 0, -1);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glTranslatef(0, 0, -1);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(-1, 0, 0);
|
||||
break;
|
||||
}
|
||||
smallChest.renderAll();
|
||||
} else if (present.isParent()) {
|
||||
ForgeDirection dir = present.getConnectionDir();
|
||||
switch (dir) {
|
||||
case NORTH:
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, -1);
|
||||
break;
|
||||
case SOUTH:
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glTranslatef(-1, 0, -1);
|
||||
break;
|
||||
case WEST:
|
||||
GL11.glTranslatef(-1, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (rotation == 0 || rotation == 3) {
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
GL11.glTranslatef(-2, 0, -1);
|
||||
}
|
||||
largeChest.renderAll();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
||||
int rotation = present.getRotation();
|
||||
bindTexture(present);
|
||||
if (!present.isConnected()) {
|
||||
GL11.glRotatef(90 * rotation + 180, 0, 1, 0);
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
GL11.glTranslatef(-1, 0, -1);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glTranslatef(0, 0, -1);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(-1, 0, 0);
|
||||
break;
|
||||
}
|
||||
smallChest.renderAll();
|
||||
} else if (present.isParent()) {
|
||||
ForgeDirection dir = present.getConnectionDir();
|
||||
switch (dir) {
|
||||
case NORTH:
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, -1);
|
||||
break;
|
||||
case SOUTH:
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
GL11.glTranslatef(-1, 0, -1);
|
||||
break;
|
||||
case WEST:
|
||||
GL11.glTranslatef(-1, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (rotation == 0 || rotation == 3) {
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
GL11.glTranslatef(-2, 0, -1);
|
||||
}
|
||||
largeChest.renderAll();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void bindTexture(TileEntityPresent present) {
|
||||
int idx = present.getWorldObj().getBlockMetadata(present.xCoord, present.yCoord, present.zCoord) + (present.isConnected() ? 0 : 16);
|
||||
ResourceLocation rl = textureCache.get(idx);
|
||||
if (rl == null) {
|
||||
String res = ChiselBlocks.present.getModelTexture(idx % 16);
|
||||
res += present.isConnected() ? "_double.png" : ".png";
|
||||
rl = new ResourceLocation("chisel", res);
|
||||
textureCache.put(idx, rl);
|
||||
}
|
||||
bindTexture(rl);
|
||||
}
|
||||
private void bindTexture(TileEntityPresent present) {
|
||||
int idx = present.getWorldObj().getBlockMetadata(present.xCoord, present.yCoord, present.zCoord)
|
||||
+ (present.isConnected() ? 0 : 16);
|
||||
ResourceLocation rl = textureCache.get(idx);
|
||||
if (rl == null) {
|
||||
String res = ChiselBlocks.present.getModelTexture(idx % 16);
|
||||
res += present.isConnected() ? "_double.png" : ".png";
|
||||
rl = new ResourceLocation("chisel", res);
|
||||
textureCache.put(idx, rl);
|
||||
}
|
||||
bindTexture(rl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityPresent) tileEntity, x, y, z, partialTicks);
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityPresent) tileEntity, x, y, z, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, ChiselBlocks.present.getModelTexture(item.getItemDamage()) + ".png"));
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||
new ResourceLocation(
|
||||
Chisel.MOD_ID,
|
||||
ChiselBlocks.present.getModelTexture(item.getItemDamage()) + ".png"));
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlock(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
smallChest.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderBlock(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
smallChest.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderInventory(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
smallChest.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderInventory(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
smallChest.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user