[personal profile] fardell24

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()



May 2025

S M T W T F S
     1 23
45 6 78910
11 12 13 141516 17
1819 2021 22 2324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 23rd, 2025 03:52 pm
Powered by Dreamwidth Studios