mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 07:08:35 +00:00
Plenty of changes to core block behavior to become more compatible with upstream WorldEdit (still more to be done!)
This commit is contained in:
@ -5,6 +5,7 @@ import com.sk89q.worldedit.bukkit.adapter.IBukkitAdapter;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
@ -52,17 +53,17 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
||||
@Override
|
||||
public ItemType asItemType(Material material) {
|
||||
try {
|
||||
return ItemTypes.values[itemTypes[material.ordinal()]];
|
||||
return ItemTypes.get(itemTypes[material.ordinal()]);
|
||||
} catch (NullPointerException e) {
|
||||
if (init()) return asItemType(material);
|
||||
return ItemTypes.values[itemTypes[material.ordinal()]];
|
||||
return ItemTypes.get(itemTypes[material.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockTypes adapt(Material material) {
|
||||
public BlockType adapt(Material material) {
|
||||
try {
|
||||
return BlockTypes.values[blockTypes[material.ordinal()]];
|
||||
return BlockTypes.values[blockTypes[material.ordinal()]];
|
||||
} catch (NullPointerException e) {
|
||||
if (init()) return adapt(material);
|
||||
throw e;
|
||||
@ -80,7 +81,7 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
||||
try {
|
||||
checkNotNull(blockData);
|
||||
Material material = blockData.getMaterial();
|
||||
BlockTypes type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]);
|
||||
BlockType type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]);
|
||||
List<? extends Property> propList = type.getProperties();
|
||||
if (propList.size() == 0) return type.getDefaultState();
|
||||
String properties = blockData.getAsString();
|
||||
|
@ -284,7 +284,7 @@ public interface IBukkitAdapter {
|
||||
*/
|
||||
BlockState adapt(BlockData blockData);
|
||||
|
||||
BlockTypes adapt(Material material);
|
||||
BlockType adapt(Material material);
|
||||
|
||||
/**
|
||||
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -31,7 +32,7 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
||||
int typeId = block.getInternalBlockTypeId();
|
||||
BlockData[] dataCache = blockDataCache[typeId];
|
||||
if (dataCache == null) {
|
||||
BlockTypes type = BlockTypes.get(typeId);
|
||||
BlockType type = BlockTypes.get(typeId);
|
||||
blockDataCache[typeId] = dataCache = new BlockData[type.getMaxStateId() + 1];
|
||||
}
|
||||
int propId = block.getInternalPropertiesId();
|
||||
|
Reference in New Issue
Block a user