mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Changed everything to use BaseBlock, which supports block data and soon some tile entity data.
This commit is contained in:
92
src/com/sk89q/worldedit/BaseBlock.java
Normal file
92
src/com/sk89q/worldedit/BaseBlock.java
Normal file
@ -0,0 +1,92 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
/**
|
||||
* Represents a block.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BaseBlock {
|
||||
/**
|
||||
* BaseBlock type.
|
||||
*/
|
||||
private short type = 0;
|
||||
/**
|
||||
* BaseBlock data.
|
||||
*/
|
||||
private char data = 0;
|
||||
|
||||
/**
|
||||
* Construct the block with its type.
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public BaseBlock(int type) {
|
||||
this.type = (short)type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the block with its type and data.
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public BaseBlock(int type, int data) {
|
||||
this.type = (short)type;
|
||||
this.data = (char)data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public int getType() {
|
||||
return (int)type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(int type) {
|
||||
this.type = (short)type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the data
|
||||
*/
|
||||
public int getData() {
|
||||
return (int)data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data the data to set
|
||||
*/
|
||||
public void setData(int data) {
|
||||
this.data = (char)data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if it's air.
|
||||
*
|
||||
* @return if air
|
||||
*/
|
||||
public boolean isAir() {
|
||||
return type == 0;
|
||||
}
|
||||
}
|
@ -344,6 +344,36 @@ public class Vector {
|
||||
return new Vector(this.x / x, this.y / y, this.z / z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scalar division.
|
||||
*
|
||||
* @param n
|
||||
* @return new point
|
||||
*/
|
||||
public Vector divide(int n) {
|
||||
return new Vector(x / n, y / n, z / n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scalar division.
|
||||
*
|
||||
* @param n
|
||||
* @return new point
|
||||
*/
|
||||
public Vector divide(double n) {
|
||||
return new Vector(x / n, y / n, z / n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scalar division.
|
||||
*
|
||||
* @param n
|
||||
* @return new point
|
||||
*/
|
||||
public Vector divide(float n) {
|
||||
return new Vector(x / n, y / n, z / n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the distance away from a point.
|
||||
*
|
||||
|
Reference in New Issue
Block a user