Jump to content

Entity rendering as a white box


Nomis

Recommended Posts

IO2iSoi.png

 

I'm trying to create a block renders as a techne model but this is what i get ^^^

 

I have no idea why this happens. Here is my src code:

 

Main Mod

 

@Mod(modid = FactoryCraft.MODID, name = FactoryCraft.NAME, version = FactoryCraft.VERSION)
public class FactoryCraft {
@SidedProxy(clientSide = "me.FactoryCraft.FactoryCraft.ClientProxy", serverSide = "me.FactoryCraft.FactoryCraft.CommonProxy")
public static CommonProxy proxy;

    public static final String MODID = "FactoryCraft";
    public static final String VERSION = "0.0.1a";
    public static final String NAME = "Factory Craft";
    
    public static Block woodMachineFrame = new WoodMachineFrame(1234, Material.wood).setBlockName("WoodMachineFrame").setBlockTextureName(FactoryCraft.MODID + ":planks");    
    @Instance(FactoryCraft.MODID)
    public static FactoryCraft instance;
    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	GameRegistry.registerBlock(woodMachineFrame, "WoodMachineFrame");
    	
    	Items.init();
    	Entities.init();
    }

 

 

ClientProxy

 

public class ClientProxy extends CommonProxy {
@Override
public void initRenderes() {
	RenderingRegistry.registerEntityRenderingHandler(EntityChimney.class, new RenderChimney());
}
}

 

 

The Entity

 

public class EntityChimney extends Entity {

public EntityChimney(World world) {
	super(world);
}

public EntityChimney(World world, double x, double y, double z) {
	super(world);

	posX = x;
	posY = y;
	posZ = z;
}

@Override
protected void entityInit() {
}

@Override
protected void readEntityFromNBT(NBTTagCompound var1) {
}

@Override
protected void writeEntityToNBT(NBTTagCompound var1) {	
}
}

 

 

