Jump to content

Recommended Posts

Posted

Okay, so I want to make it so that when you place a block and then activate it, it places some dummy blocks around it in 1 3x3 square having the original block the center, and also having a model render over it so that it has a texture. Any help on this?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

Not sure why you locked your old post to be honest, you pretty much had it :P

 

As mentioned before, you'll need this tutorial: http://minalien.com/tutorial-multi-block-structures-in-minecraft/

 

Then, make one of the blocks (the one you place) a rendered Tile Entity. Without the above tutorial, you'd have the 3x3 block visible, but can walk through it.

 

Make a block, call it "Gag Block" or something, and make it so it's solid, but can't be seen. Those are the other blocks that will be placed when you place the model block. Does that make sense?

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted
  On 7/6/2013 at 11:16 PM, Flenix said:

Not sure why you locked your old post to be honest, you pretty much had it :P

 

As mentioned before, you'll need this tutorial: http://minalien.com/tutorial-multi-block-structures-in-minecraft/

 

Then, make one of the blocks (the one you place) a rendered Tile Entity. Without the above tutorial, you'd have the 3x3 block visible, but can walk through it.

 

Make a block, call it "Gag Block" or something, and make it so it's solid, but can't be seen. Those are the other blocks that will be placed when you place the model block. Does that make sense?

 

Yeah sorta, So I need to make a base block, that has a render tilenetity that renders the model, and the gag blocks?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

I'm not sure about rending a model over the whole thing, but to have it add blocks on activation, you want something like this in your block's class:

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
	par1World.setBlock(par2, par3+1, par4, Registration.celestialBlock.blockID, 0, 2);
        return true;
}

This creates a single block directly above the activated block.

Posted
  On 7/6/2013 at 11:28 PM, SeaBass said:

I'm not sure about rending a model over the whole thing, but to have it add blocks on activation, you want something like this in your block's class:

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
	par1World.setBlock(par2, par3+1, par4, Registration.celestialBlock.blockID, 0, 2);
        return true;
}

This creates a single block directly above the activated block.

If a model is bigger than 1x1x1 it will just render outside the block, without any sort of collision to it.

So, he'd use his existing model with the code you put there. That code has to place invisible blocks, so the model will still show and have collision too. Only issue he'll have then is the mode will de-render when the original block is out of the screen - I have no idea how to fix that.

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted

hmmm, thanks for the tip on placing the blocks, now, for the model de-rendering, Ill look it up, think i saw it somewhere before.

I might just make some more blocks, about 6, and have them have the textures of the model on them, the model isn't to special, just a box the size of the 3x3 square, with a texture. It would be take up some ids, but it would still work.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

If your model is based of the centre block, adding this to your blocks class should do the trick.

 

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
    return AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
}

Posted
  On 7/7/2013 at 1:15 AM, ShetiPhian said:

If your model is based of the centre block, adding this to your blocks class should do the trick.

 

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
    return AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
}

 

Thanks, now how about rendering the model?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted
  Quote

thanks for helping me expand my collison box, and I was wondering if you know how to load a tile entity, when the block is right clicked?

Replying here instead just in case someone else runs across this needing the same answers.

 

 

To your block class add (your block will need to extend BlockContainer or implement ITileEntityProvider before its available)

@Override
public TileEntity createNewTileEntity(World world)
{
    return new TileEntityLargeBlock(); //Rename to your tile entity 
}

 

 

This will create the tile entity as soon as the block is in the world, but you didn't want it to render until your right clicked so in your tile entity add

public boolean shouldRender = false;

 

Back to your block class

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int face, float posX, float posY, float posZ)
{
  TileEntity tile = world.getBlockTileEntity(x, y, z);  // Once again rename to your tile entity.
  if (!(tile instanceof TileEntityLargeBlock)) {
    return false; // If for some reason your block does not have the correct tileentity you don't want it to create the false blocks, as nothing will hide them.
  }

  // run any pre-generation code you have here.  eg. making sure there is space for the false blocks.

  ((TileEntityLargeBlock)tile).shouldRender = true;

  // create your false blocks here as they are now hidden
  return true;
}

 

 

