Posted February 1, 201510 yr 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 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(); } }
February 2, 201510 yr 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
February 8, 201510 yr 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.