Jump to content




[MC 1.7.10] [CC 1.65] Immibis's Peripherals


432 replies to this topic

#181 SilverSatin

  • Members
  • 10 posts

Posted 31 January 2013 - 05:20 AM

quick question is it possible to read the mag cards label ?
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 :D 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 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 31 January 2013 - 06:42 PM

View PostSilverSatin, on 31 January 2013 - 05:20 AM, said:

quick question is it possible to read the mag cards label ?
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 :D 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.
It won't be added - if you want to store data, then store it in the data. The label is for players to tell the cards apart.

#183 diegodan1893

  • Members
  • 164 posts
  • LocationSpain

Posted 01 February 2013 - 07:00 AM

Nice peripheral! But I found a bug with Mag reader lights. They act like a bud switch, when you change the orange light, it won't change until you place a block next to it or open the computer GUI.

#184 absorr

  • Members
  • 41 posts
  • LocationUnited States

Posted 16 February 2013 - 10:32 AM

Hi, I would like to add your mod into a Tekkit addon I am making called the Hackers' Modkit. The modkit is all about adding more things for programming lovers to be able to do more with their code within Tekkit Lite. It will be an addon through the new custom zip feature in the Technic Launcher. You will, of course, be given the proper credit for your mod. I hope to hear from you soon with your reply!

EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.

#185 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 16 February 2013 - 10:53 AM

View Postabsorr, on 16 February 2013 - 10:32 AM, said:

Hi, I would like to add your mod into a Tekkit addon I am making called the Hackers' Modkit. The modkit is all about adding more things for programming lovers to be able to do more with their code within Tekkit Lite. It will be an addon through the new custom zip feature in the Technic Launcher. You will, of course, be given the proper credit for your mod. I hope to hear from you soon with your reply!

EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.

Quote

Copyright © 2012 Alex "immibis" Campbell

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 Tiin57

    Java Lunatic

  • Members
  • 1,412 posts
  • LocationIndiana, United States

Posted 17 February 2013 - 03:05 PM

View Postabsorr, on 16 February 2013 - 10:32 AM, said:

Hi, I would like to add your mod into a Tekkit addon I am making called the Hackers' Modkit. The modkit is all about adding more things for programming lovers to be able to do more with their code within Tekkit Lite. It will be an addon through the new custom zip feature in the Technic Launcher. You will, of course, be given the proper credit for your mod. I hope to hear from you soon with your reply!

EDIT: I would also like to add your Liquid XP mod as well, if that is alright with you.
I believe what PixelToast is saying in Legalese is "yes".

#187 seal6000

  • Members
  • 9 posts
  • LocationEdinburgh, Scotland

Posted 22 February 2013 - 11:19 AM

Does this work in CC 1.5?

#188 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 22 February 2013 - 03:06 PM

View Postseal6000, on 22 February 2013 - 11:19 AM, said:

Does this work in CC 1.5?
Probably. I haven't tested it.

#189 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 22 February 2013 - 03:13 PM

seems to work fine

#190 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 22 February 2013 - 07:50 PM

Cryptographic accelerator API

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 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 22 February 2013 - 07:52 PM

Adventure map interface API
(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 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 22 February 2013 - 08:02 PM

52.1.0:
  • 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 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 23 February 2013 - 03:44 AM

getting the most bizzare error ever
Posted Image
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 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 23 February 2013 - 08:13 PM

52.1.1:
  • Fixed setHunger and setFoodSaturation in SMP.

View PostPixelToast, on 23 February 2013 - 03:44 AM, said:

getting the most bizzare error ever
Posted Image
running this program:
http://pastebin.com/xvc5Pfmn

happens after using setHunger aswell
Fixed.

View PostPixelToast, on 23 February 2013 - 03:44 AM, said:

any more documentation on the playSound function?
i can seem to figure it out
Look in .minecraft/resources/sound3. You can play a sound from there by replacing /'s with .'s, removing the .ogg extension and any number.
Eg "random.bowhit" should play either sound3/random/bowhit1.ogg, sound3/random/bowhit2.ogg, sound3/random/bowhit3.ogg or sound3/random/bowhit4.ogg.

View PostPixelToast, on 23 February 2013 - 03:44 AM, said:

toatal cost of crypto accelerator:
448 stone
64 redstone
24 glass (64 glass panes)
6 iron ingots
about 9 coal (for smelting)
2 inc sacks
Doesn't seem ridiculous, you forgot 56 coal to smelt the 448 stone - or use an induction furnace. Expensive enough that you're not going to want one on every computer though, but I usually get tons of redstone and coal.

#195 Mandrake Fernflower

  • Members
  • 117 posts
  • LocationDark Side of The Moon

Posted 24 February 2013 - 04:30 AM

@immibis you have won the internet. +1

#196 Mandrake Fernflower

  • Members
  • 117 posts
  • LocationDark Side of The Moon

Posted 01 March 2013 - 09:36 AM

Also are you planning on removing LAN as there is now a official replacement? and also here's a better recipe I thought of for the crypto: Attached Image: Untitled.png

#197 kylergs

  • Members
  • 61 posts
  • LocationUK

Posted 01 March 2013 - 11:49 AM

Have you thought about rfid card readers returning the distance the player is from the reader, would make tracking of people in your base possible

#198 ThePH

  • Members
  • 31 posts

Posted 02 March 2013 - 04:41 PM

Could a way to get every dimensions, execute commands and change an entity DIM, be added ?

#199 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 03 March 2013 - 06:06 PM

View PostMandrake Fernflower, on 01 March 2013 - 09:36 AM, said:

Also are you planning on removing LAN as there is now a official replacement? and also here's a better recipe I thought of for the crypto: Attachment Untitled.png

No! Please don't remove LAN! I love it! (And my base would *explode* of nonexistent block IDs)

#200 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 04 March 2013 - 11:55 AM

View PostMandrake Fernflower, on 01 March 2013 - 09:36 AM, said:

Also are you planning on removing LAN as there is now a official replacement?
No. Does the official LAN work through unloaded chunks?

View Postkylergs, on 01 March 2013 - 11:49 AM, said:

Have you thought about rfid card readers returning the distance the player is from the reader, would make tracking of people in your base possible
That's a good idea.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users