The last thing to do is in your renderer, simply check if shouldRender is true before rendering, if not leave without rendering anything.

 

 

 

You can change the other code I gave you too,

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
    TileEntity tile = world.getBlockTileEntity(x, y, z);  // Once again rename to your tile entity.
    if (tile instanceof TileEntityLargeBlock  && ((TileEntityLargeBlock)tile).shouldRender) {
        return AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
    }
    return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}

 

Posted
  On 7/7/2013 at 6:29 AM, ShetiPhian said:

  Quote

thanks for helping me expand my collison box, and I was wondering if you know how to load a tile entity, when the block is right clicked?

Replying here instead just in case someone else runs across this needing the same answers.

 

 

To your block class add (your block will need to extend BlockContainer or implement ITileEntityProvider before its available)

@Override
public TileEntity createNewTileEntity(World world)
{
    return new TileEntityLargeBlock(); //Rename to your tile entity 
}

 

 

This will create the tile entity as soon as the block is in the world, but you didn't want it to render until your right clicked so in your tile entity add

public boolean shouldRender = false;

 

Back to your block class

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int face, float posX, float posY, float posZ)
{
  TileEntity tile = world.getBlockTileEntity(x, y, z);  // Once again rename to your tile entity.
  if (!(tile instanceof TileEntityLargeBlock)) {
    return false; // If for some reason your block does not have the correct tileentity you don't want it to create the false blocks, as nothing will hide them.
  }

  // run any pre-generation code you have here.  eg. making sure there is space for the false blocks.

  ((TileEntityLargeBlock)tile).shouldRender = true;

  // create your false blocks here as they are now hidden
  return true;
}

 

 

The last thing to do is in your renderer, simply check if shouldRender is true before rendering, if not leave without rendering anything.

 

 

 

You can change the other code I gave you too,

@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
    TileEntity tile = world.getBlockTileEntity(x, y, z);  // Once again rename to your tile entity.
    if (tile instanceof TileEntityLargeBlock  && ((TileEntityLargeBlock)tile).shouldRender) {
        return AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
    }
    return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}

 

oh my god thank you thank you thank you!

 

I'll edit this post if telling you if it worked!

 

EDIT: Well now when i right click it does nothing.

Heres my code:

BlockTowerFloorBase:

package codelyoko;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.ModLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockTowerFloorBase extends Block
{

public BlockTowerFloorBase(int id, Material par1Material)
{

	super(id, par1Material);
	this.setCreativeTab(Lyoko.tabLyoko);

}

@Override
public TileEntity createTileEntity(World world, int metadata)
{
	return new TileEntityTowerFloor();
}

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
	TileEntity tile = par1World.getBlockTileEntity(par2, par3, par4);  // Once again rename to your tile entity.
	if (!(tile instanceof TileEntityTowerFloor)) {
		return false; // If for some reason your block does not have the correct tileentity you don't want it to create the false blocks, as nothing will hide them.
	}
	par1World.setBlock(par2+1, par3, par4, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2+1, par3, par4+1, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2+1, par3, par4-1, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2, par3, par4+1, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2, par3, par4-1, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2-1, par3, par4+1, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2-1, par3, par4, Lyoko.TowerFloorGagBlock.blockID, 0, 2);
	par1World.setBlock(par2-1, par3, par4-1, Lyoko.TowerFloorGagBlock.blockID, 0, 2); 
	ModLoader.openGUI(par5EntityPlayer, new GUITowerFloorCreated());
	return true;
}




@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
	return AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
}

//This will tell minecraft not to render any side of our cube.
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
	return false;
}

//And this tell it that you can see through this block, and neighbor blocks should be rendered.
public boolean isOpaqueCube()
{
	return false;
}

}

 

EDIT: Opps, forgot to implement ITileEntityProvider. Hehe :)

Now it just loads when i place the block, not even waiting for me to right click it!

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

you missed a line in your onBlockActivated

((TileEntityTowerFloor)tile).shouldRender = true;

 

 

As for rendering right away, did you set shouldRender in your tile entity to false?

What about checking shouldRender in your rendering code?

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
    • Please read the FAQ (link is orange banner at top of page), and post logs as described there, to an external site such as https://mclo.gs  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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