Complete Couch Model

This commit is contained in:
Kam committed 2025-02-12 15:41:47 -05:00
1 parent c6bb5b1b74
commit 0a04560243
8 files changed
+72 -97

No files matched your search

@@ -26,13 +26,13 @@ import noppes.npcs.blocks.tiles.TileCouchWool;
import java.util.List;
public class BlockCouchWool extends BlockContainer{
public int renderId = -1;
public BlockCouchWool() {
super(Material.wood);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
ItemStack item = player.inventory.getCurrentItem();
if(item == null || item.getItem() != Items.dye)
@@ -49,8 +49,8 @@ public class BlockCouchWool extends BlockContainer{
}
return true;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -60,7 +60,7 @@ public class BlockCouchWool extends BlockContainer{
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public int damageDropped(int par1)
{
return par1;
@@ -69,7 +69,7 @@ public class BlockCouchWool extends BlockContainer{
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.5, z + 1);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@@ -77,7 +77,7 @@ public class BlockCouchWool extends BlockContainer{
TileCouchWool tile = (TileCouchWool) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
updateModel(par1World, par2, par3, par4, tile);
onNeighborBlockChange(par1World, par2 + 1, par3, par4, this);
@@ -88,7 +88,7 @@ public class BlockCouchWool extends BlockContainer{
par1World.markBlockForUpdate(par2, par3, par4);
}
@Override
@Override
public void onNeighborBlockChange(World worldObj, int x, int y, int z, Block block) {
if(worldObj.isRemote || block != this)
return;
@@ -98,7 +98,7 @@ public class BlockCouchWool extends BlockContainer{
updateModel(worldObj, x, y, z, (TileCouchWool) tile);
worldObj.markBlockForUpdate(x, y, z);
}
private void updateModel(World world, int x, int y, int z, TileCouchWool tile){
if(world.isRemote)
return;
@@ -130,16 +130,16 @@ public class BlockCouchWool extends BlockContainer{
}
private boolean compareCornerTiles(TileCouchWool tile, int x, int y, int z, World world, int meta, boolean isLeft){
int meta2 = world.getBlockMetadata(x, y, z);
if(meta2 != meta)
return false;
// if(meta2 != meta)
// return false;
TileEntity tile2 = world.getTileEntity(x , y, z);
int rotation = (tile.rotation + (!isLeft?1:3)) % 4;
return tile2 != null & tile2 instanceof TileCouchWool && ((TileCouchWool)tile2).rotation == rotation;
}
private boolean compareTiles(TileCouchWool tile, int x, int y, int z, World world, int meta){
int meta2 = world.getBlockMetadata(x, y, z);
if(meta2 != meta)
return false;
// if(meta2 != meta)
// return false;
TileEntity tile2 = world.getTileEntity(x, y, z);
if(tile2 == null || !(tile2 instanceof TileCouchWool))
return false;
@@ -155,25 +155,25 @@ public class BlockCouchWool extends BlockContainer{
return tile.rotation == rotation;
}
@Override
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
@Override
public int getRenderType(){
return renderId;
return renderId;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
@@ -7,6 +7,7 @@ import net.minecraft.entity.Entity;
public class ModelBannerWallFlag extends ModelBase {
public final ModelRenderer BannerFlag;
public final float rotationX = 0;
public ModelBannerWallFlag() {
textureWidth = 32;
@@ -7,13 +7,12 @@ import net.minecraft.entity.Entity;
public class ModelCouchCorner extends ModelBase {
public final ModelRenderer CouchBack;
public final ModelRenderer Cussion;
private final ModelRenderer cube_r1;
public final ModelRenderer Cussion;
private final ModelRenderer cube_r2;
private final ModelRenderer cube_r3;
public ModelCouchCorner(){
public ModelCouchCorner() {
textureWidth = 64;
textureHeight = 64;
@@ -35,7 +34,7 @@ public class ModelCouchCorner extends ModelBase {
Cussion = new ModelRenderer(this);
Cussion.setRotationPoint(0.0F, 24.0F, 0.0F);
Cussion.cubeList.add(new ModelBox(Cussion, 1, 37, -8.0F, -7.0F, -8.0F, 15, 4, 15, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 1, 20, -8.0F, -16.0F, 4.0F, 15, 9, 3, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 0, 19, -8.0F, -16.0F, 3.0F, 15, 9, 4, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 0, 32, -8.0F, -16.0F, 7.0F, 16, 4, 1, 0.0F));
cube_r2 = new ModelRenderer(this);
@@ -48,7 +47,7 @@ public class ModelCouchCorner extends ModelBase {
cube_r3.setRotationPoint(5.5F, -11.5F, -3.5F);
Cussion.addChild(cube_r3);
setRotationAngle(cube_r3, 0.0F, 1.5708F, 0.0F);
cube_r3.cubeList.add(new ModelBox(cube_r3, 5, 20, -7.5F, -4.5F, -1.5F, 12, 9, 3, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 5, 19, -6.5F, -4.5F, -2.5F, 11, 9, 4, 0.0F));
}
@Override
@@ -6,10 +6,10 @@ import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelCouchSingle extends ModelBase {
public final ModelRenderer Cussion;
public final ModelRenderer CouchBack;
private final ModelRenderer ArmL;
private final ModelRenderer ArmR;
public final ModelRenderer Cussion;
public ModelCouchSingle() {
textureWidth = 64;
@@ -21,34 +21,34 @@ public class ModelCouchSingle extends ModelBase {
CouchBack.cubeList.add(new ModelBox(CouchBack, 0, 35, 6.0F, -2.0F, -8.0F, 2, 2, 2, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 0, 35, -8.0F, -2.0F, 6.0F, 2, 2, 2, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 0, 35, 6.0F, -2.0F, 6.0F, 2, 2, 2, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 0, 35, -8.0F, -3.0F, -8.0F, 16, 1, 15, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 0, 51, -8.0F, -12.0F, 7.0F, 16, 10, 1, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 2, 35, -6.0F, -3.0F, -8.0F, 12, 1, 15, 0.0F));
CouchBack.cubeList.add(new ModelBox(CouchBack, 2, 51, -6.0F, -12.0F, 7.0F, 12, 10, 1, 0.0F));
ArmL = new ModelRenderer(this);
ArmL.setRotationPoint(9.0F, -7.0F, 0.0F);
CouchBack.addChild(ArmL);
ArmL.mirror = true;
ArmL.cubeList.add(new ModelBox(ArmL, 24, 21, -1.0F, -5.0F, -8.0F, 2, 2, 12, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 14, 17, 0.0F, -3.0F, -6.0F, 0, 4, 10, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 40, 23, -1.0F, -3.0F, -8.0F, 2, 8, 2, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 0, 21, -1.0F, 1.0F, -6.0F, 2, 4, 10, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 22, 48, -1.0F, -5.0F, 4.0F, 2, 10, 4, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 24, 21, -3.0F, -5.0F, -8.0F, 2, 2, 12, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 14, 17, -2.0F, -3.0F, -6.0F, 0, 4, 10, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 40, 23, -3.0F, -3.0F, -8.0F, 2, 8, 2, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 0, 21, -3.0F, 1.0F, -6.0F, 2, 4, 10, 0.0F));
ArmL.cubeList.add(new ModelBox(ArmL, 22, 48, -3.0F, -5.0F, 4.0F, 2, 10, 4, 0.0F));
ArmL.mirror = false;
ArmR = new ModelRenderer(this);
ArmR.setRotationPoint(-9.0F, -7.0F, 0.0F);
CouchBack.addChild(ArmR);
ArmR.cubeList.add(new ModelBox(ArmR, 24, 21, -1.0F, -5.0F, -8.0F, 2, 2, 12, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 14, 17, 0.0F, -3.0F, -6.0F, 0, 4, 10, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 0, 21, -1.0F, 1.0F, -6.0F, 2, 4, 10, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 40, 23, -1.0F, -3.0F, -8.0F, 2, 8, 2, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 22, 48, -1.0F, -5.0F, 4.0F, 2, 10, 4, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 24, 21, 1.0F, -5.0F, -8.0F, 2, 2, 12, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 14, 17, 2.0F, -3.0F, -6.0F, 0, 4, 10, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 0, 21, 1.0F, 1.0F, -6.0F, 2, 4, 10, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 40, 23, 1.0F, -3.0F, -8.0F, 2, 8, 2, 0.0F));
ArmR.cubeList.add(new ModelBox(ArmR, 22, 48, 1.0F, -5.0F, 4.0F, 2, 10, 4, 0.0F));
Cussion = new ModelRenderer(this);
Cussion.setRotationPoint(0.0F, 24.0F, 0.0F);
Cussion.cubeList.add(new ModelBox(Cussion, 0, 0, -8.0F, -7.0F, -8.0F, 16, 4, 15, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 0, 19, -8.0F, -16.0F, 3.0F, 16, 9, 4, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 0, 32, -8.0F, -16.0F, 7.0F, 16, 4, 1, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 2, 0, -6.0F, -7.0F, -8.0F, 12, 4, 15, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 2, 19, -6.0F, -16.0F, 3.0F, 12, 9, 4, 0.0F));
Cussion.cubeList.add(new ModelBox(Cussion, 2, 32, -6.0F, -16.0F, 7.0F, 12, 4, 1, 0.0F));
}
@Override
@@ -96,32 +96,6 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
else
modelLegacyCouchMiddleWool.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
int leftDX = 0, leftDZ = 0, rightDX = 0, rightDZ = 0;
switch(tile.rotation) {
case 1: // Facing south: left = east, right = west
leftDX = 0; leftDZ = 1;
rightDX = 0; rightDZ = -1;
break;
case 0: // Facing west: left = south, right = north
leftDX = 1; leftDZ = 0;
rightDX = -1; rightDZ = 0;
break;
case 3: // Facing north: left = west, right = east
leftDX = 0; leftDZ = -1;
rightDX = 0; rightDZ = 1;
break;
case 2: // Facing east: left = north, right = south
leftDX = -1; leftDZ = 0;
rightDX = 1; rightDZ = 0;
break;
}
// Check if the blocks to the left and right are solid
Block blockLeft = tile.getWorldObj().getBlock(tile.xCoord + leftDX, tile.yCoord, tile.zCoord + leftDZ);
Block blockRight = tile.getWorldObj().getBlock(tile.xCoord + rightDX, tile.yCoord, tile.zCoord + rightDZ);
boolean leftSolid = blockLeft != null && blockLeft.getMaterial().isSolid();
boolean rightSolid = blockRight != null && blockRight.getMaterial().isSolid();
setCouchWood(var1.getBlockMetadata());
if(tile.hasCornerLeft){
GL11.glPushMatrix();
@@ -138,27 +112,7 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
else if(tile.hasRight)
modelCouchRight.CouchBack.render(0.0625F);
else {
if(leftSolid && rightSolid) {
// Both sides occupied: use middle couch
modelCouch.CouchBack.render(0.0625F);
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
modelCouch.Cussion.render(0.0625F);
} else if(leftSolid) {
// Block to left exists -> use right couch model
modelCouchRight.CouchBack.render(0.0625F);
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
modelCouchRight.Cussion.render(0.0625F);
} else if(rightSolid) {
// Block to right exists -> use left couch model
modelCouchLeft.CouchBack.render(0.0625F);
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
modelCouchLeft.Cussion.render(0.0625F);
} else {
// Neither side has a solid block: use the singleton couch model
modelCouchSingle.CouchBack.render(0.0625F);
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
modelCouchSingle.Cussion.render(0.0625F);
}
modelCouchSingle.CouchBack.render(0.0625F);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
@@ -176,15 +130,7 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
else if(tile.hasRight)
modelCouchRight.Cussion.render(0.0625F);
else {
if(leftSolid && rightSolid) {
modelCouch.Cussion.render(0.0625F);
} else if(leftSolid) {
modelCouchRight.Cussion.render(0.0625F);
} else if(rightSolid) {
modelCouchLeft.Cussion.render(0.0625F);
} else {
modelCouchSingle.Cussion.render(0.0625F);
}
modelCouchSingle.Cussion.render(0.0625F);
}
}
GL11.glDisable(GL11.GL_ALPHA_TEST);
@@ -67,7 +67,35 @@ public abstract class BlockRendererInterface extends TileEntitySpecialRenderer i
0.1F, 0.1F, 0.1F
}
};
@Override
public static int colorTableInts[][] = {
{ 0xFFFFFF }, // White
{ 0xF2B233 }, // Light Orange
{ 0xE680D9 }, // Pinkish Purple
{ 0x99B2F2 }, // Light Blue
{ 0xE6E633 }, // Yellow
{ 0x80CC1A }, // Green
{ 0xF2B2CC }, // Light Pink
{ 0x4D4D4D }, // Dark Gray
{ 0x999999 }, // Gray
{ 0x4D99B2 }, // Teal
{ 0xB266E6 }, // Purple
{ 0x3366CC }, // Deep Blue
{ 0x805D4D }, // Brown
{ 0x668033 }, // Olive Green
{ 0xCC4D4D }, // Red
{ 0x1A1A1A } // Black
};
public static float[] hexToRGB(int hex) {
float r = ((hex >> 16) & 0xFF) / 255.0F;
float g = ((hex >> 8) & 0xFF) / 255.0F;
float b = (hex & 0xFF) / 255.0F;
return new float[]{r, g, b};
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
Block block, int modelId, RenderBlocks renderer) {
return false;
@@ -203,6 +203,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
modelLegacyWallBannerFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
else {
flag.BannerFlag.rotateAngleX = 0;
BlockBannerRenderer.setBannerMaterial(metadata);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);