Sunday, March 19, 2017

Getting Spigot and ScriptCraft to work on Windows 7 64 bit

We recently attended Boise Code Camp 2017.  It was really great.  The primary attraction was learning how to use javascript with Minecraft to make and blow up buildings.  Codefoster gave the presentation and did a great job.  However, he said he didn't have time to explain how to get spigot and scriptcraft setup, just the cool things you could do once it was working.

I was unable to find complete step by step instructions on how to do this.  The available ones assumed one knew something about any of this first so getting it setup involved lots of searching.  Here's what we did to get it running on a Windows 7 64-bit system.  We used these instructions as a starting point.

1.  Download Buildtools from https://hub.spigotmc.org/jenkins/job/BuildTools/lastBuild/

2.  The Java 8 JDK may need to be installed.  It's available at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
We chose the Windows x64 version and installed it.

3. Git for Windows needed to be installed.  It's available at https://git-for-windows.github.io/

4.  We put buildtools.jar into a directory called spigot under program files and from a command prompt ran java -jar buildtools.jar against it.  This created a jar file called spigot-1.11.2.jar.

5.  Run java -jar spigot-1.11.2.jar - this creates a eula.txt file that must be edited.  Change eula=false to eula=true

6.  Run the spigot jar file again.  It should do things and stop at a > prompt awaiting input.  This is a multiplayer Minecraft server.  Type stop to shut it down.

7.  Download scriptcraft.jar from https://scriptcraftjs.org/download/latest/ and put it in the spigot plugins directory and restart spigot.

8  At the spigot server prompt, type op minecraftusername because running javascript from the minecraft client requires elevated privileges.

9 From the minecraft client, type /js 1+1  If you get 2, its working.

10.  Download Codefosters js files from https://github.com/codefoster/javascript-minecraft-mods and put them in a safe place that is backed up.

11.  Create a hard directory link.  Run cmd.exe as administrator.  Then type mklink /J e:\"program files"\spigot\scriptcraft\plugins\code (The backed up location of your javascript files from previous step)

12.  Test using /js wool() within the Minecraft client to see if the hard link is working.

Helpful commands

/time set 1000 (to reset the time of day to morning)
/js refresh()  (after changing code to refresh so the client sees changes)

This usually happens...

My son was continually typing give username ladder and give username sword, etc, so I thought it would be a simple process for him to create his first javascript function to minimize the typing of the username.
So, after he struggled with it for several minutes, I tried to create a function for give.  After many hours, this was the best I could come up with, primarily from https://github.com/walterhiggins/ScriptCraft/blob/master/docs/API-Reference.md.

exports.j_give(j_item)
{
var inventory = require('inventory');
var items = require('items');
var utils = require('utils');

eval("utils.players(function(player){ inventory(player) .add( items.j_item(1) ) });");
}

