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



June 2025

S M T W T F S
12 3 45 67
89 1011 121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 16th, 2025 07:01 pm
Powered by Dreamwidth Studios