mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 02:47:11 +00:00
Update for recent SpoutAPI changes
This commit is contained in:
parent
97c370549f
commit
54eed713ab
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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.spout;
|
||||
|
||||
import org.spout.api.generator.biome.BiomeType;
|
||||
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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.spout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
@ -31,7 +33,8 @@ import com.sk89q.worldedit.cui.CUIEvent;
|
||||
import org.spout.api.entity.Entity;
|
||||
import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.MaterialData;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
import org.spout.api.material.source.MaterialData;
|
||||
import org.spout.api.player.Player;
|
||||
|
||||
public class SpoutPlayer extends LocalPlayer {
|
||||
@ -75,7 +78,7 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public void giveItem(int type, int amt) {
|
||||
player.getEntity().getInventory().addItem(new ItemStack(MaterialData.getMaterial((short)type), amt));
|
||||
player.getEntity().getInventory().addItem(new ItemStack(MaterialRegistry.get((short) type), amt));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
@ -30,7 +32,7 @@ import com.sk89q.worldedit.blocks.BlockID;
|
||||
import org.spout.api.inventory.Inventory;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.material.MaterialData;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
import org.spout.api.player.Player;
|
||||
|
||||
public class SpoutPlayerBlockBag extends BlockBag {
|
||||
@ -81,7 +83,10 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
final short damage = item.getDamage();
|
||||
int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
|
||||
assert(amount == 1);
|
||||
final Material mat = MaterialData.getMaterial(id, damage);
|
||||
Material mat = MaterialRegistry.get(id);
|
||||
if (mat.hasSubMaterials()) {
|
||||
mat = mat.getSubMaterial(damage);
|
||||
}
|
||||
|
||||
if (id == BlockID.AIR) {
|
||||
throw new IllegalArgumentException("Can't fetch air block");
|
||||
@ -132,9 +137,12 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
*/
|
||||
@Override
|
||||
public void storeItem(BaseItem item) throws BlockBagException {
|
||||
final int id = item.getType();
|
||||
final short id = (short) item.getType();
|
||||
final short damage = item.getDamage();
|
||||
final Material mat = MaterialData.getMaterial((short) id, damage);
|
||||
Material mat = MaterialRegistry.get(id);
|
||||
if (mat.hasSubMaterials()) {
|
||||
mat = mat.getSubMaterial(damage);
|
||||
}
|
||||
int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
|
||||
assert(amount <= mat.getMaxStackSize());
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
@ -29,7 +31,7 @@ import org.spout.api.Game;
|
||||
import org.spout.api.Spout;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.material.MaterialData;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@ -51,7 +53,7 @@ public class SpoutServerInterface extends ServerInterface {
|
||||
|
||||
@Override
|
||||
public int resolveItem(String name) {
|
||||
Material mat = MaterialData.getMaterial(name);
|
||||
Material mat = MaterialRegistry.get(name);
|
||||
return mat == null ? 0 : mat.getId();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
@ -37,7 +39,9 @@ import org.spout.api.generator.biome.BiomeGenerator;
|
||||
import org.spout.api.geo.World;
|
||||
import org.spout.api.geo.cuboid.Chunk;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.MaterialData;
|
||||
import org.spout.api.material.BlockMaterial;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
import org.spout.api.math.Vector3;
|
||||
import org.spout.vanilla.controller.object.Item;
|
||||
import org.spout.vanilla.controller.object.falling.PrimedTnt;
|
||||
@ -84,7 +88,11 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean setBlockType(Vector pt, int type) {
|
||||
return world.setBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) type, WorldEditPlugin.getInstance());
|
||||
Material mat = MaterialRegistry.get((short) type);
|
||||
if (mat != null && mat instanceof BlockMaterial) {
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)0, true, WorldEditPlugin.getInstance());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +116,11 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean setTypeIdAndData(Vector pt, int type, int data) {
|
||||
return world.setBlockIdAndData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) type, (short) data, WorldEditPlugin.getInstance());
|
||||
Material mat = MaterialRegistry.get((short) type);
|
||||
if (mat != null && mat instanceof BlockMaterial) {
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)data, true, WorldEditPlugin.getInstance());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +144,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public int getBlockType(Vector pt) {
|
||||
return world.getBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
return world.getBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +155,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public void setBlockData(Vector pt, int data) {
|
||||
setTypeIdAndData(pt, world.getBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()), data);
|
||||
world.setBlockData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) data, true, WorldEditPlugin.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -414,7 +426,11 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public void dropItem(Vector pt, BaseItemStack item) {
|
||||
ItemStack bukkitItem = new ItemStack(MaterialData.getMaterial((short)item.getType(), item.getDamage()), item.getAmount(), item.getDamage());
|
||||
Material mat = MaterialRegistry.get((short) item.getType());
|
||||
if (mat.hasSubMaterials()) {
|
||||
mat = mat.getSubMaterial(item.getDamage());
|
||||
}
|
||||
ItemStack bukkitItem = new ItemStack(mat, item.getDamage(), item.getAmount());
|
||||
world.createAndSpawnEntity(SpoutUtil.toPoint(world, pt), new Item(bukkitItem, new Vector3(pt.getX(), pt.getY(), pt.getZ())));
|
||||
}
|
||||
|
||||
@ -662,7 +678,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidBlockType(int type) {
|
||||
return MaterialData.getBlock((short)type) != null;
|
||||
return MaterialRegistry.get((short)type) instanceof BlockMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
*
|
||||
* 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
|
||||
@ -15,7 +14,10 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
@ -17,6 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout.selections;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
@ -17,6 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout.selections;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2012 sk89q <http://www.sk89q.com> and contributors
|
||||
@ -17,6 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package com.sk89q.worldedit.spout.selections;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
@ -27,49 +29,49 @@ import org.spout.api.geo.discrete.Point;
|
||||
public interface Selection {
|
||||
/**
|
||||
* Get the lower point of a region.
|
||||
*
|
||||
*
|
||||
* @return min. point
|
||||
*/
|
||||
public Point getMinimumPoint();
|
||||
|
||||
/**
|
||||
* Get the lower point of a region.
|
||||
*
|
||||
*
|
||||
* @return min. point
|
||||
*/
|
||||
public Vector getNativeMinimumPoint();
|
||||
|
||||
/**
|
||||
* Get the upper point of a region.
|
||||
*
|
||||
*
|
||||
* @return max. point
|
||||
*/
|
||||
public Point getMaximumPoint();
|
||||
|
||||
/**
|
||||
* Get the upper point of a region.
|
||||
*
|
||||
*
|
||||
* @return max. point
|
||||
*/
|
||||
public Vector getNativeMaximumPoint();
|
||||
|
||||
/**
|
||||
* Get the region selector. This is for internal use.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RegionSelector getRegionSelector();
|
||||
|
||||
/**
|
||||
* Get the world.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public World getWorld();
|
||||
|
||||
/**
|
||||
* Get the number of blocks in the region.
|
||||
*
|
||||
*
|
||||
* @return number of blocks
|
||||
*/
|
||||
public int getArea();
|
||||
@ -99,7 +101,7 @@ public interface Selection {
|
||||
* Returns true based on whether the region contains the point,
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Point pt);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user