The problem is that .add(items. takes the name of the item, like .add(items.cookie(1) for example.  I tried a few different ways to pass in the value from j_item so it could be specified in the Minecraft client like.

/js j_give('cookie') for example, but was not able to get it to work.  The function worked if cookie was hard coded as in

utils.players(function(player){
  inventory(player)
    .add( items.cookie(1) )
});

Oh well - now he's working on a build castle function.









Thursday, April 30, 2009

Coincidence? Child misses bedtime again!

Something strange happened this evening. We visited my brother at his house and wanted to show him a very old jeep we've been working on. It has two seats made of metal and plywood. Doors, a windshield, turn signals and brake lights are optional. (turn signals and brake lights are coming soon). We drove the jeep to see him and parked it at his house being careful to park on the correct side of the street pointing in the correct direction.

We had a great time and left about 8:00 so we could get the kid home at a decent hour. As we got into the jeep, I noticed a populated police car on the other side of the street. As I started the jeep, the police officer drove by and rolled down her window and started talking about safety and car seats and such. Police officers serve the public at large and therefore I didn't really want to argue too much with her so we decided that I would take the old jeep home without the wife and kid and come back for them in a more modern vehicle with a car seat. I made it home without incident and drove the newish vehicle back to my brother's house to pick up the rest of the family.

Arriving at my destination, I left the vehicle to idle while I called my brother to let him know I had arrived. About the time I saw the wife and kid come out of the house, I turned off the vehicle and removed the key to help install the child in his seat. When all was situated, I hopped in and it wouldn't start. No clicks, but power to the headlights, dash, etc. It was like the clutch safety switch had gone out. We called a tow truck and the fellow who arrived we knew from a church we used to attend. Had a great time talking with him as we dropped the rig off at the dealership. Hopefully they will figure out what's going on with it.

Lastly, I read a news article about Chrysler going chapter 11 and idling all their plants starting on Monday. However, Obama said he will fix it and honor my warranty so who is to worry eh?

I think God is trying to tell me something, but I'm not sure what it is yet. All I know right now is the kid went to bed 2.5 hours late and someone could be walking to work tomorrow.

Saturday, February 14, 2009

Rationality

I hope the government considered this scenario before they started throwing around unemployment money. Involve the government in simple matters like employment and all the sudden very strange things start happening.

MADISON, Wis. (AP) - A restaurant worker was accused of trashing the place in an attempt to get fired and collect unemployment compensation. A criminal complaint filed Thursday said a 35-year-old man showed up at a Qdoba restaurant and started throwing brownies and cookies on the floor.

The man then went into the kitchen and threw pots and pans around, then went into a storage area and threw boxes of hot sauce on the floor.

Police said the man told them he was trying to get fired and couldn't collect unemployment if he simply quit.

From http://apnews.myway.com/article/20090213/D96AVT480.html


Tuesday, January 20, 2009

The Econmoics of Fear

This is interesting. Pretty much everyone in the U.S. is in hock up to their eyeballs from the time they leave home until they retire. Contrary to what you may have heard, mortgages do count towards indebtedness.
Part of the debtor mentality is a constant, frantically suppressed undercurrent of terror. We have one of the highest debt-to-income ratios in the world, and apparently most of us are two paychecks from the street. Those in power -- governments, employers -- exploit this, to great effect. Frightened people are obedient -- not just physically, but intellectually and emotionally. If your employer tells you to work overtime, and you know that refusing could jeopardize everything you have, then not only do you work the overtime, but you convince yourself that you're doing it voluntarily, out of loyalty to the company; because the alternative is to acknowledge that you are living in terror. Before you know it, you've persuaded yourself that you have a profound emotional attachment to some vast multinational corporation: you've indentured not just your working hours, but your entire thought process. The only people who are capable of either unfettered action or unfettered thought are those who -- either because they're heroically brave, or because they're insane, or because they know themselves to be safe -- are free from fear.
From http://www.schneier.com. The original quote is from The Likeness, a novel set in Ireland, by Tana French.

Friday, August 15, 2008

Common Sense in New Jersey?

Looks like someone else has figured it out too...and he's in government to boot. New Jersey in fact.
“With this growing level of scientific uncertainty, it makes no sense to enact a new set of economically damaging regulations prompted by the global warming hysteria of recent years.”
This was said by Assemblyman Michael Doherty. Go here for more. He even mentions the incredibly low sunspot numbers I've been talking about and their possible contribution to lower global temperatures.

Over the past year, the sun keeps getting less and less active. The average sunspot number for July 2008 was 0.5. The last time that happened was Feb. of 1954. My guess is that the month of August will be below 1 and for 2008-2010, we'll be looking at global average temperatures that are low enough that even the media will notice the discrepancy between global warming and reality.

We can only hope.

Friday, August 8, 2008

The EPA, fire, and government

"Government is not reason, it is not eloquence, it is force; like fire, a troublesome servant and a fearful master. Never for a moment should it be left to irresponsible action."
This quote has been attributed to George Washington and it is very much applicable in this case. If you are interested in hearing about a horrible injustice in Driggs, Idaho, please read this article about a hard working, diligent man named Lynn Moses who went to prison for following the instructions of local government involving flood control. What happened to common sense in government? Oh yeah, government is like fire.

We hear again and again from the government that they want to pass some sort of law restricting our freedoms and while the law could be used to harass innocent people, we are told that it will only be used to go after the bad guys. That may be true for a year or two, but after a while, government forgets and starts using said law to solidify their own power or just to harass innocent civilians because they can. The story above represents an incredible miscarriage of justice. This didn't happen in California or New York City, but right here in Idaho. Please read it and prepare to be amazed.

When you combine that with the fact that over the past 7 years we have been adding about 1 federal crime per week, it is cause for concern. Read more about it here.

Then get on the horn and tell your congressmen to stop passing crime legislation at the federal level unless it is absolutely necessary. Otherwise we all run the risk of committing a federal crime.

Wednesday, August 6, 2008

Universal Health Care -- Not Good.

When you think of Universal Health Care, do you think of it as a good thing or a bad thing? It's a good thing in that it offers health care to those who otherwise could not afford it. It's a bad thing in that it taxes those who make money in order to provide extremely structured care to those who request it. By extremely structured care, I mean the "government plan" determines what benefits you can and can not receive and how those benefits are paid for.

My wife needs a certain kind of medication and must take a brand name version and the recommendation is to stick with one or the other. There are two brands that are essentially the same and cost the same if purchased without any kind of insurance. Lucky us, we have some insurance, however, medicare reimburses one type much more than the other. Our insurance company matches medicare, therefore, we are burdened with some of the same non-nonsensical requirements determined by Medicare. We can either pay twice the amount or make a non-recommended switch to the other brand. The pharmacy emphasized with us, but they are not able to get the insurance company to listen to anything approaching reason since it all goes back to what the government decides.

So, even with the system we have, things are screwed up from an economic/health perspective and currently the government has a fairly small role compared to providing "Universal Health Care".

But wait, it gets worse, much worse. The government already wants to control your actions in regards to recycling, burning, fireworks, car seats, and emissions testing to name a few. What happens when the government is paying for your health care? Then we get laws banning things like, eating too much, lack of exercise, driving instead of walking short distances, rationing of fats, etc.

Read this article from Reuters and you can see where it is going. Here is a short excerpt:

"The findings highlight a need for widespread efforts to improve Americans' lifestyles and keep their weight in check, according to the researchers. Simply telling people to eat less and exercise more is not enough, Liang noted.

Broader social changes are needed as well, she said -- such as making communities more pedestrian-friendly so that people can walk regularly, or getting the food industry to offer healthier, calorie-conscious choices."

If people wanted the food industry to offer healthier, calorie-conscious choices, the food industry would offer them. If people wanted to live in pedestrian-friendly communities, they would create them and live there.

Do we really want to encourage the government to be overly concerned about what we eat, where we live, and how much we exercise? If you are pro "Universal Health Care" that is exactly what you are encouraging.

Why is it such a problem to work for money and spend money on the things you want/need? Why must we run 40% of our income through the government so they can grudgingly parcel out 10% back to us if we jump through their series of hoops?

I'm a lot like the kid. He doesn't like hoops either.