Jump to content

Advanced Metadata


Busti

Recommended Posts

Hi,

I am trying to make a Mod which uses just one Block ID to store all the different blocks, but since the Metadata is just 4 bits of information it wont be easy to save 30 different Blocks in one ID. I would like to know if this number will automatically increase when I use a Tileentity (or do I need to do something in it to make this happen?)

Also some of the blocks should have a normal Tileentity and some should not.

What can I do to make a Block with more than 16 Subblocks and with advanced functions on some of them?

And please don't just write "Make a Tileentity", because this wont help.

 

Busti

 

//Don't recognize my english!

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

Hi,

I am trying to make a Mod which uses just one Block ID to store all the different blocks, but since the Metadata is just 4 bits of information it wont be easy to save 30 different Blocks in one ID. I would like to know if this number will automatically increase when I use a Tileentity (or do I need to do something in it to make this happen?)

Also some of the blocks should have a normal Tileentity and some should not.

What can I do to make a Block with more than 16 Subblocks and with advanced functions on some of them?

And please don't just write "Make a Tileentity", because this wont help.

 

Busti

 

//Don't recognize my english!

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

why would you need them all to have the same ID?

 

 

If you want 30 sub blocks of the same block and don't want to use an TileEntity I guess you have to invent your own system for handling them then, since Minecraft only stores metadata + blockID of a given block at a location inn the world and nothing more, except a TileEntity if it has one.

 

Normaly I would have said create a TileEntity and make it do everything for you and behave differently depending on the subtype but since you don't want that answer I guess my only answer can be this:

 

Invent your own system for handling it.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

why would you need them all to have the same ID?

 

 

If you want 30 sub blocks of the same block and don't want to use an TileEntity I guess you have to invent your own system for handling them then, since Minecraft only stores metadata + blockID of a given block at a location inn the world and nothing more, except a TileEntity if it has one.

 

Normaly I would have said create a TileEntity and make it do everything for you and behave differently depending on the subtype but since you don't want that answer I guess my only answer can be this:

 

Invent your own system for handling it.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I would like to use a TileEntity but some of the blocks even have an inventory or a special function and i don't know how to handle that inside the TileEntity.

 

Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I would like to use a TileEntity but some of the blocks even have an inventory or a special function and i don't know how to handle that inside the TileEntity.

 

Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I would like to use a TileEntity but some of the blocks even have an inventory or a special function and i don't know how to handle that inside the TileEntity.

Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....

 

I know how to make an inventory...

But i don't know how to handle that in combination with the different Metadata

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

I would like to use a TileEntity but some of the blocks even have an inventory or a special function and i don't know how to handle that inside the TileEntity.

Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....

 

I know how to make an inventory...

But i don't know how to handle that in combination with the different Metadata

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

I'm in a similar boat so just replying to keep this thread alive.

 

I don't mind using tile entites, but I heard they are more RAM intensive. What uses more RAM between 16 individual blocks, and one tile entity with 16 blocks?

 

If it's not that big a deal, anyone got a good link for tile entity tutorial? Looks like both myself and the OP could do with a read through of it. The one on the wiki is incomplete.

width=463 height=200

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

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

I'm in a similar boat so just replying to keep this thread alive.

 

I don't mind using tile entites, but I heard they are more RAM intensive. What uses more RAM between 16 individual blocks, and one tile entity with 16 blocks?

 

If it's not that big a deal, anyone got a good link for tile entity tutorial? Looks like both myself and the OP could do with a read through of it. The one on the wiki is incomplete.

width=463 height=200

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

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

TileEntity's aren't as big and nasty as they may sound like, they are just objects where the code get's executed regulary (During it's Update() call) and on interaction (When it's block is clicked, destroyed, added etc.). In addition to that they can store much more data than metadata.

 

I know how to make an inventory...

But i don't know how to handle that in combination with the different Metadata

 

Well so far I'm not understanding what you are trying to do really.

You can if you want to get the metadata passed onto the TileEntity, but you can't have more than 16 blocks on the same ID using that system.

(Yes there's a way of having more *looks at redpower* but I'm sure it's a bit more advance than TileEntity's)

So why do you need 30 blocks inn 1 ID? We got a few thousand block ID's to work with now days so using two or three ain't that bad :)

 

Having the same TileEntity do different things upon metadata is quite simple to implement, depending on what you want them to do?

 

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

