Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Derp, me being blind. You need your modId prefixed before your texture name in the texture name:

*modID*:*block name*

 

Hmm, I'm having the exact same problem with the break particles.  Here are my classes:

 

BlockUnknownEgg:

package com.caske2000.carnivores.blocks;

import com.caske2000.carnivores.Carnivores;
import com.caske2000.carnivores.tileentities.TileEntityUnknownEgg;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockUnknownEgg extends BlockContainer {

protected BlockUnknownEgg(Material material) {
	super(material);
	this.setHardness(2.0F);
	this.setResistance(5.0F);
	this.setCreativeTab(Carnivores.carnivoresTab);
	this.setBlockBounds(0F, 0F, 0F, 1.0F, 1.125F, 1.0F);
}

public int getRenderType()
{
	return -1;

}

public boolean isOpaqueCube(){
	return false;
}

public boolean renderAsNormalBlock()
{
	return false;
}

@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {

	return new TileEntityUnknownEgg();
}

}

 

RenderUnknownEgg:

 

package com.caske2000.carnivores.render;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import com.caske2000.carnivores.model.ModelUnknownEgg;
import com.caske2000.carnivores.reference.Reference;

public class RenderUnknownEgg extends TileEntitySpecialRenderer{

private static final ResourceLocation texture = new ResourceLocation(Reference.MODID + ":" + "textures/blocks/unknownEgg.png");

private ModelUnknownEgg model;

public RenderUnknownEgg() {
	this.model = new ModelUnknownEgg();
}

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
	GL11.glPushMatrix();
	GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
	GL11.glRotatef(180, 0F, 0F, 1F);
	this.bindTexture(texture);

	GL11.glPushMatrix();
	this.model.renderModel(0.0625F);
	GL11.glPopMatrix();

	GL11.glPopMatrix();

}

}

  • Author

Yes.  Using setBlockTextureName.  Btw, it seems to be giving an error saying that it is missing a mapping.  Why is this?

Did you set it to the same texture as the one for the model? If so, what are its dimensions?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

Did you set it to the same texture as the one for the model? If so, what are its dimensions?

 

Actually, I erred in that respect.  The block texture was for a custom modeled block, modeled with Techne and the texture was set through the ResourceLocation field.  The dimensions of the texture are 128x128.  As it is a Techne model, it required such dimensions.

Post the class where you register your block.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Make 2 textures, one for the techne model, and a 16x16 normal block texture that will show up as the particles. Sort of like how chests display oak wood particles when they are broken.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

Do I put the 16x16 texture's name in the setBlockTextureName thing?  I did that, and it gave me an error

java.io.FileNotFoundException: minecraft:textures/blocks/unknownEggParticles.png

 

 

 

  • Author

Ok, that's all done and over with.  Now a new problem.  I set up the block to render in hand, and it renders completely invisible.  I made sure to register the TileEntity as well. 

 

ItemRenderUnknownEggOpen.java:

package com.caske2000.carnivores.render;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderUnknownEggOpen implements IItemRenderer {

TileEntitySpecialRenderer render;
private TileEntity entity;

public ItemRenderUnknownEggOpen(TileEntitySpecialRenderer render, TileEntity entity){
	this.entity = entity;
	this.render = render;
}


@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	// TODO Auto-generated method stub
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	// TODO Auto-generated method stub
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	if(type == IItemRenderer.ItemRenderType.ENTITY){
		GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
		this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F);
	}

}

}

  • Author

I cannot find a tutorial on the forge forums.  Anywhere else I can look?  I've even googled it, and it shows stuff that is not related to my problem.

  • Author

I've got exactly the same type of code, of course referring to my block.

 

Edit:  Redid the last method similar to EternalDoom's class(with my fields of course), and it renders correctly in hand.  Thank you Eternal.

get rid of if(type == IItemRenderer.ItemRenderType.ENTITY)

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

Ok, I'm going to start a new topic on adding custom sounds.  I'm trying to create a special Sounds file and add custom .ogg files for new gun items.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.