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

Ive gotten my Custom Model in and working just fine right now, but any adjacent blocks next to it wont render the adjacent side, and as such i can see through the world around my block.  I cant seem to find any answers for what needs to be set or done to fix this.  Ive looked through multiple threads, and things like IronChests to see if they do anything im not or have something set different, but i cant seem to find anything.

 

 

im going to go out on a limb and assume this is something thats handled with the block, not the TileEntity, but i could be horribly wrong.  Here is both just in case.

 

 

Block class

package rivendark.mods.quantumassembly.machines;

import java.util.Random;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import rivendark.mods.quantumassembly.QuantumAssembly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockQuantumStorage extends BlockContainer {

public BlockQuantumStorage(int ID, int RID, Class class1) {
	super(ID, RID, Material.iron);
	this.setTextureFile(QuantumAssembly.blockTextureFile);
	this.setBlockName("Rivendark_BlockQuantumStorage");
	this.setHardness(5.0F);
	this.setResistance(150.0F);
	this.setStepSound(super.soundMetalFootstep);
	this.setCreativeTab(QuantumAssembly.tabMachine);
	this.setRequiresSelfNotify();
	this.setLightOpacity(1);
	this.isOpaqueCube();
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z,
		EntityPlayer player, int idk, float what, float these, float are){
	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
	if(tileEntity == null || player.isSneaking()){
		return false;
	}
	//player.openGui(QuantumAssembly.instance, 0, world, x, y, z);
	return true;
}

@Override
 public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
       // dropItems(world, x, y, z);
        super.breakBlock(world, x, y, z, par5, par6);
}

private void dropItems(World world, int x, int y, int z) {
	Random rand = new Random();
	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
	if(!(tileEntity instanceof IInventory)){
		return;
	}
	IInventory inv = (IInventory) tileEntity;

	for(int i = 0; i < inv.getSizeInventory(); i++){
		ItemStack item = inv.getStackInSlot(i);
		if(item != null && item.stackSize > 0){
			float rx = rand.nextFloat() * 0.8F + 0.1F;
			float ry = rand.nextFloat() * 0.8F + 0.1F;
			float rz = rand.nextFloat() * 0.8F + 0.1F;

			EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz,
					new ItemStack(item.itemID, item.stackSize, item.getItemDamage()));
			if(item.hasTagCompound()){
				entityItem.func_92014_d().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
			}

			float factor = 0.05F;
			entityItem.motionX = rand.nextGaussian() * factor;
			entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
			entityItem.motionZ = rand.nextGaussian() * factor;
			world.spawnEntityInWorld(entityItem);
			item.stackSize = 0;
		}
	}
}

@SideOnly(Side.CLIENT)
public int getBlockTextureFromSide(int i){
	return QuantumAssembly.QuantumStorageBlock_TID;
}

@Override
    public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
    {
	int var6 = world.getBlockId(i, j, k - 1);
    int var7 = world.getBlockId(i, j, k + 1);
    int var8 = world.getBlockId(i - 1, j, k);
    int var9 = world.getBlockId(i + 1, j, k);
        byte chestFacing = 0;
        
        int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
        if (facing == 0)
        {
            chestFacing = 2;
        }
        if (facing == 1)
        {
            chestFacing = 5;
        }
        if (facing == 2)
        {
            chestFacing = 3;
        }
        if (facing == 3)
        {
            chestFacing = 4;
        }
        TileEntity te = world.getBlockTileEntity(i, j, k);
        if (te != null && te instanceof TileQuantumStorage)
        {
            ((TileQuantumStorage) te).setFacing(chestFacing);
            world.markBlockForUpdate(i, j, k);
        }
    }

@Override
public TileEntity createNewTileEntity(World var1) {
	return new TileQuantumStorage();
}

public TileEntity getBlockEntity(){
	return new TileQuantumStorage();
}

@Override
public int getRenderType(){
	return QuantumAssembly.QuantumAssembly_RID;
}


public boolean isQpaqueCube(){
	return false;
}

@Override
public boolean renderAsNormalBlock(){
	return false;
}

public boolean isNormalCube(boolean par1){
	return false;
}
}

 

 

TileEntity class

package rivendark.mods.quantumassembly.machines;

import net.minecraft.tileentity.TileEntity;

public class TileQuantumStorage extends TileEntity {

private byte facing;

public TileQuantumStorage(){

}

public void setFacing(byte chestFacing)
    {
        this.facing = chestFacing;
    }

public byte getFacing(){
	return facing;
}
}	

  • Author

Finally got some time off to add a screenshot to show what i mean, this is looking through the side of my custom tile entity, which isnt solid on all the sides.  I know this is possible to do, as i can think of quite a few mods with custom tile entities which dont cover up all of the blocks they touch, but still render the blocks behind and beside them.

 

viewtotheworld.png

 

Any help or pointers would be much appreciated. ^_^

  • Author

For some reason, copying and pasting a new isOpaqueCube is now getting it to render properly.... no clue why, was spelled right and all. *shrug*

My guess is that you had started by copying the code for a block whose isOpaqueCube() method returned true. That should be done only for blocks that occupy a whole cube -- in that case, the renderer assumes that any adjacent block face touching your block can't be seen.

 

Any block that doesn't fill a whole cube needs to have isOpaqueCube() returning false.

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.