Further work on items

This commit is contained in:
Matthew Miller
2018-06-14 11:55:02 +10:00
parent 001a3544fb
commit 1cc735e359
11 changed files with 36 additions and 57 deletions

View File

@ -98,6 +98,10 @@ public class BundledBlockData {
*/
@Nullable
private BlockEntry findById(String id) {
// If it has no namespace, assume minecraft.
if (!id.contains(":")) {
id = "minecraft:" + id;
}
return idMap.get(id);
}
@ -190,7 +194,7 @@ public class BundledBlockData {
private String id;
private String unlocalizedName;
private List<String> aliases;
private Map<String, SimpleState> states = new HashMap<String, SimpleState>();
private Map<String, SimpleState> states = new HashMap<>();
private SimpleBlockMaterial material = new SimpleBlockMaterial();
void postDeserialization() {

View File

@ -99,6 +99,10 @@ public class BundledItemData {
*/
@Nullable
private ItemEntry findById(String id) {
// If it has no namespace, assume minecraft.
if (!id.contains(":")) {
id = "minecraft:" + id;
}
return idMap.get(id);
}

View File

@ -33,8 +33,7 @@ public class BundledItemRegistry implements ItemRegistry {
@Nullable
@Override
public BaseItem createFromId(String id) {
// TODO Fix legacy ID usage
return new BaseItem(ItemTypes.getItemType(id).getLegacyId());
return new BaseItem(ItemTypes.getItemType(id));
}
@Nullable

View File

@ -1,40 +0,0 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser 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 Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.world.registry;
import com.sk89q.worldedit.blocks.BaseItem;
import javax.annotation.Nullable;
public class NullItemRegistry implements ItemRegistry {
@Nullable
@Override
public BaseItem createFromId(String id) {
return null;
}
@Nullable
@Override
public BaseItem createFromId(int id) {
return null;
}
}