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

The collision works but if you stand on it and place the same block connecting to it the collision is gone for a second letting the player fall through

 

kPH4XhX.png

 

rcrbp5E.png

 

heres my code

package com.linumhost.Blocks;

import java.util.Random;

import org.lwjgl.opengl.GL11;

import com.linumhost.CreativeTab.ServerCreativeTab;
import com.linumhost.Items.Items;
import com.linumhost.Items.Wrench;
import com.linumhost.Renderer.BasicRenderer;
import com.linumhost.TileEntity.TileEntityConduitPipe;
import com.linumhost.TileEntity.TileEntityServerCaseBlock;
import com.linumhost.TileEntity.Renderer.TileEntityConduitPipeRenderer;
import com.linumhost.lib.RefStrings;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
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.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;

public class ConduitPipe extends BlockContainer{

public ConduitPipe(Material material){
	super(material);
	setCreativeTab(ServerCreativeTab.tabBlocks);

	float pixel = 1F/16F;
	this.setBlockBounds(11*pixel/2, 11*pixel/2, 11*pixel/2, 1-11*pixel/2, 1-11*pixel/2, 1-11*pixel/2);
}



    private static RenderItem renderItem = new RenderItem();

    public boolean handleRenderType(ItemStack itemStack, ItemRenderType type) {
            return type == ItemRenderType.INVENTORY;
    }

    public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
            return false;
    }

    
    public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) {
            FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
            
            // ====================== Render item texture ======================
            IIcon icon = itemStack.getIconIndex();
            renderItem.renderIcon(0, 0, icon, 16, 16);
            
            // ====================== Render OpenGL square shape ======================
           
            BasicRenderer.drawInventoryBlock();
            
            // ====================== Render text ======================
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            String text = Integer.toString(itemStack.getItemDamage());
            fontRenderer.drawStringWithShadow(text, 1, 1, 0xFFFFFF);
    }



public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z){
	TileEntityConduitPipe conduit = (TileEntityConduitPipe)world.getTileEntity(x, y, z);

	float pixel = 1F / 16F;

	if(conduit != null){

		float minX = 11*pixel/2-(conduit.connections[5]!=null?(11*pixel/2):0);
		float minY = 11*pixel/2-(conduit.connections[1]!=null?(11*pixel/2):0);
		float minZ = 11*pixel/2-(conduit.connections[2]!=null?(11*pixel/2):0);

		float maxX = 1-11*pixel/2+(conduit.connections[3]!=null?(11*pixel/2):0);
		float maxY = 1-11*pixel/2+(conduit.connections[0]!=null?(11*pixel/2):0);
		float maxZ = 1-11*pixel/2+(conduit.connections[4]!=null?(11*pixel/2):0);

		this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);

	}
	return AxisAlignedBB.getBoundingBox(x+this.minX, y+this.minY, z+this.minZ, x+this.maxX, y+this.maxY, z+this.maxZ);

}

float pixel = 1F / 16F;

public int getRenderType(){
	return -1;
}

public Block blockDropped(int par1, int y, int par3)
    {
        return com.linumhost.Blocks.Blocks.conduit;
    }

public boolean isOpaqueCube(){
	return false;
}

public boolean renderAsNormalBlock(){
	return false;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
	return new TileEntityConduitPipe();
}


}

Follow this tutorial,

it should help you on pipes.

 

Also from what I see you need to implement the getCollisionBoundingBoxFromPool() to set your custom collisions.

 

Also add @Override on top of Override methods :)

 

getCollisionBoundingBoxFromPool() and getCollisionBoundingBoxFromPool() are both overridden methods.

I require Java, both the coffee and the code :)

Follow this tutorial,

 

Don't let sieben read! Quick, hide the evidence!

I try my best, so apologies if I said something obviously stupid!

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.