mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-21 04:49:51 +08:00
Clean up deprecations in specialized block classes
This commit is contained in:
parent
36ab28897c
commit
059ac19b69
@ -114,6 +114,7 @@ public void setDelay(short delay) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean hasNbtData() {
|
||||
return true;
|
||||
}
|
||||
@ -124,6 +125,7 @@ public String getNbtId() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public CompoundTag getNbtData() {
|
||||
Map<String, Tag<?, ?>> values = new HashMap<>();
|
||||
values.put("Delay", new ShortTag(delay));
|
||||
@ -150,6 +152,7 @@ public CompoundTag getNbtData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setNbtData(CompoundTag rootTag) {
|
||||
if (rootTag == null) {
|
||||
return;
|
||||
|
@ -86,6 +86,7 @@ public void setText(String[] text) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean hasNbtData() {
|
||||
return true;
|
||||
}
|
||||
@ -96,6 +97,7 @@ public String getNbtId() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public CompoundTag getNbtData() {
|
||||
Map<String, Tag<?, ?>> values = new HashMap<>();
|
||||
values.put("Text1", new StringTag(text[0]));
|
||||
@ -106,6 +108,7 @@ public CompoundTag getNbtData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setNbtData(CompoundTag rootTag) {
|
||||
if (rootTag == null) {
|
||||
return;
|
||||
|
@ -85,6 +85,7 @@ public String getOwner() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean hasNbtData() {
|
||||
return true;
|
||||
}
|
||||
@ -95,6 +96,7 @@ public String getNbtId() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public CompoundTag getNbtData() {
|
||||
Map<String, Tag<?, ?>> values = new HashMap<>();
|
||||
Map<String, Tag<?, ?>> inner = new HashMap<>();
|
||||
@ -104,6 +106,7 @@ public CompoundTag getNbtData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setNbtData(CompoundTag rootTag) {
|
||||
if (rootTag == null) {
|
||||
return;
|
||||
|
@ -384,11 +384,14 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
|
||||
text[1] = blockAndExtraData.length > 2 ? blockAndExtraData[2] : "";
|
||||
text[2] = blockAndExtraData.length > 3 ? blockAndExtraData[3] : "";
|
||||
text[3] = blockAndExtraData.length > 4 ? blockAndExtraData[4] : "";
|
||||
return new SignBlock(state, text);
|
||||
@SuppressWarnings("deprecation")
|
||||
SignBlock signBlock = new SignBlock(state, text);
|
||||
return signBlock;
|
||||
} else if (blockType == BlockTypes.SPAWNER) {
|
||||
// Allow setting mob spawn type
|
||||
String mobName;
|
||||
if (blockAndExtraData.length > 1) {
|
||||
String mobName = blockAndExtraData[1];
|
||||
mobName = blockAndExtraData[1];
|
||||
EntityType ent = EntityTypes.get(mobName.toLowerCase(Locale.ROOT));
|
||||
if (ent == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
|
||||
@ -397,20 +400,25 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
|
||||
if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
|
||||
}
|
||||
return new MobSpawnerBlock(state, mobName);
|
||||
} else {
|
||||
//noinspection ConstantConditions
|
||||
return new MobSpawnerBlock(state, EntityTypes.PIG.getId());
|
||||
mobName = EntityTypes.PIG.getId();
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
MobSpawnerBlock mobSpawnerBlock = new MobSpawnerBlock(state, mobName);
|
||||
return mobSpawnerBlock;
|
||||
} else if (blockType == BlockTypes.PLAYER_HEAD || blockType == BlockTypes.PLAYER_WALL_HEAD) {
|
||||
// allow setting type/player/rotation
|
||||
if (blockAndExtraData.length <= 1) {
|
||||
return new SkullBlock(state);
|
||||
@SuppressWarnings("deprecation")
|
||||
SkullBlock skullBlock = new SkullBlock(state);
|
||||
return skullBlock;
|
||||
}
|
||||
|
||||
String type = blockAndExtraData[1];
|
||||
|
||||
return new SkullBlock(state, type.replace(" ", "_")); // valid MC usernames
|
||||
@SuppressWarnings("deprecation")
|
||||
SkullBlock skullBlock = new SkullBlock(state, type.replace(" ", "_")); // valid MC usernames
|
||||
return skullBlock;
|
||||
} else {
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user