metadaddy / Forcecraft

Visualization of Salesforce Data in Minecraft
92 stars 33 forks source link

Forcecraft

This Minecraft mod visualizes Salesforce Accounts, Opportunities and Contacts. Forcecraft adds a new dimension to Minecraft, where each Account in your Salesforce environment (aka 'org') is represented by a building, comprising a level for each Opportunity associated with that Account.

Forcecraft

Levers on each level represent and control the Opportunity Stage Name; updating an Opportunity's Stage Name outside Minecraft will cause the lever state to update within the Minecraft world, while throwing the lever in Minecraft will update the Opportunity's Stage Name.

Opportunity Levers

Each Salesforce Contact is represented by a Villager-derived entity, with the Contact name shown as a custom name tag above the entity's head.

Contact

Interacting with a Contact (right-click, by default) will show the Chatter feed for that Contact and allow you to post to the feed. Similarly, Account and Opportunity signs give access to the respective Chatter feeds.

Contact Feed

If an Opportunity's Stage Name is updated to 'Closed Won', a Contact from the associated Account will teleport to the player and give the player items to the 'value' of the opportunity. If, on the other hand, an Opportunity's Stage Name is updated to 'Closed Lost', the weather will take a turn for the worse!

Take a look at the mod in action:

YouTube video

UPDATE (version 0.2.1) : if you define a custom object, Vegetable, in your Salesforce environment, the corresponding item will appear in the game when a record is created. The Vegetable object must include the following fields:

If the Vegetable object exists, Forcecraft will automatically listen for updates.

Running the mod

Pre-requisites

IMPORTANT You MUST create a configuration file with your account credentials so that Forcecraft can authenticate to Salesforce. Use this as a template:

# Configuration file

####################
# general
####################

general {
    I:dimensionId=7
    S:loginHost=login.salesforce.com
    S:username=user@example.com    
    S:password=p455w0rd
}

Edit this, and save it as

You MUST edit the username and password entries. If you are using a Salesforce sandbox, change the loginHost to test.salesforce.com.

Run Minecraft and select the Forge profile. If all is well, you should see Forcecraft listed on the Mods screen. Start Minecraft as a single player and create a new world, in creative mode.

Create New World

Once the game starts, you can type /login to teleport to the Forcecraft dimension. Type /logout to return to the default 'Overworld' dimension.

Note - if you're demoing the mod, you probably want to stop the game from pausing when you switch away to the browser or another app. To do this, edit options.txt

Look for the line that reads

pauseOnLostFocus:true

Change true to false.

Building the mod

Pre-requisites

Minecraft, etc, as listed above, under 'Running the mod'. You will need the Minecraft Forge 10.12.1.1060 source distribution. Follow the installation process.

Getting the source

Fetch the Forcecraft repo into the Forge root directory (the forge/ directory created during zip extraction) like this:

cd forge
git init
git remote add origin https://github.com/metadaddy/Forcecraft.git
git fetch
rm build.gradle src/main/resources/mcmod.info
git checkout -t origin/master

Building the mod

gradle build

The build process creates build/distributions/Forcecraft-1.7.2-0.2.3-mod.jar. This is an uber-jar including all the mod's dependencies, packaged so that Forge will load it correctly.

You should be able to drop this into the mods directory to play the mod with Minecraft + Forge.

Debugging the mod

Create the Eclipse project:

gradle eclipse

Build the mod jar (see above). In the Eclipse Project Explorer, open the build/libs folder, select Forcecraft-1.7.2-0.2.2-dep.jar, right click, and select 'Build Path | Add to Build Path'. This jar file contains all the dependencies that Eclipse needs.

Follow the instructions in the 'Running the mod' section above to configure the mod, except that the configuration file needs to be at /<forge dir>/eclipse/config/Forcecraft.cfg.

In Eclipse, you can use the 'Run' or 'Debug' button as appropriate.