Fix shulker meta (#80)

This commit is contained in:
MelonHell 2023-12-06 09:54:04 +03:00 committed by Matt Worzala
parent ccdc5535e3
commit d798a8128e

View File

@ -1,6 +1,5 @@
package net.minestom.server.entity.metadata.golem; package net.minestom.server.entity.metadata.golem;
import net.minestom.server.coordinate.Point;
import net.minestom.server.entity.Entity; import net.minestom.server.entity.Entity;
import net.minestom.server.entity.Metadata; import net.minestom.server.entity.Metadata;
import net.minestom.server.utils.Direction; import net.minestom.server.utils.Direction;
@ -8,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
public class ShulkerMeta extends AbstractGolemMeta { public class ShulkerMeta extends AbstractGolemMeta {
public static final byte OFFSET = AbstractGolemMeta.MAX_OFFSET; public static final byte OFFSET = AbstractGolemMeta.MAX_OFFSET;
public static final byte MAX_OFFSET = OFFSET + 4; public static final byte MAX_OFFSET = OFFSET + 3;
public ShulkerMeta(@NotNull Entity entity, @NotNull Metadata metadata) { public ShulkerMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
super(entity, metadata); super(entity, metadata);
@ -22,28 +21,20 @@ public class ShulkerMeta extends AbstractGolemMeta {
super.metadata.setIndex(OFFSET, Metadata.Direction(value)); super.metadata.setIndex(OFFSET, Metadata.Direction(value));
} }
public Point getAttachmentPosition() {
return super.metadata.getIndex(OFFSET + 1, null);
}
public void setAttachmentPosition(Point value) {
super.metadata.setIndex(OFFSET + 1, Metadata.OptPosition(value));
}
public byte getShieldHeight() { public byte getShieldHeight() {
return super.metadata.getIndex(OFFSET + 2, (byte) 0); return super.metadata.getIndex(OFFSET + 1, (byte) 0);
} }
public void setShieldHeight(byte value) { public void setShieldHeight(byte value) {
super.metadata.setIndex(OFFSET + 2, Metadata.Byte(value)); super.metadata.setIndex(OFFSET + 1, Metadata.Byte(value));
} }
public byte getColor() { public byte getColor() {
return super.metadata.getIndex(OFFSET + 3, (byte) 10); return super.metadata.getIndex(OFFSET + 2, (byte) 10);
} }
public void setColor(byte value) { public void setColor(byte value) {
super.metadata.setIndex(OFFSET + 3, Metadata.Byte(value)); super.metadata.setIndex(OFFSET + 2, Metadata.Byte(value));
} }
} }