TileEntity's aren't as big and nasty as they may sound like, they are just objects where the code get's executed regulary (During it's Update() call) and on interaction (When it's block is clicked, destroyed, added etc.). In addition to that they can store much more data than metadata.

 

I know how to make an inventory...

But i don't know how to handle that in combination with the different Metadata

 

Well so far I'm not understanding what you are trying to do really.

You can if you want to get the metadata passed onto the TileEntity, but you can't have more than 16 blocks on the same ID using that system.

(Yes there's a way of having more *looks at redpower* but I'm sure it's a bit more advance than TileEntity's)

So why do you need 30 blocks inn 1 ID? We got a few thousand block ID's to work with now days so using two or three ain't that bad :)

 

Having the same TileEntity do different things upon metadata is quite simple to implement, depending on what you want them to do?

 

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Do what I do and use an item to place the blocks (look at ItemBlock or ItemRedstone). Use the item damage value in a switch() statement and place the block you want accordingly. This also allows you to set metadata and TileEntity data as needed.

Sample code (do not simply copy and paste it, as it uses some of my own functions from my API):

public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int side, float par8, float par9, float par10) {
	if (!ReikaWorldHelper.softBlocks(par3World.getBlockId(x, y, z)) && par3World.getBlockMaterial(x, y, z) != Material.water && par3World.getBlockMaterial(x, y, z) != Material.lava) {
        if (side == 0)
            --y;
        if (side == 1)
            ++y;
        if (side == 2)
            --z;
        if (side == 3)
            ++z;
        if (side == 4)
            --x;
        if (side == 5)
            ++x;
        if (!ReikaWorldHelper.softBlocks(par3World.getBlockId(x, y, z)) && par3World.getBlockMaterial(x, y, z) != Material.water && par3World.getBlockMaterial(x, y, z) != Material.lava)
            return false;
    }
	AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1);
	List inblock = par3World.getEntitiesWithinAABB(EntityLiving.class, box);
	if (inblock.size() > 0)
		return false;
    if (!par2EntityPlayer.canPlayerEdit(x, y, z, 0, par1ItemStack))
    	return false;
    else
    {
    	if (!par2EntityPlayer.capabilities.isCreativeMode)
           --par1ItemStack.stackSize;
        ReikaWorldHelper.legacySetBlockWithNotify(par3World, x, y, z, mod_RotaryCraft.engine.blockID);
        TileEntityEngine eng = (TileEntityEngine)par3World.getBlockTileEntity(x, y, z);
		if (eng != null) {
			par3World.playSoundEffect(x+0.5, y+0.5, z+0.5, "step.stone", 1F, 1.5F);
			eng.type = EnumEngineType.setType(par1ItemStack.getItemDamage());
		}
	}
    	int i = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw * 4F) / 360F) + 0.5D);
        while (i > 3)
        	i -= 4;
        while (i < 0)
        	i += 4;
        switch (i) {
        case 0:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 2);
        break;
        case 1:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 1);
        break;
        case 2:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 3);
        break; 
        case 3:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 0);
        break;
        }
    return true;
}

Link to comment
Share on other sites

Do what I do and use an item to place the blocks (look at ItemBlock or ItemRedstone). Use the item damage value in a switch() statement and place the block you want accordingly. This also allows you to set metadata and TileEntity data as needed.

Sample code (do not simply copy and paste it, as it uses some of my own functions from my API):

