Removed unnecessary block clearups and fixed snow layer data value setting

This commit is contained in:
Norbi Peti 2015-10-28 12:26:55 +01:00
parent 8d3e508064
commit 154869fe44
3 changed files with 21 additions and 11 deletions

View file

@ -79,29 +79,39 @@ public class PluginMain extends JavaPlugin {
return; return;
} }
Block block = player.getWorld().getBlockAt( Block block = player.getWorld().getBlockAt(
129 - packet[0], 56 + moveup, -654); // 129 - packet[0], 56 + moveup, -654);
if (Byte.toUnsignedInt(packet[1]) - moveup * 16 > 16) { 129 - packet[0], 56 + moveup, -600);
if (Byte.toUnsignedInt(packet[1]) - moveup * 8 > 8) {
block.setType(Material.SNOW_BLOCK); block.setType(Material.SNOW_BLOCK);
block.getState().setData( block.getState().setData(
new MaterialData(Material.SNOW_BLOCK, new MaterialData(Material.SNOW_BLOCK,
(byte) 0)); (byte) 0));
} else { } else {
block.setType(Material.SNOW); block.setType(Material.SNOW);
MaterialData data = new MaterialData( /*
Material.SNOW); * MaterialData data = new MaterialData(
data.setData((byte) (Byte * Material.SNOW); data.setData((byte) (Byte
.toUnsignedInt(packet[1]) - moveup)); * .toUnsignedInt(packet[1]) - moveup * 8));
block.getState().setData(data); */
/*
* player.sendMessage("Data: " + (byte)
* (Byte.toUnsignedInt(packet[1]) - moveup *
* 8));
*/
// block.getState().setData(data);
// block.getState().update();
block.setData((byte) (Byte
.toUnsignedInt(packet[1]) - moveup * 8));
} }
if (Byte.toUnsignedInt(packet[1]) - moveup * 16 > 16) if (Byte.toUnsignedInt(packet[1]) - moveup * 8 > 8)
moveup += 1; moveup += 1;
else else
break; break;
} }
for(int i=56+moveup+1; i<255; i++) for (int i = 56 + moveup + 1; i < 56 + 255 / 8; i++) {
{
Block block = player.getWorld().getBlockAt( Block block = player.getWorld().getBlockAt(
129 - packet[0], i, -654); // 129 - packet[0], i, -654);
129 - packet[0], i, -600);
block.setType(Material.AIR); block.setType(Material.AIR);
} }
runningtask = false; runningtask = false;