The Model (The names are in danish... But it's made in techne)

 

public class ModelChimney extends ModelBase
{
  //fields
    ModelRenderer fladeF;
    ModelRenderer fladeR;
    ModelRenderer fladeL;
    ModelRenderer fladeB;
    ModelRenderer streg1;
    ModelRenderer streg2;
    ModelRenderer streg3;
    ModelRenderer streg4;
    ModelRenderer streg5;
    ModelRenderer streg6;
    ModelRenderer streg7;
    ModelRenderer streg8;
    ModelRenderer Shape9;
    ModelRenderer streg10;
    ModelRenderer streg11;
    ModelRenderer streg12;
  
  public ModelChimney()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      fladeF = new ModelRenderer(this, 0, 0);
      fladeF.addBox(0F, 0F, 0F, 6, 16, 1);
      fladeF.setRotationPoint(-3F, 8F, -7F);
      fladeF.setTextureSize(64, 32);
      fladeF.mirror = true;
      setRotation(fladeF, 0F, 0F, 0F);
      fladeR = new ModelRenderer(this, 0, 0);
      fladeR.addBox(0F, 0F, 0F, 1, 16, 6);
      fladeR.setRotationPoint(-7F, 8F, -3F);
      fladeR.setTextureSize(64, 32);
      fladeR.mirror = true;
      setRotation(fladeR, 0F, 0F, 0F);
      fladeL = new ModelRenderer(this, 0, 0);
      fladeL.addBox(0F, 0F, 0F, 1, 16, 6);
      fladeL.setRotationPoint(6F, 8F, -3F);
      fladeL.setTextureSize(64, 32);
      fladeL.mirror = true;
      setRotation(fladeL, 0F, 0F, 0F);
      fladeB = new ModelRenderer(this, 0, 0);
      fladeB.addBox(0F, 0F, 0F, 6, 16, 1);
      fladeB.setRotationPoint(-3F, 8F, 6F);
      fladeB.setTextureSize(64, 32);
      fladeB.mirror = true;
      setRotation(fladeB, 0F, 0F, 0F);
      streg1 = new ModelRenderer(this, 0, 0);
      streg1.addBox(0F, 0F, 0F, 1, 16, 1);
      streg1.setRotationPoint(-6F, 8F, 3F);
      streg1.setTextureSize(64, 32);
      streg1.mirror = true;
      setRotation(streg1, 0F, 0F, 0F);
      streg2 = new ModelRenderer(this, 0, 0);
      streg2.addBox(0F, 0F, 0F, 1, 16, 1);
      streg2.setRotationPoint(-6F, 8F, -4F);
      streg2.setTextureSize(64, 32);
      streg2.mirror = true;
      setRotation(streg2, 0F, 0F, 0F);
      streg3 = new ModelRenderer(this, 0, 0);
      streg3.addBox(0F, 0F, 0F, 1, 16, 1);
      streg3.setRotationPoint(4F, 8F, -5F);
      streg3.setTextureSize(64, 32);
      streg3.mirror = true;
      setRotation(streg3, 0F, 0F, 0F);
      streg4 = new ModelRenderer(this, 0, 0);
      streg4.addBox(0F, 0F, 0F, 1, 16, 1);
      streg4.setRotationPoint(5F, 8F, -4F);
      streg4.setTextureSize(64, 32);
      streg4.mirror = true;
      setRotation(streg4, 0F, 0F, 0F);
      streg5 = new ModelRenderer(this, 0, 0);
      streg5.addBox(0F, 0F, 0F, 1, 16, 1);
      streg5.setRotationPoint(5F, 8F, 3F);
      streg5.setTextureSize(64, 32);
      streg5.mirror = true;
      setRotation(streg5, 0F, 0F, 0F);
      streg6 = new ModelRenderer(this, 0, 0);
      streg6.addBox(0F, 0F, 0F, 1, 16, 1);
      streg6.setRotationPoint(-5F, 8F, 4F);
      streg6.setTextureSize(64, 32);
      streg6.mirror = true;
      setRotation(streg6, 0F, 0F, 0F);
      streg7 = new ModelRenderer(this, 0, 0);
      streg7.addBox(0F, 0F, 0F, 1, 16, 1);
      streg7.setRotationPoint(3F, 8F, 5F);
      streg7.setTextureSize(64, 32);
      streg7.mirror = true;
      setRotation(streg7, 0F, 0F, 0F);
      streg8 = new ModelRenderer(this, 0, 0);
      streg8.addBox(0F, 0F, 0F, 1, 16, 1);
      streg8.setRotationPoint(-4F, 8F, 5F);
      streg8.setTextureSize(64, 32);
      streg8.mirror = true;
      setRotation(streg8, 0F, 0F, 0F);
      Shape9 = new ModelRenderer(this, 0, 0);
      Shape9.addBox(0F, 0F, 0F, 1, 16, 1);
      Shape9.setRotationPoint(4F, 8F, 4F);
      Shape9.setTextureSize(64, 32);
      Shape9.mirror = true;
      setRotation(Shape9, 0F, 0F, 0F);
      streg10 = new ModelRenderer(this, 0, 0);
      streg10.addBox(0F, 0F, 0F, 1, 16, 1);
      streg10.setRotationPoint(-5F, 8F, -5F);
      streg10.setTextureSize(64, 32);
      streg10.mirror = true;
      setRotation(streg10, 0F, 0F, 0F);
      streg11 = new ModelRenderer(this, 0, 0);
      streg11.addBox(0F, 0F, 0F, 1, 16, 1);
      streg11.setRotationPoint(3F, 8F, -6F);
      streg11.setTextureSize(64, 32);
      streg11.mirror = true;
      setRotation(streg11, 0F, 0F, 0F);
      streg12 = new ModelRenderer(this, 0, 0);
      streg12.addBox(0F, 0F, 0F, 1, 16, 1);
      streg12.setRotationPoint(-4F, 8F, -6F);
      streg12.setTextureSize(64, 32);
      streg12.mirror = true;
      setRotation(streg12, 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);
    fladeF.render(f5);
    fladeR.render(f5);
    fladeL.render(f5);
    fladeB.render(f5);
    streg1.render(f5);
    streg2.render(f5);
    streg3.render(f5);
    streg4.render(f5);
    streg5.render(f5);
    streg6.render(f5);
    streg7.render(f5);
    streg8.render(f5);
    Shape9.render(f5);
    streg10.render(f5);
    streg11.render(f5);
    streg12.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)
  {
    //super.setRotationAngles(f, f1, f2, f3, f4, f5);
  }

}

 

 

Render

 

public class RenderChimney extends Render {

private ModelChimney model;
private static final ResourceLocation texture = new ResourceLocation(FactoryCraft.MODID, ":Chimney.png");

public RenderChimney() {
	model = new ModelChimney();
	shadowSize = 0.5F;
}

@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTickTime) {
	GL11.glPushMatrix();

	GL11.glTranslatef((float) x, (float) y, (float) z);
	GL11.glScalef(-1F, -1F, -1F);

	bindEntityTexture(entity);

	model.render(entity, 0F, 0F, 0F, 0F, 0F, 0.0625F);

	GL11.glPopMatrix();
}

