you can probably figure this out of course, but in that excerpt, this.width = 256 (talking about 256*256 region)
- ImperialEmperor
- Registered Member
-
Member for 12 years, 9 months, and 7 days
Last active Wed, Aug, 31 2016 18:07:39
- 0 Followers
- 466 Total Posts
- 37 Thanks
-
1
MamiyaOtaru posted a message on VoxelMap [1.16.1 to 1.7.10] - a minimap and worldmapPosted in: Minecraft Mods -
1
MamiyaOtaru posted a message on VoxelMap [1.16.1 to 1.7.10] - a minimap and worldmapPosted in: Minecraft Modsyou bet
If you are serious about it, here's the code used to pull values out of the byte array (code can be easier to read)
public static final int DATABITS = 17; private static final int HEIGHTPOS = 0; private static final int BLOCKSTATEPOS = 1; private static final int LIGHTPOS = 3; private static final int OCEANFLOORHEIGHTPOS = 4; private static final int OCEANFLOORBLOCKSTATEPOS = 5; private static final int OCEANFLOORLIGHTPOS = 7; private static final int TRANSPARENTHEIGHTPOS = 8; private static final int TRANSPARENTBLOCKSTATEPOS = 9; private static final int TRANSPARENTLIGHTPOS = 11; private static final int FOLIAGEHEIGHTPOS = 12; private static final int FOLIAGEBLOCKSTATEPOS = 13; private static final int FOLIAGELIGHTPOS = 15; private static final int BIOMEIDPOS = 16; public int getHeight(int x, int z) { return getData(x, z, HEIGHTPOS) & 255; //& 0xff to convert unsigned byte to 0-255 int } public int getBlockstate(int x, int z) { return (getData(x, z, BLOCKSTATEPOS) & 255) << 8 | (getData(x, z, BLOCKSTATEPOS+1) & 255); } public int getLight(int x, int z) { return getData(x, z, LIGHTPOS) & 255; } public int getOceanFloorHeight(int x, int z) { return getData(x, z, OCEANFLOORHEIGHTPOS) & 255; } public int getOceanFloorBlockstate(int x, int z) { return (getData(x, z, OCEANFLOORBLOCKSTATEPOS) & 255) << 8 | (getData(x, z, OCEANFLOORBLOCKSTATEPOS+1) & 255); } public int getOceanFloorLight(int x, int z) { return getData(x, z, OCEANFLOORLIGHTPOS) & 255; } public int getTransparentHeight(int x, int z) { return getData(x, z, TRANSPARENTHEIGHTPOS) & 255; } public int getTransparentBlockstate(int x, int z) { return (getData(x, z, TRANSPARENTBLOCKSTATEPOS) & 255) << 8 | (getData(x, z, TRANSPARENTBLOCKSTATEPOS+1) & 255); } public int getTransparentLight(int x, int z) { return getData(x, z, TRANSPARENTLIGHTPOS) & 255; } public int getFoliageHeight(int x, int z) { return getData(x, z, FOLIAGEHEIGHTPOS)& 255; } public int getFoliageBlockstate(int x, int z) { return (getData(x, z, FOLIAGEBLOCKSTATEPOS) & 255) << 8 | (getData(x, z, FOLIAGEBLOCKSTATEPOS+1) & 255); } public int getFoliageLight(int x, int z) { return getData(x, z, FOLIAGELIGHTPOS) & 255; } public int getBiomeID(int x, int z) { return getData(x, z, BIOMEIDPOS) & 255; } private synchronized byte getData(int x, int z, int bit) { int index = (x + z * this.width) * DATABITS + bit; return this.data[index]; }
-
1
MamiyaOtaru posted a message on VoxelMap [1.16.1 to 1.7.10] - a minimap and worldmapPosted in: Minecraft Modssure. I can describe it. It's complex though, and I'll give you a possibly easier solution at the bottom. (skip to **)
what you are looking at is it's one .zip file per region (each with 256 chunks), with the raw data being 17 bytes for each x,z coordinate (256x256 of them in a region).
so with zero based counting, the last byte (16) is the biomeID. The first 16 bytes are in 4 groups of 4, each representing a block from a different "layer" (will explain the layers in a moment)
Within those groups the first is the height, from 0-255. In Java a byte is -128 to 127 so before using it I bitwise-and it with 255 to get the 0-255 value as an int or short or whatever. Same for the rest of the values
the second and third together are the blockstateID, which minecraft gets with getIdFromBlock(state.getBlock()) + (state.getBlock().getMetaFromState(state) << 12). Max value for that is 65536, a Short, or two bytes. I am storing them big endian because my human brain likes that better and I'm handling it explicitly as such and not relying on the platform to figure out big vs little.
the fourth is the light level of the block (blockLight + skyLight*16) which can be used as an entry into the EntityRenderer.lightmapTexture.getTextureData() array, which changes as the sun goes up or down and torches flicker etc.
So the layers. First is the highest partially light blocking block (plus lava. lava blocked light up through 1.5 or 1.6 or something). second is the seafloor (when the first layer is water). third is the highest rain blocking block (catches glass blocks and fences up in the air etc). fourth is mostly vegetation: one block above the first layer, stuff like flowers, torches, rails etc that don't block anything, but also allows for stuff like fences (on the ground anyway) to show under glass. The last three layers might or might not exist at a given coordinate (they'll be zerod out if not, leads to nice zip compression).
If during a conversion there's nothing to put into the last three layers, it won't hurt anything, they just won't show on the map.
Converting that info into a color to display is done at runtime, based on the current resource pack(s), the current light level, and player preferences (height vs slope mapping, etc). Doing that outside of Minecraft would require replicating some Minecraft code, or just using set values for things like each block's color, etc.
**
If you want to make a web viewer, it would be easier perhaps to have VoxelMap output images for each region (it doesn't do that by default, but it can). To output images, open voxelmap.properties and add this line:
Output Images:true
Then run Minecraft. That line will disappear before your next run, so if you wish to do it again, add the line again. Join the server or load the singleplayer world. Ensure you have your chosen resource pack loaded and it is the time of day you want, then pan around the world map. All areas you view will be output as images once they are flushed from the cache (at the very latest, when you leave the world).
images will be created in /VoxelMods/voxelMap/cache/WORLDNAME(/optionalSubworldName)/dimensionName/images/z1
From there, you can process them yourself, or use the VoxelMap Image Processor (creates a google maps like html page): https://github.com/MamiyaOtaru/anvilmapper
If you come up with your own tool to process the image files I'd love to hear about it. Someone else already made one too: https://github.com/GauthIronstaff/VoxelStitch/
-
1
AnUnknownMiner posted a message on A very bad JavaScript game: minecraft miningThis game has gone a long way since I posted this on Reddit, which then got posted on 4Chan. Keep it up!Posted in: General Gaming - To post a comment, please login.
19
Highscores: http://www.rscharts.com/highscores/
General notes:
OPM = Ores Per Minute
KPE = Kills Per Enemy
1/1/2014
Highscores now has a group system! Compete with just your friends/people you know.
12/29/2013
Added an ore price guide to the navigation menu
Research projects may now require resources
In relation to the previous change, you can set aside resources for research
Popup/alert boxes are no longer used when "buying x" of soldiers
Popups no longer "overlap"/overwrite eachother; there is now a queue
Fixed bug where ores wouldn't show up in your vault when auto pilot was disabled
Fixed bug where money wasn't deducted when you researched something
Fixed a bug where cancelling a project bugged out
Fixed bug where after purchasing and disabiling autopilot, ore would still be sold automatically
12/29/2013
Researching added to the game!
Fixed achievements not saving
Fixed "mining down under" achievement
Popups now center correctly
Allies tab removed until content is added
An alert box no longer appears when you have full ore
Other various bug fixes
Update 12/26/2013
Added achievement system
Loading screen introduced; should no longer have to deal with flashing icons!
More cheat barriers for highscores, but still not good enough!
New popups (also replaces old boss screens)
New miner (expensive, but very efficient! - plus if you have tons of money, why not buy a bunch?)
Ability to choose between golem and witch as your allies/friends; this will soon introduce ally-specific benefits
Start on new research feature (will soon include oil/drilling)!
New "buy max" button introduced to ease the process of buying workers
Some minor bug fixes
Update 11/28/2013
Rewrote some functions that will ease the process of adding new bosses.
Zombie boss now has a "continue" button.
Portal added. Collect parts from winning battles against Don Chikolio, or you can partner with him to receive a few immediately.
You now receive money for winning battles.
Two new pickaxes, Heavenly Pickaxe and Hell Pickaxe (credits to Thiefking for designs).
A new heavenly miner and heavenly soldier.
New ores.
Stats tab now added.
Bug fixes.
2
Currently working on:
1
Yes, but a dedicated miner can mine iron+.
1
Terraria is too boring for me. Dull gameplay.
Plus, it really only has more points because all of the things in Terraria are easier to implement development wise (e.g: 2D mobs are a lot easier to implement than 3D).
1
Need some people to play with. Reply here or PM me.
1
http://puu.sh/QRXR
When I've freaking chose the RIGHT option to join with.
1
1
10
1
TNT
Any enchanted armor
Swords
Flint & Steel
Fire Charges
Lava buckets
Water buckets (only if it was used to grief/kill)
Damaging/splash potions
Enchanting tables
Enderpearl
Any other unobtainable blocks...