mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 00:17:15 +00:00
fix LegacyTileData not placing
This commit is contained in:
parent
94a7692735
commit
9e40259ca2
@ -1,14 +1,19 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.apache.commons.io.function.IOFunction;
|
import org.apache.commons.io.function.IOFunction;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.*;
|
import org.bukkit.block.*;
|
||||||
import org.bukkit.block.banner.Pattern;
|
import org.bukkit.block.banner.Pattern;
|
||||||
import org.bukkit.block.banner.PatternType;
|
import org.bukkit.block.banner.PatternType;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -34,6 +39,21 @@ public class LegacyTileData extends TileData {
|
|||||||
handler = factory.apply(in);
|
handler = factory.apply(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull KMap<String, Object> getProperties() {
|
||||||
|
return new KMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Material getMaterial() {
|
||||||
|
return handler.getMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isApplicable(BlockData data) {
|
||||||
|
return handler.isApplicable(data);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBukkit(Block block) {
|
public void toBukkit(Block block) {
|
||||||
J.s(() -> handler.toBukkit(block));
|
J.s(() -> handler.toBukkit(block));
|
||||||
@ -51,6 +71,8 @@ public class LegacyTileData extends TileData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private interface Handler {
|
private interface Handler {
|
||||||
|
Material getMaterial();
|
||||||
|
boolean isApplicable(BlockData data);
|
||||||
void toBinary(DataOutputStream out) throws IOException;
|
void toBinary(DataOutputStream out) throws IOException;
|
||||||
void toBukkit(Block block);
|
void toBukkit(Block block);
|
||||||
}
|
}
|
||||||
@ -72,6 +94,16 @@ public class LegacyTileData extends TileData {
|
|||||||
dyeColor = DyeColor.values()[in.readByte()];
|
dyeColor = DyeColor.values()[in.readByte()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return Material.OAK_SIGN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isApplicable(BlockData data) {
|
||||||
|
return Tag.ALL_SIGNS.isTagged(data.getMaterial());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBinary(DataOutputStream out) throws IOException {
|
public void toBinary(DataOutputStream out) throws IOException {
|
||||||
out.writeUTF(line1);
|
out.writeUTF(line1);
|
||||||
@ -101,6 +133,16 @@ public class LegacyTileData extends TileData {
|
|||||||
type = EntityType.values()[in.readShort()];
|
type = EntityType.values()[in.readShort()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return Material.SPAWNER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isApplicable(BlockData data) {
|
||||||
|
return data.getMaterial() == Material.SPAWNER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBinary(DataOutputStream out) throws IOException {
|
public void toBinary(DataOutputStream out) throws IOException {
|
||||||
out.writeShort(type.ordinal());
|
out.writeShort(type.ordinal());
|
||||||
@ -130,6 +172,16 @@ public class LegacyTileData extends TileData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return Material.WHITE_BANNER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isApplicable(BlockData data) {
|
||||||
|
return Tag.BANNERS.isTagged(data.getMaterial());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBinary(DataOutputStream out) throws IOException {
|
public void toBinary(DataOutputStream out) throws IOException {
|
||||||
out.writeByte(baseColor.ordinal());
|
out.writeByte(baseColor.ordinal());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user