@Override
protected ResourceLocation getEntityTexture(Entity var1) {
	return texture;
}

}

 

Author of the unreleased mod Factory Craft

I'm usually known as MnomisC

IGN MnomisC

Link to comment
Share on other sites

Hi

 

So I'm guessing that your white box is the right shape for the chimney, it just doesn't have any bricks, i.e. the texture is not showing.

 

I'm not really familiar with techne models, but I imagine that either texturing is turned off, you haven't bound the texture properly, or the path to the texture is wrong.  Hopefully someone else on this forum can be more specific...

 

-TGG

 

 

Link to comment
Share on other sites

Hi

 

So I'm guessing that your white box is the right shape for the chimney, it just doesn't have any bricks, i.e. the texture is not showing.

 

I'm not really familiar with techne models, but I imagine that either texturing is turned off, you haven't bound the texture properly, or the path to the texture is wrong.  Hopefully someone else on this forum can be more specific...

 

-TGG

 

I don't think that's the model, because he has a couple of shapes in his model class.

 

I had the same problem earlier and I left it alone, and after I touched some of my gui code my entity completely stopped rendering.

 

Sorry. :(

Kain

Link to comment
Share on other sites

hey I am one of the two modder's in this mod i am not experienced with modding and java i am stil just learning but i can give you information

 

Have you applied in your proxy - I don't think so :[

proxy.initRenderes()

 

ClientProxy.java

 

package me.FactoryCraft.FactoryCraft;

import me.FactoryCraft.FactoryCraft.Entity.EntityChimney;
import me.FactoryCraft.FactoryCraft.Renderer.RenderChimney;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxy extends CommonProxy {
@Override
public void initRenderes() {
	RenderingRegistry.registerEntityRenderingHandler(EntityChimney.class, new RenderChimney());
	System.out.println("Test");
}
}

 

CommonProxy.java

 

package me.FactoryCraft.FactoryCraft;

public class CommonProxy {
public void initRenderes() {

}
}

 

Hi

 

So I'm guessing that your white box is the right shape for the chimney, it just doesn't have any bricks, i.e. the texture is not showing.

 

I'm not really familiar with techne models, but I imagine that either texturing is turned off, you haven't bound the texture properly, or the path to the texture is wrong.  Hopefully someone else on this forum can be more specific...

 

-TGG

 

 

this is how it should look:

without texture

 

 

Abe1oMV.png

 

 

with texture

 

 

0WqFSqW.png

 

 

Link to comment
Share on other sites

hey I am one of the two modder's in this mod i am not experienced with modding and java i am stil just learning but i can give you information

 

Have you applied in your proxy - I don't think so :[

proxy.initRenderes()

 

ClientProxy.java

 

package me.FactoryCraft.FactoryCraft;

import me.FactoryCraft.FactoryCraft.Entity.EntityChimney;
import me.FactoryCraft.FactoryCraft.Renderer.RenderChimney;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxy extends CommonProxy {
@Override
public void initRenderes() {
	RenderingRegistry.registerEntityRenderingHandler(EntityChimney.class, new RenderChimney());
	System.out.println("Test");
}
}

 

CommonProxy.java

 

package me.FactoryCraft.FactoryCraft;

public class CommonProxy {
public void initRenderes() {

}
}

 

 

Hi

 

I think coolbody4531 is right - you have defined initRenderes(), but you never seem to call it?

 

Something like

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	GameRegistry.registerBlock(woodMachineFrame, "WoodMachineFrame");
    	
    	Items.init();
    	Entities.init();
    }
   @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    	proxy.initRenderes();
    }

 

Some further background info here if you're interested

http://greyminecraftcoder.blogspot.com/2013/11/how-forge-starts-up-your-code.html

 

-TGG

Link to comment
Share on other sites

Hi

 

I think coolbody4531 is right - you have defined initRenderes(), but you never seem to call it?

 

Something like

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	GameRegistry.registerBlock(woodMachineFrame, "WoodMachineFrame");
    	
    	Items.init();
    	Entities.init();
    }
   @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    	proxy.initRenderes();
    }

 

Some further background info here if you're interested

http://greyminecraftcoder.blogspot.com/2013/11/how-forge-starts-up-your-code.html

 

-TGG

Thank you it work's now we just have to make the texture work :P and have a hitbox..

8EoiOh7.png

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.