[MC 1.7.10] [CC 1.65] Immibis's Peripherals
#181
Posted 31 January 2013 - 05:20 AM
or possibly a future feature to allow reading the label.
the reason is pretty simple label = name of the card owner data on the card = data from the owner
so i like to have the ability to read who's card is in ( read label ) and proceed with reading the data.
It's okay if this feature is not possible or wont come in any future version i'll just store card holder name in the data and break the data in pieces when reading but the amount of data that can be stored on a mag card is pretty limited thats why I'm trying to avoid using too much of it.
#182
Posted 31 January 2013 - 06:42 PM
SilverSatin, on 31 January 2013 - 05:20 AM, said:
or possibly a future feature to allow reading the label.
the reason is pretty simple label = name of the card owner data on the card = data from the owner
so i like to have the ability to read who's card is in ( read label ) and proceed with reading the data.
It's okay if this feature is not possible or wont come in any future version i'll just store card holder name in the data and break the data in pieces when reading but the amount of data that can be stored on a mag card is pretty limited thats why I'm trying to avoid using too much of it.
#183
Posted 01 February 2013 - 07:00 AM
#184
Posted 16 February 2013 - 10:32 AM
EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.
#185
Posted 16 February 2013 - 10:53 AM
absorr, on 16 February 2013 - 10:32 AM, said:
EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.
Quote
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#186
Posted 17 February 2013 - 03:05 PM
absorr, on 16 February 2013 - 10:32 AM, said:
EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.
#187
Posted 22 February 2013 - 11:19 AM
#189
Posted 22 February 2013 - 03:13 PM
#190
Posted 22 February 2013 - 07:50 PM
Where "p" is the wrapped peripheral.
-- Generates a key for the given symmetric algorithm.
-- The key size is optional; if it's not specified a default value will be used depending on the algorithm.
-- Note that sometimes you can successfully generate a key with an invalid size for the algorithm, but you won't be
-- able to encrypt with it.
key = p.generateSymmetricKey(algorithm, keysize)
-- Converts a key to a string.
encodedKey = key.encode()
-- Converts a string back to a key. The algorithm must be the same one the key was created with.
key = p.decodeKey(algorithm, encodedKey)
-- Encrypts a string. The algorithm must be specified again as Java allows you to specify additional options here
-- e.g. you could create a key with "DES" and then encrypt with "DES/CBC/NoPadding".
ciphertext = key.encrypt(algorithm, plaintext)
-- Decrypts a string. The algorithm must be the same it was encrypted with.
plaintext = key.decrypt(algorithm, ciphertext)
-- Returns the block size of an algorithm in bytes, or 0 for stream ciphers. You probably don't need this.
blockSize = p.getCipherBlockSize(algorithm)
-- Generates a key pair for use with the given asymmetric algorithm.
-- Keysize is not optional. The maximum keysize is 1024 with this peripheral as asymmetric keys can take a long time to generate.
-- The returned keys work like symmetric keys, with the exception that messages encrypted by one must be decrypted by the other, instead of the same one.
publicKey, privateKey = p.generateKeyPair(algorithm, keysize)
-- Generates a hash of a string using the given hashing algorithm.
hash = p.hash(algorithm, string)
Note that for long messages the ciphertext will be approximately 33% longer than the plaintext as it is base64 encoded. There is also a constant-length overhead depending on the algorithm, and the plaintext length will be rounded up to the nearest block size - for short messages the ciphertext can be several times the length of the plaintext.
Algorithm names
Any algorithm recognized by the Java Crypto API can be used - for a list of many algorithms in Bouncy Castle (which Minecraft uses), search for "5.2 Algorithms" in this page.
Recommended algorithm names, if you don't have a need for a particular algorithm:
Asymmetric encryption - generate key with "RSA", encrypt with "RSA"
Symmetric encryption - generate key with "AES", encrypt with "AES/CBC/PKCS7Padding". Valid key sizes for AES are 128, 192 or 256.
Hashing - "SHA256"
Example program
#191
Posted 22 February 2013 - 07:52 PM
(by the Department of Redundancy Department)
Events
The adventure map interface fires the following events:
"player_login", username -- when a player logs in
"player_logout", username -- when a player logs out
"player_respawn", username -- when a player respawns
"player_change_world", username -- when a player goes to another world
"chat_message", username, message -- when a player types in chat
Peripheral methods
Where "p" is the wrapped peripheral.
-- Returns an array of the dimension IDs of all currently loaded worlds
worlds = p.getLoadedWorlds()
-- Returns an array of the dimension IDs of all currently registered worlds, loaded or not.
worlds = p.getRegisteredWorlds()
-- Gets a world. Returns nil if the world is not loaded.
w = p.getWorld(dimensionID)
-- Gets a world. Tries to load the world if it isn't loaded. Returns nil if the world is not loaded and couldn't be loaded.
w = p.getOrLoadWorld(dimensionID)
-- Returns the position of the peripheral block.
x, y, z = p.getPeripheralPos()
-- Returns the dimension ID of the world the peripheral block is in.
dimensionID = p.getPeripheralWorldID()
-- Finds a player, given their username. Returns nil if they aren't logged in.
pl = p.getPlayerByName(username)
-- Returns an array of the usernames of all players that are currently logged in.
players = p.getPlayerUsernames()
World methods
-- Returns the name of the biome at the given coordinates. Loads the chunk if necessary.
biome = w.getBiome(x, z)
-- Returns the block ID at the given coordinates. Loads the chunk if necessary.
ID = w.getBlockID(x, y, z)
-- Returns the metadata at the given coordinates. Loads the chunk if necessary.
meta = w.getMetadata(x, y, z)
-- Returns the block-light level at the given coordinates. Loads the chunk if necessary.
light = w.getBlockLight(x, y, z)
-- Returns the sky-light level at the given coordinates. Loads the chunk if necessary.
light = w.getSkyLight(x, y, z)
-- Plays a sound. The sound name is a string. Normal volume is 1. Normal pitch is 1. Maximum pitch is 4.
w.playSound(soundName, x, y, z, volume, pitch)
-- Creates an explosion.
-- TNT explosions have a power of 4.
-- createFire and destroyBlocks are booleans.
w.explode(x, y, z, power, createFire, destroyBlocks)
-- Finds a nearby player.
-- maxDistance is optional - if not specified, or 0, there will be no maximum distance.
pl = w.getClosestPlayer(x, y, z, maxDistance)
-- Checks if a chunk is loaded. Coordinates are chunk coordinates, not block coordinates.
isLoaded = w.isChunkLoaded(x, z)
-- Sets a block.
w.setBlock(x, y, z, id, metadata)
-- Sets a block without causing a block update.
w.setBlockWithoutNotify(x, y, z, id, metadata)
-- Returns the world time
time = w.getTime()
-- Sets the world time
w.setTime(newTime)
-- Gets a tile entity.
te = w.getTileEntity(x, y, z)
Player methods
-- Returns username
username = pl.getUsername()
-- Returns health in half hearts.
health = pl.getHealth()
-- Returns hunger level in half bars.
hunger = pl.getHunger()
-- Returns hunger saturation level in half bars.
saturation = pl.getFoodSaturation()
-- Sets hunger level in half bars
pl.setHunger(hunger)
-- Sets hunger saturation level in half bars
pl.setFoodSaturation(saturation)
-- Sends a chat message to the player. CC probably messes up colour codes.
pl.sendChat(message)
-- Heals. Amount is in half hearts.
pl.heal(amount)
-- Damages the player (with magic damage, which ignores armour). Amount is in half hearts
pl.damage(amount)
-- Returns the player's gamemode. 0 is survival, 1 is creative, 2 is adventure. There's no setter but you can use a command block for that.
mode = pl.getGamemode()
-- Returns the player as an entity object, so you can use generic entity methods.
ent = pl.asEntity()
Entity methods
-- Gets the entity's position
x, y, z = ent.getPosition()
-- Teleports the entity
ent.setPosition(x, y, z)
-- Gets the dimension ID of the world the entity is in
dimID = ent.getWorldID()
-- Gets the normalized direction vector the entity is looking in
x, y, z = ent.getLooking()
Tile entity methods
-- Returns the Java class name of the tile entity.
class = te.getClass()
-- Takes a snapshot of the tile entity's state in NBT format
te.readNBT()
-- Updates the tile entity with the saved NBT data
te.writeNBT()
-- Returns the saved NBT data so you can edit it. NBT methods are not documented here, use the Lua API - see below.
nbt = te.getNBT()
NBT
Download this API (pastebin code: QMct3H9x) and either shell.run it, include it in your program or os.loadAPI it.
Use readTileNBT to read NBT as a table from a tile. Use writeTileNBT to do the opposite.
Example, if w is a world object:
local x, y, z = 0, 128, 0 -- Create a chest w.setBlock(x, y, z, 54, 0) -- Get an NBT table representing the contents of the chest local te = w.getTileEntity(x, y, z) local nbt = readTileNBT(te) -- Add a stack of bedrock in slot 0 table.insert(nbt.value.Items.value, {type="compound", value={id={type="short", value=7}, Count={type="byte", value=64}, Damage={type="short", value=0}, Slot={type="byte", value=0}}}) writeTileNBT(te, nbt)
NBT encoded as a table looks like this:
nbt = { type="compound", value={ id={type="string", value="Chest"}, x={type="int", value=0}, y={type="int", value=128}, z={type="int", value=0}, Items={ type="list", value={ { type="compound", value={ id={type="short", value=7}, Count={type="byte", value=64}, Damage={type="short", value=0}, Slot={type="byte", value=0} } }, { type="compound", value={ id={type="short", value=1}, Count={type="byte", value=32}, Damage={type="short", value=0}, Slot={type="byte", value=2} } } } }, randomLong={type="long", value={1, 2}}, randomIntArray={type="intArray", value={1, 2, 3, 4}}, randomByteArray={type="byteArray", value={5, 6, 7, 8}} } }corresponding to this NBT:
NBT_Compound id: NBT_String "Chest" x: NBT_Integer 0 y: NBT_Integer 128 z: NBT_Integer 0 Items: NBT_List NBT_Compound id: NBT_Short 7 Count: NBT_Byte 64 Damage: NBT_Short 0 Slot: NBT_Byte 0 NBT_Compound id: NBT_Short 1 Count: NBT_Byte 32 Damage: NBT_Short 0 Slot: NBT_Byte 2 randomLong: NBT_Long 4294967298 -- this is (1 << 32) | 2 randomIntArray: NBT_IntArray [1, 2, 3, 4] randomByteArray: NBT_ByteArray [5, 6, 7, 8]
#192
Posted 22 February 2013 - 08:02 PM
- Added cryptographic accelerator.
- Added adventure map interface. Uncraftable. Must be enabled in config or it won't do anything - enabled by default in SSP only.
- Fixed setInsertCardLight not causing render updates.
#193
Posted 23 February 2013 - 03:44 AM
running this program:
http://pastebin.com/xvc5Pfmn
happens after using setHunger aswell
EDIT2:
any more documentation on the playSound function?
i can seem to figure it out
EDIT:
toatal cost of crypto accelerator:
448 stone
64 redstone
24 glass (64 glass panes)
6 iron ingots
about 65 coal (for smelting)
2 inc sacks
#194
Posted 23 February 2013 - 08:13 PM
- Fixed setHunger and setFoodSaturation in SMP.
PixelToast, on 23 February 2013 - 03:44 AM, said:
running this program:
http://pastebin.com/xvc5Pfmn
happens after using setHunger aswell
PixelToast, on 23 February 2013 - 03:44 AM, said:
i can seem to figure it out
Eg "random.bowhit" should play either sound3/random/bowhit1.ogg, sound3/random/bowhit2.ogg, sound3/random/bowhit3.ogg or sound3/random/bowhit4.ogg.
PixelToast, on 23 February 2013 - 03:44 AM, said:
448 stone
64 redstone
24 glass (64 glass panes)
6 iron ingots
about 9 coal (for smelting)
2 inc sacks
#197
Posted 01 March 2013 - 11:49 AM
#198
Posted 02 March 2013 - 04:41 PM
#199
Posted 03 March 2013 - 06:06 PM
Mandrake Fernflower, on 01 March 2013 - 09:36 AM, said:
No! Please don't remove LAN! I love it! (And my base would *explode* of nonexistent block IDs)
#200
Posted 04 March 2013 - 11:55 AM
Mandrake Fernflower, on 01 March 2013 - 09:36 AM, said:
kylergs, on 01 March 2013 - 11:49 AM, said:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users