Java Reference
In-Depth Information
In
CowShooter.java
, change the spawn line to make a
Creeper
instead of a
Cow
:
Creeper victim = (Creeper)spawnEntityLiving(loc, EntityType.CREEPER);
Great! Then over in
CowTask.java
, change our variable at the top:
private
Cow cow;
// Delete this line
private
Creeper creeper;
// Add this line
And again change all the references from
cow
to
creeper
to match (there are a
lot).
Once it builds successfully, commit it for safekeeping:
$
git commit -a -m 'Changed to shoot creepers'
[master ea618af] Changed to shoot creepers
2 files changed, 13 insertions(+), 13 deletions(-)
While we're working in
master
, it would be nice to bring the “fling” changes
over from the
play
branch. For that, you can use a
gitmerge
:
$
git merge play -m 'Bringing over vector calc'
Auto-merging src/cowshooter/CowShooter.java
Merge made by the 'recursive' strategy.
src/cowshooter/CowShooter.java | 8 ++++++++
1 file changed, 8 insertions(+)
Now take a look at the
CowShooter.java
file, and you'll see the changes from the
play
branch have been incorporated.
master
now contains the move to the
fling
function and the changes from
Cow
to
Creeper
.
Having merged in changes from the
play
branch doesn't mean it's gone away.
There's still a
play
branch out there and you can still play with it as long as
you want. If you are really, truly done with it and never want to see that
branch again, you can delete it:
$
git branch -d play
Deleted branch play (was f3e6538).
And it is unceremoniously deleted from reality, as
gitbranch
shows:
$
git branch
* master
Back Up to the Cloud
This is a fairly advanced topic. Feel free to skip it on your first reading. But do
read it at some point—after all, hard disks fail, laptops break, and thumb drives
get lost.