Further BaseBlock modernisation

This commit is contained in:
Matthew Miller
2018-06-18 17:53:33 +10:00
parent 811f1d4433
commit e99190225e
61 changed files with 344 additions and 787 deletions

View File

@ -31,8 +31,10 @@ import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColor;
@ -91,8 +93,11 @@ public class SpongePlayer extends AbstractPlayerActor {
}
@Override
public void giveItem(int type, int amt) {
this.player.getInventory().offer(ItemStack.of(SpongeWorldEdit.inst().getAdapter().resolveItem(type), amt));
public void giveItem(BaseItemStack itemStack) {
this.player.getInventory().offer(
ItemStack.of(Sponge.getGame().getRegistry().getType(ItemType.class, itemStack.getType().getId()).get(),
itemStack.getAmount())
);
}
@Override

View File

@ -202,11 +202,6 @@ public abstract class SpongeWorld extends AbstractWorld {
return SpongeWorldData.getInstance();
}
@Override
public boolean isValidBlockType(int id) {
return id == 0 || SpongeWorldEdit.inst().getAdapter().resolveBlock(id) != null;
}
@Override
public int hashCode() {
return getWorld().hashCode();
@ -220,7 +215,7 @@ public abstract class SpongeWorld extends AbstractWorld {
SpongeWorld other = ((SpongeWorld) o);
World otherWorld = other.worldRef.get();
World thisWorld = worldRef.get();
return otherWorld != null && thisWorld != null && otherWorld.equals(thisWorld);
return otherWorld != null && otherWorld.equals(thisWorld);
} else {
return o instanceof com.sk89q.worldedit.world.World
&& ((com.sk89q.worldedit.world.World) o).getName().equals(getName());