Наложение текстуры на блок [1.5.2]

769
2
42
И снова здравствуйте. У меня возникла проблема с наложением текстуры на блок. На самом предмете отображено правильно, но у блока по другому.
Блок:
Код:
package mods.fbuilder.futurebuilder.machines;

import java.util.List;

import mods.fbuilder.futurebuilder.client.FutureBuilder;
import mods.fbuilder.futurebuilder.tile.TileEntityAdvancedBatteryBox;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.block.BlockAdvanced;

public class AdvancedBatteryBox extends BlockAdvanced {
    
    private Icon top;
    private Icon bottom;
    private Icon Input;

    public static final int ADVANCED_BATTERY_BOX_METADATA = 8;
    private Icon iconMachineSide;
    private Icon iconInput;
    private Icon iconOutput;
    private Icon iconAdvancedBatteryBox;

    public AdvancedBatteryBox(int id, int textureIndex) {
        super(id, UniversalElectricity.machine);
        this.setUnlocalizedName("bcMachine");
        this.setCreativeTab(FutureBuilder.tabFutureBuilder);
        this.setStepSound(Block.soundMetalFootstep);
    }

    public void registerIcons(IconRegister par1IconRegister) {
        super.blockIcon = par1IconRegister.registerIcon("fbuilder/futurebuilder:machine");
        this.iconInput = par1IconRegister.registerIcon("fbuilder/futurebuilder:machine_input");
        this.iconOutput = par1IconRegister.registerIcon("fbuilder/futurebuilder:machine_output");
        this.iconMachineSide = par1IconRegister.registerIcon("fbuilder/futurebuilder:machine_side");
        this.iconAdvancedBatteryBox = par1IconRegister.registerIcon("fbuilder/futurebuilder:advbatterybox");
    }
    
    public Icon getIcon(int side, int metadata) {
        if (side != 0 && side != 1) {
            if (metadata >= 8) {
                metadata -= 8;
                if (side == metadata + 2) {
                    return this.iconInput;
                }

            } else {
                if (metadata >= 4) {
                    metadata -= 4;
                    if (side == metadata + 2) {
                        return this.iconOutput;
                    }

                    if (side == ForgeDirection.getOrientation(metadata + 2).getOpposite().ordinal()) {
                        return this.iconInput;
                    }

                    return this.iconAdvancedBatteryBox;
                }

                if (side == metadata + 2) {
                    return this.iconOutput;
                }

            }

            return this.iconMachineSide;
        } else {
            return super.blockIcon;
        }
    }

    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) {
        int metadata = world.getBlockMetadata(x, y, z);
        int angle = MathHelper.floor_double((double) (entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
        byte change = 0;
        switch (angle) {
        case 0:
            change = 1;
            break;
        case 1:
            change = 2;
            break;
        case 2:
            change = 0;
            break;
        case 3:
            change = 3;
        }

        if (metadata >= 8) {
            world.setBlockMetadataWithNotify(x, y, z, 8 + change, 3);
        } else if (metadata >= 4) {
            switch (angle) {
            case 0:
                change = 3;
                break;
            case 1:
                change = 1;
                break;
            case 2:
                change = 2;
                break;
            case 3:
                change = 0;
            }

            world.setBlockMetadataWithNotify(x, y, z, 4 + change, 3);
        } else {
            world.setBlockMetadataWithNotify(x, y, z, 0 + change, 3);
        }

    }

    public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side,
            float hitX, float hitY, float hitZ) {
        int metadata = par1World.getBlockMetadata(x, y, z);
        int original = metadata;
        int change = 0;
        if (metadata >= 8) {
            original = metadata - 8;
        } else if (metadata >= 4) {
            original = metadata - 4;
        }

        switch (original) {
        case 0:
            change = 3;
            break;
        case 1:
            change = 2;
            break;
        case 2:
            change = 0;
            break;
        case 3:
            change = 1;
        }

        if (metadata >= 8) {
            change += 8;
        } else if (metadata >= 4) {
            change += 4;
        }

        par1World.setBlockMetadataWithNotify(x, y, z, change, 3);
        return true;
    }

    public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
        par5EntityPlayer.openGui(FutureBuilder.instance, 2, par1World, x, y, z);
        return true;
        }
    public boolean isOpaqueCube() {
        return false;
    }

    public boolean renderAsNormalBlock() {
        return false;
    }

    @Override
    public TileEntity createNewTileEntity(World world) {
    return new TileEntityAdvancedBatteryBox();
    }
    public ItemStack getAdvancedBatteryBox() {
        return new ItemStack(super.blockID, 1, 4);
    }
    public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
        par3List.add(this.getAdvancedBatteryBox());
    }

    public int damageDropped(int metadata) {
        return metadata >= 8 ? 8 : (metadata >= 4 ? 4 : 0);
    }

    public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
        int id = this.idPicked(world, x, y, z);
        if (id == 0) {
            return null;
        } else {
            Item item = Item.itemsList[id];
            if (item == null) {
                return null;
            } else {
                int metadata = this.getDamageValue(world, x, y, z);
                return new ItemStack(id, 1, metadata);
            }
        }
    }
}
c2ee99298b96.png

2d7a3b6736e1.png

5fa44f371f28.png

13c4a3d78983.png
 
Украина.Да короче у тебя код не правильный в бинде текстуры, ищи на mcmodding.ru в учебнике.
 
А как быть с входом и выходом энергии через блок? (Код брал из BasicComponents, поэтому не знаю)
 
Назад
Сверху