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.

Erfurt

Members
  • Joined

  • Last visited

Everything posted by Erfurt

  1. Yeah, I thought so too. But I managed to figure it out
  2. After doing some tinkering, I got the torch thing to work, after adding this piece of code to my custom wall class public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) { IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); if (this instanceof BlockWall2 && side == EnumFacing.UP) { return true; } return false; } public boolean canPlaceTorchOnTop() { return true; }
  3. Yeah, I just suck at debugging, oh well only one way to get better
  4. What do you mean it "didn't work"? What I mean is that I still can't place a torch on my custom wall.
  5. 1) I have tried that, sadly it didn't work. 2) I believe that they appear twice because I extend BlockWall. BlockWall is working in subBlocks, and have two variants, and that is why. At least that's my theory. I just don't know how to remove the subBlock from the code. 3) That's a bummer, I was hoping that I could add some piece of code somewhere, so they could connect. Oh well guess I can't have everything 4) I have had no real problem extending BlockWall in 1.8 and using Forge's Blockstates, makes it pretty easy to make the blockstates for custom walls. Link for Forge's Blockstates. http://mcforge.readthedocs.org/en/latest/blockstates/forgeBlockstates/
  6. Hey guys, So I have an odd problem here. I'm making an aesthetic mod, that adds hedges to the game. At the moment I have made all the hedges from the different types of vanilla leaves, so oak, birch, and so on. They all have the correct color when the hedges are placed, and everything else is working perfectly. Only one thing that I don't understand is why the blocks is grey (without color), when I have the block in the inventory. I have looked at the vanilla leave code, and I haven't been able to locate what is wrong. It should be mentioned that when I make an item for the block instead, and add this code it have the color on it, I have tried to use that code in the block class for my hedges, but that didn't work. I was hoping that someone could take a look at my code, and see if I did something wrong, or is missing something for it to work. Code from the item @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int renderPass) { return this.block.getRenderColor(this.block.getStateFromMeta(stack.getMetadata())); } My block class public class BlockHedge extends Block { public static final PropertyBool NORTH = PropertyBool.create("north"); public static final PropertyBool EAST = PropertyBool.create("east"); public static final PropertyBool SOUTH = PropertyBool.create("south"); public static final PropertyBool WEST = PropertyBool.create("west"); public BlockHedge(Material material) { super(Material.leaves); setHardness(1.0F); setStepSound(Block.soundTypeGrass); setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); } public boolean isOpaqueCube() { return false; } public boolean isNormalCube() { return false; } public boolean isFullCube() { return false; } @SideOnly(Side.CLIENT) public int getBlockColor() { return ColorizerFoliage.getFoliageColor(0.5D, 1.0D); } @SideOnly(Side.CLIENT) public int getRenderColor(IBlockState state) { if (state.getBlock() != this) { return super.getRenderColor(state); } return this == HaWMBlocks.hedge_birch ? ColorizerFoliage.getFoliageColorBirch() : this == HaWMBlocks.hedge_spruce ? ColorizerFoliage.getFoliageColorPine() : ColorizerFoliage.getFoliageColorBasic(); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { if (this == HaWMBlocks.hedge_spruce) { return ColorizerFoliage.getFoliageColorPine(); } if (this == HaWMBlocks.hedge_birch) { return ColorizerFoliage.getFoliageColorBirch(); } return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT_MIPPED; } @SideOnly(Side.CLIENT) public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos) { float f = 0.1875F; float f1 = 0.8125F; float f2 = 0.1875F; float f3 = 0.8125F; if ((blockAccess.getBlockState(pos.east()).getBlock() instanceof BlockHedge | blockAccess.getBlockState(pos.east()).getBlock() instanceof BlockFenceGate | blockAccess.getBlockState(pos.east()).getBlock().isNormalCube())) { f1 = 1.0F; } if ((blockAccess.getBlockState(pos.west()).getBlock() instanceof BlockHedge | blockAccess.getBlockState(pos.west()).getBlock() instanceof BlockFenceGate | blockAccess.getBlockState(pos.west()).getBlock().isNormalCube())) { f = 0.0F; } if ((blockAccess.getBlockState(pos.south()).getBlock() instanceof BlockHedge | blockAccess.getBlockState(pos.south()).getBlock() instanceof BlockFenceGate | blockAccess.getBlockState(pos.south()).getBlock().isNormalCube())) { f3 = 1.0F; } if ((blockAccess.getBlockState(pos.north()).getBlock() instanceof BlockHedge | blockAccess.getBlockState(pos.north()).getBlock() instanceof BlockFenceGate | blockAccess.getBlockState(pos.north()).getBlock().isNormalCube())) { f2 = 0.0F; } setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); } public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { setBlockBounds(0.1875F, 0.0F, 0.1875F, 0.8125F, 1.5F, 0.8125F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); if ((world.getBlockState(pos.east()).getBlock() instanceof BlockHedge | world.getBlockState(pos.east()).getBlock() instanceof BlockFenceGate)) { setBlockBounds(0.8125F, 0.0F, 0.1875F, 1.0F, 1.5F, 0.8125F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); } if ((world.getBlockState(pos.west()).getBlock() instanceof BlockHedge | world.getBlockState(pos.west()).getBlock() instanceof BlockFenceGate)) { setBlockBounds(0.0F, 0.0F, 0.1875F, 0.1875F, 1.5F, 0.8125F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); } if ((world.getBlockState(pos.south()).getBlock() instanceof BlockHedge | world.getBlockState(pos.south()).getBlock() instanceof BlockFenceGate)) { setBlockBounds(0.1875F, 0.0F, 0.8125F, 0.8125F, 1.5F, 1.0F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); } if ((world.getBlockState(pos.north()).getBlock() instanceof BlockHedge | world.getBlockState(pos.north()).getBlock() instanceof BlockFenceGate)) { setBlockBounds(0.1875F, 0.0F, 0.0F, 0.8125F, 1.5F, 0.1875F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); } } public Item getItemDropped(IBlockState state, Random rand, int fortune) { if (this == HaWMBlocks.hedge_birch) { return HaWMItems.item_hedge_birch; } if (this == HaWMBlocks.hedge_spruce) { return HaWMItems.item_hedge_spruce; } if (this == HaWMBlocks.hedge_jungle) { return HaWMItems.item_hedge_jungle; } if (this == HaWMBlocks.hedge_acacia) { return HaWMItems.item_hedge_acacia; } if (this == HaWMBlocks.hedge_dark_oak) { return HaWMItems.item_hedge_dark_oak; } return HaWMItems.item_hedge_oak; } public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) { if (this == HaWMBlocks.hedge_birch) { return new ItemStack(HaWMItems.item_hedge_birch); } if (this == HaWMBlocks.hedge_spruce) { return new ItemStack(HaWMItems.item_hedge_spruce); } if (this == HaWMBlocks.hedge_jungle) { return new ItemStack(HaWMItems.item_hedge_jungle); } if (this == HaWMBlocks.hedge_acacia) { return new ItemStack(HaWMItems.item_hedge_acacia); } if (this == HaWMBlocks.hedge_dark_oak) { return new ItemStack(HaWMItems.item_hedge_dark_oak); } return new ItemStack(HaWMItems.item_hedge_oak); } public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { return state.withProperty(NORTH, Boolean.valueOf(isHedge(world, pos.north()))).withProperty(EAST, Boolean.valueOf(isHedge(world, pos.east()))).withProperty(SOUTH, Boolean.valueOf(isHedge(world, pos.south()))).withProperty(WEST, Boolean.valueOf(isHedge(world, pos.west()))); } public int getMetaFromState(IBlockState state) { return 0; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] { NORTH, EAST, SOUTH, WEST }); } public boolean isHedge(IBlockAccess world, BlockPos pos) { return world.getBlockState(pos).getBlock() instanceof BlockHedge | world.getBlockState(pos).getBlock() instanceof BlockFenceGate | world.getBlockState(pos).getBlock().isNormalCube(); } } I should mention that I want to only have the block and no item, just because I believe that is best practis to do so, and because I think that it can quickly become unmanageable, if there's to much code that's not really needed.
  7. Hey guys, So I have been working on a small mod for the past week or so. Now I have some problems that I can't seem to fix myself. My first problem is, that I can't place torches on my custom walls, I have tried to use canPlaceTorchOnTop(), but that didn't work at all. Here's my custom walls class. public class BlockWall2 extends BlockWall { public BlockWall2(Block block) { super(block); this.setResistance(10.0F); this.setHardness(1.5F); } public int damageDropped(int meta) { return meta; } public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos).getBlock(); return block == Blocks.barrier ? false : (((block != this && !(block instanceof BlockFenceGate) && !(block instanceof BlockWall2) && !(block instanceof BlockWall))) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true); } } My second problem is that for every new custom wall I make there's two blocks in the creativeTab, there should just be one. Minor thing but I want to fix it... My last problem is, that vanilla walls don't want to connect to my custom walls, but my custom walls want to connect to vanilla walls. I want them to connect. I have no idea how to make that happen, so if anyone could give me some advice I would apriciate it.
  8. Everything is working as intended now Thanks a lot! Now I just need to figure out how to make the block connect to vanilla walls, and vice versa. Also some minor bugs I have
  9. I have tried most of the things you suggested, however none seems to work for me for some reason. I haven't tried using a custom state mapper, because I'm not familiar with how or where to use it correctly. Is it in class for itself, or is it somewhere in my block class?
  10. Yeah, I don't fully know why it want 'variant=cobblestone' because I don't have it listed in my code, I can only see it coming from the original BlockWall class. But I'm not sure. Anyway, I will look into the Forge syntax, and se if I can learn something new there. Thanks for your help
  11. Good to know. The only error message I get is this. [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=false,north=false,south=true,up=false,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=false,up=false,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=false,south=true,up=true,variant=cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Model definition for location hawm:wall_stonebrick#east=true,north=true,south=true,up=false,variant=mossy_cobblestone,west=true not found [17:34:42] [Client thread/ERROR] [FML]: Supressed additional 71 model loading errors for domain hawm My problem is that it doesn't have the correct render. And is showing up as black and purple.
  12. Hey guys, So I was wondering if there is an easy/simple way to use the cobblestone wall model for my own custom walls. I would like to use the vanilla model, so that my mod is compatible with resource packs that change the 3D model. At the moment I'm still in the process of figuring out what kinds of stuff my mod needs, and how to go about doing it. So I haven't looked much into it code wise yet. But to my knowledge I will need a lot of .json files per new wall block. Something like 8 .json files, I think. So I would basically just want to know if there is a way to make it easier, so I maybe only need a couple of .json files per block, but I somehow doubt it's possible. I have made this code for the new wall blocks to use, still a lot of stuff I need to add, but this is good enough for now. public class BlockWall2 extends BlockWall { public BlockWall2(Block modelBlock) { super(modelBlock); this.setResistance(10.0F); this.setHardness(1.5F); this.setCreativeTab(CreativeTabs.tabDecorations); } public int damageDropped(int meta) { return meta; } public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { return true; } } I have make a quick and dirty blockstate { "variants": { "east=false,north=false,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_post" }, "east=false,north=true,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_n" }, "east=true,north=false,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true }, "east=false,north=false,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true }, "east=true,north=true,south=false,up=false,west=false": { "model": "hawm:wall_stonebrick_ne" }, "east=true,north=false,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true }, "east=false,north=true,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true }, "east=false,north=true,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_ns" }, "east=true,north=false,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_ns", "y": 90, "uvlock": true }, "east=true,north=true,south=true,up=false,west=false": { "model": "hawm:wall_stonebrick_nse" }, "east=true,north=false,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true }, "east=false,north=true,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true }, "east=true,north=true,south=false,up=false,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true }, "east=true,north=true,south=true,up=false,west=true": { "model": "hawm:wall_stonebrick_nsew" }, "east=false,north=false,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_post" }, "east=false,north=true,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_n" }, "east=true,north=false,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_n", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_n", "y": 180, "uvlock": true }, "east=false,north=false,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_n", "y": 270, "uvlock": true }, "east=true,north=true,south=false,up=true,west=false": { "model": "hawm:wall_stonebrick_ne" }, "east=true,north=false,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_ne", "y": 90, "uvlock": true }, "east=false,north=false,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 180, "uvlock": true }, "east=false,north=true,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_ne", "y": 270, "uvlock": true }, "east=false,north=true,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_ns_above" }, "east=true,north=false,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_ns_above", "y": 90, "uvlock": true }, "east=true,north=true,south=true,up=true,west=false": { "model": "hawm:wall_stonebrick_nse" }, "east=true,north=false,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 90, "uvlock": true }, "east=false,north=true,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 180, "uvlock": true }, "east=true,north=true,south=false,up=true,west=true": { "model": "hawm:wall_stonebrick_nse", "y": 270, "uvlock": true }, "east=true,north=true,south=true,up=true,west=true": { "model": "hawm:wall_stonebrick_nsew" } } } And for the rest of the .json files the code looks somewhat the same as this { "parent": "block/wall_n", "textures": { "wall": "blocks/stonebrick" } } Basically the code is modified vanilla code, but for some reason it doesn't work. If anyone can see why this isn't working I would love to know what I have done wrong.
  13. Well, I'm making a mod that adds some cosmetic hedges blocks, I was originally extending the blockwall class, but I felt like the wall model was out of place, and that's the reason why I decided to make a custom render model. I don't know if that was what you were after?
  14. I can't get it to work, maybe it something in my block class, maybe someone could take a look? And maybe tell me what I should reference in my render class public class BlockHedge extends BlockContainer { @SideOnly(Side.CLIENT) private boolean field_150121_P; protected int field_150127_b; float pixel = 1F/16F; public IIcon[][] texture = new IIcon[2][]; public static final String[][] HedgeTypes = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle", "leaves_acacia", "leaves_big_oak"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque", "leaves_acacia_opaque", "leaves_big_oak_opaque"}}; public static final String[] subBlocksHedges = new String[] {"oak", "spruce", "birch", "jungle", "acacia", "big_oak"}; public BlockHedge(Material mat) { super(mat); this.setResistance(1); this.setHardness(0.2F); this.setCreativeTab(CreativeTabs.tabDecorations); } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public TileEntity createNewTileEntity(World world, int i) { return new TileEntityHedge(); } public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { TileEntityHedge hedge = (TileEntityHedge)world.getTileEntity(x, y, z); if(hedge != null) { float minX = 4*pixel-(hedge.connections[1] != null?(4*pixel):0); float minZ = 4*pixel-(hedge.connections[2] != null?(4*pixel):0); float maxX = 1-4*pixel+(hedge.connections[0] != null?(4*pixel):0); float maxZ = 1-4*pixel+(hedge.connections[3] != null?(4*pixel):0); this.setBlockBounds(minX, 0, minZ, maxX, 1.5F, maxZ); } return AxisAlignedBB.getBoundingBox(x+this.minX, y+this.minY, z+this.minZ, x+this.maxX, y+this.maxY, z+this.maxZ); } public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { TileEntityHedge hedge = (TileEntityHedge)world.getTileEntity(x, y, z); if(hedge != null) { float minX = 4*pixel-(hedge.connections[1] != null?(4*pixel):0); float minZ = 4*pixel-(hedge.connections[2] != null?(4*pixel):0); float maxX = 1-4*pixel+(hedge.connections[0] != null?(4*pixel):0); float maxZ = 1-4*pixel+(hedge.connections[3] != null?(4*pixel):0); this.setBlockBounds(minX, 0, minZ, maxX, 1, maxZ); } return AxisAlignedBB.getBoundingBox(x+this.minX, y+this.minY, z+this.minZ, x+this.maxX, y+this.maxY, z+this.maxZ); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { for (int i = 0; i < HedgeTypes.length; ++i) { this.texture[i] = new IIcon[HedgeTypes[i].length]; for (int j = 0; j < HedgeTypes[i].length; ++j) { this.texture[i][j] = iconRegister.registerIcon(HedgeTypes[i][j]); } } } @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean bool) { this.field_150121_P = bool; this.field_150127_b = bool ? 0 : 1; } public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { return false; } @SideOnly(Side.CLIENT) public void getSubBlocks(Item hedge, CreativeTabs creativeTabs, List list) { for(int i = 0 ; i < subBlocksHedges.length ; i++) { list.add(new ItemStack(hedge, 1, i)); } } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return meta == 1 ? this.texture[this.field_150127_b][1] : (meta == 3 ? this.texture[this.field_150127_b][3] : (meta == 2 ? this.texture[this.field_150127_b][2] : (meta == 5 ? this.texture[this.field_150127_b][5] : (meta == 4 ? this.texture[this.field_150127_b][4] : this.texture[this.field_150127_b][0])))); } public int damageDropped(int meta) { return meta; } @SideOnly(Side.CLIENT) public int getBlockColor() { double d0 = 0.5D; double d1 = 1.0D; return ColorizerFoliage.getFoliageColor(d0, d1); } @SideOnly(Side.CLIENT) public int getRenderColor(int meta) { return meta == 1 ? ColorizerFoliage.getFoliageColorPine() : (meta == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) { int l = 0; int i1 = 0; int j1 = 0; for (int k1 = -1; k1 <= 1; ++k1) { for (int l1 = -1; l1 <= 1; ++l1) { int i2 = blockAccess.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1); l += (i2 & 16711680) >> 16; i1 += (i2 & 65280) >> 8; j1 += i2 & 255; } } int meta = blockAccess.getBlockMetadata(x, y, z); return meta == 1 ? ColorizerFoliage.getFoliageColorPine() : (meta == 2 ? ColorizerFoliage.getFoliageColorBirch() : (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255); } }
  15. That's just a texture I used to check if the model was rendering correctly I'll try to work a little more with it, and see if I can get it to work, even though I'm not sure how to do it. If I can't get it to work, I'll post in here again.
  16. Tesselator is just the way I draw the model. Here's my code, and as I stated in the original post, everything is working fine, I just want to be able to grab the texture from the block instead of having to add it in the model. The reason for this is because my block havesubblocks with different textures. private final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID + ":" + "textures/model/test2.png"); boolean drawInside = true; private float pixel = 1F/16F; private float texturePixel = 1F/16F; @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { //System.out.println("RENDERING BLOCK HEDGE"); GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glDisable(GL11.GL_LIGHTING); this.bindTexture(texture); { TileEntityHedge hedge = (TileEntityHedge) tileentity; if(!hedge.onlyOneOpposite(hedge.connections)) { drawCore(tileentity); for(int i = 0; i < hedge.connections.length; i++) { if(hedge.connections[i] != null) { drawConnector(hedge.connections[i]); } } }else { for(int i = 0; i < hedge.connections.length; i++) { if(hedge.connections[i] != null) { drawStraight(hedge.connections[i]); break; } } } } GL11.glEnable(GL11.GL_LIGHTING); GL11.glTranslatef(-(float)x, -(float)y, -(float)z); GL11.glPopMatrix(); } public void drawStraight (ForgeDirection direction) { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if(direction.equals(ForgeDirection.EAST) || direction.equals(ForgeDirection.WEST)) { //ROTATE }else if(direction.equals(ForgeDirection.NORTH) || direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(90, 0, 1, 0); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 1); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 0); tessellator.addVertexWithUV(0, 1, 1-8*pixel/2, 0, 0); tessellator.addVertexWithUV(0, 0, 1-8*pixel/2, 0, 1); tessellator.addVertexWithUV(0, 0, 8*pixel/2, 1, 1); tessellator.addVertexWithUV(0, 1, 8*pixel/2, 1, 0); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 0); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 0, 1); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 0, 4*texturePixel); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 12*texturePixel); tessellator.addVertexWithUV(0, 1, 8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(0, 1, 1-8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(0, 0, 1-8*pixel/2, 0, 4*texturePixel); tessellator.addVertexWithUV(0, 0, 8*pixel/2, 0, 12*texturePixel); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 4*texturePixel); if(drawInside) { tessellator.addVertexWithUV(0, 0, 1-8*pixel/2, 0, 1); tessellator.addVertexWithUV(0, 1, 1-8*pixel/2, 0, 0); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 0); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 1); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 0, 1); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 0); tessellator.addVertexWithUV(0, 1, 8*pixel/2, 1, 0); tessellator.addVertexWithUV(0, 0, 8*pixel/2, 1, 1); tessellator.addVertexWithUV(0, 1, 1-8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(0, 1, 8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 12*texturePixel); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 0, 4*texturePixel); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(0, 0, 8*pixel/2, 0, 12*texturePixel); tessellator.addVertexWithUV(0, 0, 1-8*pixel/2, 0, 4*texturePixel); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if(direction.equals(ForgeDirection.NORTH) || direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(-90, 0, 1, 0); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } public void drawConnector (ForgeDirection direction) { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if(direction.equals(ForgeDirection.EAST)) { //ROTATE }else if(direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(180, 0, 1, 0); }else if(direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(90, 0, 1, 0); }else if(direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(-90, 0, 1, 0); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 1); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 0); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 0, 1); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 12*texturePixel); if(drawInside) { tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 0); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 1); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 0, 1); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 0, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1, 1, 8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(1, 1, 1-8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(1, 0, 1-8*pixel/2, 1, 12*texturePixel); tessellator.addVertexWithUV(1, 0, 8*pixel/2, 1, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if(direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(-180, 0, 1, 0); }else if(direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(-90, 0, 1, 0); }else if(direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(90, 0, 1, 0); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } public void drawCore (TileEntity tileentity) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 12*texturePixel); if(drawInside) { tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 4*texturePixel, 1); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 0); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 12*texturePixel, 1); tessellator.addVertexWithUV(8*pixel/2, 1, 1-8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 1, 8*pixel/2, 12*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 8*pixel/2, 4*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 1, 1-8*pixel/2, 4*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 12*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 0, 8*pixel/2, 4*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 4*texturePixel); tessellator.addVertexWithUV(1-8*pixel/2, 0, 1-8*pixel/2, 12*texturePixel, 12*texturePixel); } } tessellator.draw(); }
  17. Hey guys, So i have made a model using tessellator, and I have tested it with a test texture, and it works perfectly. However I have a block class that I want to use my model for, but the thing is the block have subblocks, and I have different textures for each subblock. The textures are defined in the block class, and I don't know how to take them from there and use them in the tessellator model. So my question is there an easy way to do it? Preferable a way where I can add the texture for more subblocks in my block class, I don't know if that is possible.
  18. Ok, it's just for fun, and if I want to make mods that are compatible with my own mods I don't now at this point what my API would provide, as I'm kinda making it up as I go
  19. Hey guys, Do any of you know where I can find some guides or tutorials on making an API for my own mod? I have been searching on Google, but havn't been able to find anything other than how to use API's when modding, but nothing on how to make one. Any help would be lovely
  20. Hey guys, So I'm making a cosmetic mod that adds in hedges, and at the moment I'm at the point where I would like to change the model of the middle section of the wall, so that it would be the same width and height as the post has. However I have no idea if I can alter the model, and if so if it will change the model for Cobblestone Wall as well? Is there a way to do this, or do I have to make a new model for my mod? Any help here would be great, I haven't been able to find anything by myself, but that might be because I'm searching for the wrong stuff
  21. Never mind, I found the solution. Just going to type it here, if anyone else needs it. Type "minecraft" instead of using your own mod_name.modid
  22. Hey guys, This is a bit of a newbie question, but I can't seem to use Minecraft's own textures for my hedges, this is very basic stuff, but yet I have no idea how to this, and I'm very embarrassed to ask for your time to help me out I want to use the texture from Oak leaves for my Oak Hedge, and the texture from Spruce leaves for my Spruce Hedge, and so on. Any help would be great, and I'm sorry for not knowing this... So embarrassing
  23. Thanks guys, this will help me out a lot

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.