Skip to content

Commit

Permalink
fixedWEIRD_NAMING
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyBMan committed May 29, 2020
1 parent 22c2ccc commit e015d58
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class GeyserSession implements CommandSender {
private Entity ridingVehicleEntity;

@Setter
private Map<Position, PlayerEntity> CACHED_SKULLS = new HashMap<>();
private Map<Position, PlayerEntity> cachedSkulls = new HashMap<>();

@Setter
private int craftSlot = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public void translate(ServerUnloadChunkPacket packet, GeyserSession session) {
session.getChunkCache().removeChunk(new ChunkPosition(packet.getX(), packet.getZ()));

//Checks if a skull is in an unloaded chunk then removes it
Iterator<Position> iterator = session.getCACHED_SKULLS().keySet().iterator();
Iterator<Position> iterator = session.getCachedSkulls().keySet().iterator();
while (iterator.hasNext()) {
Position position = iterator.next();
if (Math.floor(position.getX() / 16) == packet.getX() && Math.floor(position.getZ() / 16) == packet.getZ()) {
session.getCACHED_SKULLS().get(position).despawnEntity(session);
session.getCachedSkulls().get(position).despawnEntity(session);
iterator.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public CompoundTag getDefaultBedrockTag(String bedrockId, int x, int y, int z) {
}

public static SerializedSkin getSkin(com.github.steveice10.opennbt.tag.builtin.CompoundTag tag, GeyserSession session) {
if (tag.contains("Owner") && !session.getCACHED_SKULLS().containsKey(tag)) {
if (tag.contains("Owner") && !session.getCachedSkulls().containsKey(tag)) {
com.github.steveice10.opennbt.tag.builtin.CompoundTag Owner = tag.get("Owner");
com.github.steveice10.opennbt.tag.builtin.CompoundTag Properties = Owner.get("Properties");
ListTag Textures = Properties.get("textures");
Expand Down Expand Up @@ -184,14 +184,14 @@ public static void spawnPlayer(GeyserSession session, com.github.steveice10.open

player.updateBedrockAttributes(session);
player.moveAbsolute(session, Vector3f.from(x, y, z), rotation, 0, true, false);
session.getCACHED_SKULLS().put((new Position((int) tag.get("x").getValue(), (int) tag.get("y").getValue(), (int) tag.get("z").getValue())), player);
session.getCachedSkulls().put((new Position((int) tag.get("x").getValue(), (int) tag.get("y").getValue(), (int) tag.get("z").getValue())), player);
session.getConnector().getGeneralThreadPool().schedule(() -> {
metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false);
player.updateBedrockMetadata(session);
}, 500, TimeUnit.MILLISECONDS); //Delay 500 milliseconds to give the model time to load in
}

public static boolean containsCustomSkull(Position position, GeyserSession session) {
return session.getCACHED_SKULLS().containsKey(position);
return session.getCachedSkulls().containsKey(position);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public static void updateBlock(GeyserSession session, BlockState blockState, Vec
if (SkullBlockEntityTranslator.containsCustomSkull(new Position(position.getX(), position.getY(), position.getZ()), session) && blockState.equals(AIR)) {
Position skullPosition = new Position(position.getX(), position.getY(), position.getZ());
RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket();
removeEntityPacket.setUniqueEntityId(session.getCACHED_SKULLS().get(skullPosition).getGeyserId());
removeEntityPacket.setUniqueEntityId(session.getCachedSkulls().get(skullPosition).getGeyserId());
session.sendUpstreamPacket(removeEntityPacket);
session.getCACHED_SKULLS().remove(skullPosition);
session.getCachedSkulls().remove(skullPosition);
}

int blockId = BlockTranslator.getBedrockBlockId(blockState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void switchDimension(GeyserSession session, int javaDimension) {

session.getEntityCache().removeAllEntities();
session.getItemFrameCache().clear();
session.getCACHED_SKULLS().clear();
session.getCachedSkulls().clear();
if (session.getPendingDimSwitches().getAndIncrement() > 0) {
ChunkUtils.sendEmptyChunks(session, player.getPosition().toInt(), 3, true);
}
Expand Down

0 comments on commit e015d58

Please sign in to comment.