public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int side, float par8, float par9, float par10) {
	if (!ReikaWorldHelper.softBlocks(par3World.getBlockId(x, y, z)) && par3World.getBlockMaterial(x, y, z) != Material.water && par3World.getBlockMaterial(x, y, z) != Material.lava) {
        if (side == 0)
            --y;
        if (side == 1)
            ++y;
        if (side == 2)
            --z;
        if (side == 3)
            ++z;
        if (side == 4)
            --x;
        if (side == 5)
            ++x;
        if (!ReikaWorldHelper.softBlocks(par3World.getBlockId(x, y, z)) && par3World.getBlockMaterial(x, y, z) != Material.water && par3World.getBlockMaterial(x, y, z) != Material.lava)
            return false;
    }
	AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1);
	List inblock = par3World.getEntitiesWithinAABB(EntityLiving.class, box);
	if (inblock.size() > 0)
		return false;
    if (!par2EntityPlayer.canPlayerEdit(x, y, z, 0, par1ItemStack))
    	return false;
    else
    {
    	if (!par2EntityPlayer.capabilities.isCreativeMode)
           --par1ItemStack.stackSize;
        ReikaWorldHelper.legacySetBlockWithNotify(par3World, x, y, z, mod_RotaryCraft.engine.blockID);
        TileEntityEngine eng = (TileEntityEngine)par3World.getBlockTileEntity(x, y, z);
		if (eng != null) {
			par3World.playSoundEffect(x+0.5, y+0.5, z+0.5, "step.stone", 1F, 1.5F);
			eng.type = EnumEngineType.setType(par1ItemStack.getItemDamage());
		}
	}
    	int i = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw * 4F) / 360F) + 0.5D);
        while (i > 3)
        	i -= 4;
        while (i < 0)
        	i += 4;
        switch (i) {
        case 0:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 2);
        break;
        case 1:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 1);
        break;
        case 2:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 3);
        break; 
        case 3:
        	ReikaWorldHelper.legacySetBlockMetadataWithNotify(par3World, x, y, z, 0);
        break;
        }
    return true;
}

Link to comment
Share on other sites

I want to make a system where you have only one block id to handle all of the different Blocks and SubBlockClass thingies to handle the functions of the different blocks and (optional) subtileentityclass thingies to handle the advanced stuff and the rendering for the different metadata 

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

I want to make a system where you have only one block id to handle all of the different Blocks and SubBlockClass thingies to handle the functions of the different blocks and (optional) subtileentityclass thingies to handle the advanced stuff and the rendering for the different metadata 

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

I want to make a system where you have only one block id to handle all of the different Blocks and SubBlockClass thingies to handle the functions of the different blocks and (optional) subtileentityclass thingies to handle the advanced stuff and the rendering for the different metadata

 

Nice! I look forward too see it in action ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I want to make a system where you have only one block id to handle all of the different Blocks and SubBlockClass thingies to handle the functions of the different blocks and (optional) subtileentityclass thingies to handle the advanced stuff and the rendering for the different metadata

 

Nice! I look forward too see it in action ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

You can if you want to get the metadata passed onto the TileEntity, but you can't have more than 16 blocks on the same ID using that system.

(Yes there's a way of having more *looks at redpower* but I'm sure it's a bit more advance than TileEntity's)

So why do you need 30 blocks inn 1 ID? We got a few thousand block ID's to work with now days so using two or three ain't that bad :)

 

Having the same TileEntity do different things upon metadata is quite simple to implement, depending on what you want them to do?

 

RedPower's "way of having more" is TileEntities.

Link to comment
Share on other sites

You can if you want to get the metadata passed onto the TileEntity, but you can't have more than 16 blocks on the same ID using that system.

(Yes there's a way of having more *looks at redpower* but I'm sure it's a bit more advance than TileEntity's)

So why do you need 30 blocks inn 1 ID? We got a few thousand block ID's to work with now days so using two or three ain't that bad :)

 

Having the same TileEntity do different things upon metadata is quite simple to implement, depending on what you want them to do?

 

RedPower's "way of having more" is TileEntities.

Link to comment
Share on other sites

RedPower's "way of having more" is TileEntities.
And please don't just write "Make a Tileentity", because this wont help.

 

Nice! I look forward too see it in action

Challenge accepted! 8)

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The mobs are moving normally for a second, then freeze, then go back to normal, and this repeats. I describe this as mob lag, bc they stutter as if they were lagging. I don't have the best wifi, but that shouldn't matter since its 10mbps which is enough for a server. I have 8 gigs of ram for it, no optimizations have worked, if there is anything more you may need to help lmk, ill describe. The modlist is pretty hefty: VS_ClockworkSurvivalSupportV1.4 aether-1.20.1-1.2.0-neoforge.jar alexsdelight-1.5.jar alexsmobs-1.22.7.jar appleskin-forge-mc1.20.1-2.5.1.jar backpacked-forge-1.20.1-2.2.5.jar balm-forge-1.20.1-7.2.1.jar bettervillage-forge-1.20.1-3.2.0.jar BiomesOPlenty-1.20.1-18.0.0.598.jar botarium-forge-1.20.1-2.3.2.jar CGM-Unofficial-1.4.11+Forge+1.20.1.jar citadel-2.5.2-1.20.1.jar clockwork-1.20.1-0.1.2-forge-05f5d5fbbb.jar configured-forge-1.20.1-2.2.2.jar connectivity-1.20.1-4.9.jar create-1.20.1-0.5.1.f.jar create-new-age-forge-1.20.1-1.1.2.jar createarmoryv0.6.1n.jar createbigcannons-forge-1.20.1-0.5.3.b.jar createchunkloading-1.6.0-forge.jar createdeco-2.0.1-1.20.1-forge.jar createdieselgenerators-1.20.1-1.2h.jar createendertransmission-2.0.7-1.20.1.jar create_misc_and_things_ 1.20.1_4.0A.jar cristellib-1.1.5-forge.jar cupboard-1.20.1-2.3.jar curios-forge-5.7.0+1.20.1.jar destroy-1.20.1-0.8.jar Dungeon Crawl-1.20.1-2.3.14.jar FallingTree-1.20.1-4.3.4.jar FarmersDelight-1.20.1-1.2.4.jar framework-forge-1.20.1-0.6.26.jar geckolib-forge-1.20.1-4.4.2.jar InsaneLib-1.12.1-mc1.20.1.jar Jade-1.20.1-forge-11.8.0.jar jei-1.20.1-forge-15.3.0.4.jar journeymap-1.20.1-5.9.18-forge.jar JustEnoughResources-1.20.1-1.4.0.247.jar kotlinforforge-4.10.0-all.jar l2library-2.4.23.jar libraryferret-forge-1.20.1-4.0.0.jar macawsbridgesbop-1.20-1.1.jar mcw-bridges-2.1.0-mc1.20.4forge.jar moonlight-1.20-2.9.17-forge.jar morevillagers-forge-1.20.1-5.0.0.jar Mo_ZombiesWave-1.20.1-0.1.0-forge.jar NaturesCompass-1.20.1-1.11.2-forge.jar Placebo-1.20.1-8.6.1.jar refinedstorage-1.12.4.jar soundphysics-forge-1.20.1-1.1.2.jar spark-1.10.53-forge.jar stealing_villagers-forge-1.20.1-1.0.0.jar s_a_b-1.3.0_1.20.1.jar takesapillage-1.0.3-1.20.1.jar TerraBlender-forge-1.20.1-3.0.1.4.jar tombstone-1.20.1-8.6.2.jar Towns-and-Towers-1.12-Fabric+Forge.jar twilightforest-1.20.1-4.3.2145-universal.jar valkyrienskies-120-2.1.3-beta.1.jar veinmining-forge-1.3.0+1.20.1.jar waystones-forge-1.20-14.1.3.jar YungsApi-1.20-Forge-4.0.3.jar YungsBetterDesertTemples-1.20-Forge-3.0.3.jar YungsBetterDungeons-1.20-Forge-4.0.3.jar YungsBetterEndIsland-1.20-Forge-2.0.5.jar YungsBetterJungleTemples-1.20-Forge-2.0.4.jar YungsBetterMineshafts-1.20-Forge-4.0.4.jar YungsBetterNetherFortresses-1.20-Forge-2.0.5.jar YungsBetterOceanMonuments-1.20-Forge-3.0.4.jar YungsBetterStrongholds-1.20-Forge-4.0.3.jar YungsBetterWitchHuts-1.20-Forge-3.0.3.jar YungsBridges-1.20-Forge-4.0.3.jar zaynens_leather_from_rotten_flesh_mod_1.20.1.jar
    • Thank you so much! Unfortunately before reading this I reinstalled my java installer. Now when I try to open the forge installer I receive an error message stating 'Unable to install Java' even though I have definitely downloaded and installed the latest version. Any idea what this could be or how I could fix it?  
    • IT WORKED! THANK YOU!
    • sorry for the stuborn ness ss   test code logs and planks return nothing on minable but i can use the other tags  name minecraft:oak_log BlockTags.LOGS name minecraft:oak_planks BlockTags.PLANKS   it kinda works but its not like like perfect             
    • I'm making a custom modpack for 1.20.1 and everything else seems to work except this Passive skilltree mod. The world loads fine but when I press the keybind to open the mod's GUI, the world immediately saves and crashes with this report: https://pastebin.com/svEPsRty Any help or insight towards the right direction is greatly appreciated!
  • Topics

×
×
  • Create New...

Important Information

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