fardell24 ([personal profile] fardell24) wrote2015-07-23 05:23 pm

Digital and Interactive Games 2015 - Term 3, Session 3


Digital and Interactive Games 2015, Term 3, Session 3
Today: - Simple Block Manipulation
– Location – Absolute
– Relative
– Simple Enchant

for () {
. for () {
. }
}


→ new project cube1 with 1 command “cube1”

x, y, z


%appdata%
– .minecraft

• world.getBukkit(x,y,z).setTypeId(...)

Player.sendMessage(“ ”)


import org.Bukkit.world;
import org.Bukkit.command.Command;
import org.Bukkit.command.CommandExecutor;
import org.Bukkit.command.CommandSender;
import org.Bukkit.entity.Player;


import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CreateCubeCommand implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2,
String[] arg3) {
// TODO Auto-generated method stub

if(!(sender instanceof Player)) return true;

Player player = (Player) sender;
createABlock(player);

player.sendMessage("Successfully execute cube1");
player.sendMessage(arg2);

return true;
}
@SuppressWarnings("deprecation")
private void createABlock(Player p) {
World w = p.getWorld();
p.getLocation().getBlock().getRelative(1,0,3).setType(Material.BEDROCK);
w.getBlockAt(270,64,202).setTypeId(62);
}
}





Block ← .getBlockAt()