forked from SteamWar/SteamWar
@@ -189,6 +189,7 @@ public class REntityServer implements Listener {
|
||||
private void removeEntityFromChunk(REntity entity) {
|
||||
long id = entityToId(entity);
|
||||
HashSet<REntity> entitiesInChunk = entities.get(id);
|
||||
if (entitiesInChunk == null) return;
|
||||
entitiesInChunk.remove(entity);
|
||||
if(entitiesInChunk.isEmpty())
|
||||
entities.remove(id);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RTextDisplay extends RDisplay {
|
||||
|
||||
private boolean seeThrough;
|
||||
|
||||
private boolean defaultBackground;
|
||||
private Integer backgroundColor;
|
||||
|
||||
private TextDisplay.TextAlignment alignment;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class RTextDisplay extends RDisplay {
|
||||
this.textOpacity = (byte) -1;
|
||||
this.shadowed = false;
|
||||
this.seeThrough = false;
|
||||
this.defaultBackground = false;
|
||||
this.backgroundColor = null;
|
||||
this.alignment = TextDisplay.TextAlignment.CENTER;
|
||||
server.addEntity(this);
|
||||
}
|
||||
@@ -116,8 +116,22 @@ public class RTextDisplay extends RDisplay {
|
||||
sendPacket(updatePacketSink, this::getTextStatus);
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color) {
|
||||
this.backgroundColor = color;
|
||||
sendPacket(updatePacketSink, this::getTextStatus, this::getBackgroundColor);
|
||||
}
|
||||
|
||||
private static final Object backgroundColorWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 25 : 24, Integer.class);
|
||||
private void getBackgroundColor(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||
if (ignoreDefault || backgroundColor != null) {
|
||||
packetSink.accept(backgroundColorWatcher, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultBackground(boolean defaultBackground) {
|
||||
this.defaultBackground = defaultBackground;
|
||||
if (defaultBackground) {
|
||||
this.backgroundColor = null;
|
||||
}
|
||||
sendPacket(updatePacketSink, this::getTextStatus);
|
||||
}
|
||||
|
||||
@@ -136,7 +150,7 @@ public class RTextDisplay extends RDisplay {
|
||||
if (seeThrough) {
|
||||
status |= 0x02;
|
||||
}
|
||||
if (defaultBackground) {
|
||||
if (backgroundColor == null) {
|
||||
status |= 0x04;
|
||||
}
|
||||
if (alignment == TextDisplay.TextAlignment.CENTER) {
|
||||
|
||||
Reference in New Issue
Block a user