Рендер блока. Снова нужна помощь.

Статус
В этой теме нельзя размещать новые ответы.
Вообщем-то, всё работает, но как-то криво (у меня по-другому пока-что и не получается). Блок виден только если смотреть сбоку, но если смотреть, например, сверху, то текстура пропадает. С чем это может быть связано?
 
Со многим может быть связано. Не там объявлена текстура или ещё-что, точно не известно...
 
Гл. класс:
Код:
package teemoxa.mods.hardcoremode;

import net.minecraft.init.Items;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.EnumHelper;
import teemoxa.mods.hardcoremode.blocks.BlockLoader;
import teemoxa.mods.hardcoremode.items.ItemLoader;
import teemoxa.mods.hardcoremode.proxy.CommonProxy;
import teemoxa.mods.hardcoremode.recipes.ToolRecipes;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;



@Mod(modid = Links.MODID, name = Links.MODNAME, version = Links.MODVERSION)

public class Core 
{
    @Mod.Instance(Links.MODID)
    public static Core mod;
    
    @SidedProxy(clientSide="teemoxa.mods.hardcoremode.proxy.ClientProxy", serverSide="teemoxa.mods.hardcoremode.proxy.CommonProxy")
    public static CommonProxy proxy;
    
    public static ItemLoader iLoader;
    
    public static ToolRecipes tRec;
    
    public static RemoveList rem;
    
    public static BlockLoader block;
    
    public static Localizator local;
    
    
    
    
    
    @EventHandler
    public void preLoad(FMLPreInitializationEvent e)
    {
        proxy.load();
        rem.getRemoveList();
        iLoader.load();
        block.load();
        
        
        
    
        
    }
    
    @EventHandler
    public void load(FMLInitializationEvent e)
    {
        
        tRec.loadRecipe();
        local.startLocalization();
        
        
    }
    
    @EventHandler
    public void PostLoad(FMLPostInitializationEvent e)
    {
        
    }
    
}
ClientProxy:
Код:
package teemoxa.mods.hardcoremode.proxy;

import cpw.mods.fml.client.registry.ClientRegistry;
import teemoxa.mods.hardcoremode.blocks.BlockLoader;
import teemoxa.mods.hardcoremode.items.PickOfSurviving;
import teemoxa.mods.hardcoremode.renderer.RenderCobbleBlock;
import teemoxa.mods.hardcoremode.renderer.TECobbles;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemPickaxe;
import net.minecraftforge.client.MinecraftForgeClient;

public class ClientProxy extends CommonProxy 
{
    
    
    
    
    public void load() 
    {
        TileEntitySpecialRenderer renderer = new RenderCobbleBlock();
        ClientRegistry.bindTileEntitySpecialRenderer(TECobbles.class, renderer);

        
    }
}
Сам блок:

Код:
package teemoxa.mods.hardcoremode.blocks;

import teemoxa.mods.hardcoremode.renderer.TECobbles;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class Cobbles extends BlockContainer {

    protected Cobbles(Material p_i45394_1_) {
        super(p_i45394_1_);
        this.setCreativeTab(CreativeTabs.tabBlock);
    }

    
    public int getRenderType() {return -1;}
    public boolean renderAsNormalBlock() {return false;}
    public boolean isOpaqueCube() {return false;}
    
    @Override
    public TileEntity createNewTileEntity(World world,int i) {return new TECobbles();}

    
    


    }

Рендерер:
Код:
import org.lwjgl.opengl.GL11;

import teemoxa.mods.hardcoremode.Links;
import teemoxa.mods.hardcoremode.renderer.models.Cobble;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class RenderCobbleBlock extends TileEntitySpecialRenderer{

    private final Cobble model;
    
    public RenderCobbleBlock() {
        model = new Cobble();
    }
    
    
    
    
    public void renderTileEntityAt(TileEntity te, double dx,double dy, double dz, float f1) {
        renderTE((TECobbles)te, dx, dy, dz, f1);
        
    }
    
    public void renderTE(TECobbles te, double dx, double dy, double dz, float f) {
        GL11.glPushMatrix();
        GL11.glTranslated(dx, dy, dz);
        GL11.glTranslatef((float)dx+0.5F, (float)dy+1.5F,(float)dz+ 0.5F);
        GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
        bindTexture(new ResourceLocation("textures/blocks/gravel.png"));
            GL11.glPushMatrix();
            model.renderModel(0.0625F);
            GL11.glPopMatrix();
        GL11.glPopMatrix();
        }
}
TileEntity:
Код:
import net.minecraft.tileentity.TileEntity;

public class TECobbles extends TileEntity{}
на всякий случай модель:
Код:
package teemoxa.mods.hardcoremode.renderer.models;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class Cobble extends ModelBase
{
  //fields
    ModelRenderer Shape;
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
  
  public Cobble()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      Shape = new ModelRenderer(this, 0, 0);
      Shape.addBox(0F, 0F, 0F, 2, 2, 2);
      Shape.setRotationPoint(0F, 22F, 0F);
      Shape.setTextureSize(64, 32);
      Shape.mirror = true;
      setRotation(Shape, 0F, 0F, 0F);
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(0F, 0F, 0F, 3, 3, 4);
      Shape1.setRotationPoint(-6F, 21F, 4F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 0);
      Shape2.addBox(0F, 1F, 1F, 3, 3, 1);
      Shape2.setRotationPoint(0F, 20F, 0F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, -0.9250245F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 0, 0);
      Shape3.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape3.setRotationPoint(4F, 23F, 0F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 0, 0);
      Shape4.addBox(0F, 0F, 0F, 1, 1, 1);
      Shape4.setRotationPoint(-4F, 23F, -3F);
      Shape4.setTextureSize(64, 32);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Shape.render(f5);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
  }
  
  public void renderModel(float f5){
          Shape.render(f5);
        Shape1.render(f5);
        Shape2.render(f5);
        Shape3.render(f5);
        Shape4.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5,ent);
  }

}
 
Код:
public void renderTE(TECobbles te, double dx, double dy, double dz, float f) {
GL11.glPushMatrix();
GL11.glTranslated(dx, dy, dz);
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
bindTexture(new ResourceLocation("textures/blocks/gravel.png"));
model.renderModel(0.0625F);
GL11.glPopMatrix();
}
 
В который раз вы, Timaxa007, меня выручаете. Всё работает! И с рендером блока я разобрался. Вам о-о-о-о-о-огромное спасибо.
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху