Jump to content

way to store custome data from custome blocks ?.


perromercenary00

Recommended Posts

good days i been working in something more or less complicated.

 

i need a way to store a list of blocks coordinates and  store this list in a spefic block

way of i could get the list from the block using something like

 

public static ArrayList<Integer> getListFromThisBlock(int x,int y,int z){

}

 

and the data dont qet loss wen minecraft close

 

nbt data look not able to fulfuill mi desires.

 

i was tinking in create a class to read and write data in a text  file inside mi mods folder but soon i remember the shiti it is to do something like that whith java

 

------------------

sooo

 

¿there is a way to use sql internali in minecraft to create a custom database in mi mods folder for mi blocks

way it could be automatic ported and usable when i close mi mod to redistribut it on the web whiout causing a major mess?

Link to comment
Share on other sites

well

wath i need to do ?

 

 

i have a litle structure of a type of custom blocks and i store all the coordenadas an types of blocks in a ArrayList <Integer> someting like

ArrayList <Integer> l=new ArrayList <Integer>();

 

//l0 ,l1  ,l2  ,l3  ,l4        ,l5 ,l6 ,l7  , 8l  ,l9      ,l10 ,l11,l12,l13,l14

  x0, y0, z0, id0, meta0 ,x1, y1, z1, id1, meta1, x2, y2, z2, id2, meta2;

 

on rigth click over any of the blocks the code must search the list of blocks and move all the blocks to another coordinates and return then again afther 10s

 

is abridge that have a time to be cross like i have in mind

 

soo a need to store this list

 

 

 

idoo research on WorldData i get this 

https://github.com/perromercenary00/perro-codigo-/issues/1

 

but idont understend how do you do to create  tag ArrayList and store mi data

 

 

Link to comment
Share on other sites

little confused but

 

block are objets and lists are objets

the original trouble is how to save the block object .

 

lets say that a make no just one but 5 list

 

ArrayList<Integer> x      = new ArrayList<Integer>();

ArrayList<Integer> y      = new ArrayList<Integer>();

ArrayList<Integer> z      = new ArrayList<Integer>();

ArrayList<Block>    bloke = new ArrayList<Block>();

ArrayList<Integer> meta = new ArrayList<Integer>();

 

well the coordinates an meta are Integers not trouble whith that but

blocke is an object i cant't write that to a txt file but i must convert it toString() and it returns something like 

and return that to string to block objetc later on the read the list Method

 

toString() = mercenary00.mercenarymod.blocks.MetaBlockeMercenario@4a31c294

getLocalizedName() = tile.modmercenario_metablockemercenario.name

getUnlocalizedName() = tile.modmercenario_metablockemercenario

 

that was the reason i discard the block object  and for i chose to work only the block id's

it shall save me from a major crash when some custom block  from other mod get caugth in the list

 

Block.getIdFromBlock(blk) = 179          == no troubles

 

NBTtags just save strings 

it gona be a pain it shall need to done  a method to get the Array list and make it a whole String separated by colons for later write it to a txt or an NBT                    the list Could have easily 200 blocks 

 

String ListadeBlockes = "x0, y0, z0, id0, meta0 ,x1, y1, z1, id1, meta1, x2, y2, z2, id2, meta2";

 

then another method must read this line chopit and organizate it again in a ArrayList<Integer>

 

 

 

 

 

 

Unless tee worldSave could save objects thats woulbe very nice 

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.

Announcements



×
×
  • Create New...

Important Information

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