From 1ee9a55d19d6be50bda073c5b5f4d4b437faf2ba Mon Sep 17 00:00:00 2001 From: OLEGSHA Date: Sat, 31 Jul 2021 20:47:23 +0300 Subject: [PATCH] Defined Data and Server context interfaces Server read-write (not RO) interfaces do not extend the complimentary *GenericContextWO interfaces by design. It makes no sense to set a BlockLogic, but it makes plenty of sense to refer to a ChunkData rather than a ChunkDataRO. --- .../world/context/BlockDataContext.java | 35 ++++++++++++++++ .../world/context/BlockDataContextRO.java | 34 +++++++++++++++ .../world/context/BlockFaceDataContext.java | 35 ++++++++++++++++ .../world/context/BlockFaceDataContextRO.java | 34 +++++++++++++++ .../common/world/context/TileDataContext.java | 35 ++++++++++++++++ .../world/context/TileDataContextRO.java | 34 +++++++++++++++ .../world/context/WorldDataContext.java | 36 ++++++++++++++++ .../world/context/WorldDataContextRO.java | 36 ++++++++++++++++ .../world/context/ServerBlockContext.java | 41 ++++++++++++++++++ .../world/context/ServerBlockContextRO.java | 42 +++++++++++++++++++ .../world/context/ServerBlockFaceContext.java | 40 ++++++++++++++++++ .../context/ServerBlockFaceContextRO.java | 42 +++++++++++++++++++ .../world/context/ServerTileContext.java | 40 ++++++++++++++++++ .../world/context/ServerTileContextRO.java | 42 +++++++++++++++++++ .../world/context/ServerWorldContext.java | 21 ++++++---- .../world/context/ServerWorldContextRO.java | 31 ++++++++++++-- 16 files changed, 568 insertions(+), 10 deletions(-) create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContext.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContext.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/TileDataContext.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/TileDataContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContext.java create mode 100644 src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContext.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContext.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContextRO.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContext.java create mode 100644 src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContextRO.java diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContext.java b/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContext.java new file mode 100644 index 0000000..4ebb85a --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContext.java @@ -0,0 +1,35 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkData; +import ru.windcorp.progressia.common.world.TileDataReference; +import ru.windcorp.progressia.common.world.TileDataStack; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockGenericContextWO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface BlockDataContext + extends BlockGenericContextWO, + WorldDataContext, + BlockDataContextRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContextRO.java b/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContextRO.java new file mode 100644 index 0000000..f910fa1 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/BlockDataContextRO.java @@ -0,0 +1,34 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkDataRO; +import ru.windcorp.progressia.common.world.TileDataReferenceRO; +import ru.windcorp.progressia.common.world.TileDataStackRO; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockGenericContextRO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface BlockDataContextRO + extends BlockGenericContextRO, + WorldDataContextRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContext.java b/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContext.java new file mode 100644 index 0000000..45ce045 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContext.java @@ -0,0 +1,35 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkData; +import ru.windcorp.progressia.common.world.TileDataReference; +import ru.windcorp.progressia.common.world.TileDataStack; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockFaceGenericContextWO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface BlockFaceDataContext + extends BlockFaceGenericContextWO, + BlockDataContext, + BlockFaceDataContextRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContextRO.java b/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContextRO.java new file mode 100644 index 0000000..ddf7089 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/BlockFaceDataContextRO.java @@ -0,0 +1,34 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkDataRO; +import ru.windcorp.progressia.common.world.TileDataReferenceRO; +import ru.windcorp.progressia.common.world.TileDataStackRO; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockFaceGenericContextRO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface BlockFaceDataContextRO + extends BlockFaceGenericContextRO, + BlockDataContext { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContext.java b/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContext.java new file mode 100644 index 0000000..c3e1321 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContext.java @@ -0,0 +1,35 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkData; +import ru.windcorp.progressia.common.world.TileDataReference; +import ru.windcorp.progressia.common.world.TileDataStack; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.TileGenericContextWO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface TileDataContext + extends TileGenericContextWO, + BlockFaceDataContext, + TileDataContextRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContextRO.java b/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContextRO.java new file mode 100644 index 0000000..b7f2b4d --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/TileDataContextRO.java @@ -0,0 +1,34 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkDataRO; +import ru.windcorp.progressia.common.world.TileDataReferenceRO; +import ru.windcorp.progressia.common.world.TileDataStackRO; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.TileGenericContextRO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface TileDataContextRO + extends TileGenericContextRO, + BlockFaceDataContextRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContext.java b/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContext.java new file mode 100644 index 0000000..31dbef1 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContext.java @@ -0,0 +1,36 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkData; +import ru.windcorp.progressia.common.world.TileDataReference; +import ru.windcorp.progressia.common.world.TileDataStack; +import ru.windcorp.progressia.common.world.WorldData; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.WorldGenericContextWO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface WorldDataContext + extends WorldGenericContextWO, + WorldDataContextRO, + WorldData { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContextRO.java b/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContextRO.java new file mode 100644 index 0000000..c474ea4 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/common/world/context/WorldDataContextRO.java @@ -0,0 +1,36 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ru.windcorp.progressia.common.world.context; + +import ru.windcorp.progressia.common.world.ChunkDataRO; +import ru.windcorp.progressia.common.world.TileDataReferenceRO; +import ru.windcorp.progressia.common.world.TileDataStackRO; +import ru.windcorp.progressia.common.world.WorldDataRO; +import ru.windcorp.progressia.common.world.block.BlockData; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.WorldGenericContextRO; +import ru.windcorp.progressia.common.world.tile.TileData; + +public interface WorldDataContextRO + extends WorldGenericContextRO, + WorldDataRO { + + // currently empty + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContext.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContext.java new file mode 100644 index 0000000..a1fbbf5 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContext.java @@ -0,0 +1,41 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.BlockDataContext; +import ru.windcorp.progressia.common.world.rels.BlockFace; +import ru.windcorp.progressia.server.world.TileLogicStack; + +public interface ServerBlockContext extends BlockDataContext, ServerWorldContext, ServerBlockContextRO { + + public interface Logic extends ServerBlockContextRO.Logic, ServerWorldContext.Logic { + + @Override + ServerBlockContext data(); + + @Override + default TileLogicStack getTilesOrNull(BlockFace face) { + return (TileLogicStack) ServerBlockContextRO.Logic.super.getTilesOrNull(face); + } + + } + + @Override + ServerBlockContext.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContextRO.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContextRO.java new file mode 100644 index 0000000..1ffb30d --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockContextRO.java @@ -0,0 +1,42 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.BlockDataContextRO; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockGenericContextRO; +import ru.windcorp.progressia.server.world.ChunkLogicRO; +import ru.windcorp.progressia.server.world.TileLogicReferenceRO; +import ru.windcorp.progressia.server.world.TileLogicStackRO; +import ru.windcorp.progressia.server.world.block.BlockLogic; +import ru.windcorp.progressia.server.world.tile.TileLogic; + +public interface ServerBlockContextRO extends ServerWorldContextRO, BlockDataContextRO { + + public interface Logic extends ServerWorldContextRO.Logic, + BlockGenericContextRO { + + @Override + ServerBlockContextRO data(); + + } + + @Override + ServerBlockContextRO.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContext.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContext.java new file mode 100644 index 0000000..335e15f --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContext.java @@ -0,0 +1,40 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.BlockFaceDataContext; +import ru.windcorp.progressia.server.world.TileLogicStack; + +public interface ServerBlockFaceContext extends BlockFaceDataContext, ServerBlockContext, ServerBlockFaceContextRO { + + public interface Logic extends ServerBlockFaceContextRO.Logic, ServerBlockContext.Logic { + + @Override + ServerBlockFaceContext data(); + + @Override + default TileLogicStack getTilesOrNull() { + return (TileLogicStack) ServerBlockFaceContextRO.Logic.super.getTilesOrNull(); + } + + } + + @Override + ServerBlockFaceContext.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContextRO.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContextRO.java new file mode 100644 index 0000000..7fca1db --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerBlockFaceContextRO.java @@ -0,0 +1,42 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.BlockFaceDataContextRO; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.BlockFaceGenericContextRO; +import ru.windcorp.progressia.server.world.ChunkLogicRO; +import ru.windcorp.progressia.server.world.TileLogicReferenceRO; +import ru.windcorp.progressia.server.world.TileLogicStackRO; +import ru.windcorp.progressia.server.world.block.BlockLogic; +import ru.windcorp.progressia.server.world.tile.TileLogic; + +public interface ServerBlockFaceContextRO extends ServerBlockContextRO, BlockFaceDataContextRO { + + public interface Logic extends ServerBlockContextRO.Logic, + BlockFaceGenericContextRO { + + @Override + ServerBlockFaceContextRO data(); + + } + + @Override + ServerBlockFaceContextRO.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContext.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContext.java new file mode 100644 index 0000000..5d5a3c0 --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContext.java @@ -0,0 +1,40 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.TileDataContext; +import ru.windcorp.progressia.server.world.TileLogicReference; + +public interface ServerTileContext extends TileDataContext, ServerBlockFaceContext, ServerTileContextRO { + + public interface Logic extends ServerTileContextRO.Logic, ServerBlockFaceContext.Logic { + + @Override + ServerTileContext data(); + + @Override + default TileLogicReference getTileReference() { + return (TileLogicReference) ServerTileContextRO.Logic.super.getTileReference(); + } + + } + + @Override + ServerTileContext.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContextRO.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContextRO.java new file mode 100644 index 0000000..73b8d2c --- /dev/null +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerTileContextRO.java @@ -0,0 +1,42 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package ru.windcorp.progressia.server.world.context; + +import ru.windcorp.progressia.common.world.context.TileDataContextRO; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.TileGenericContextRO; +import ru.windcorp.progressia.server.world.ChunkLogicRO; +import ru.windcorp.progressia.server.world.TileLogicReferenceRO; +import ru.windcorp.progressia.server.world.TileLogicStackRO; +import ru.windcorp.progressia.server.world.block.BlockLogic; +import ru.windcorp.progressia.server.world.tile.TileLogic; + +public interface ServerTileContextRO extends ServerBlockFaceContextRO, TileDataContextRO { + + public interface Logic extends ServerBlockFaceContextRO.Logic, + TileGenericContextRO { + + @Override + ServerTileContextRO data(); + + } + + @Override + ServerTileContextRO.Logic logic(); + +} diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContext.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContext.java index 1b281c9..ee04242 100644 --- a/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContext.java +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContext.java @@ -17,19 +17,26 @@ */ package ru.windcorp.progressia.server.world.context; -import ru.windcorp.progressia.common.world.WorldData; +import glm.vec._3.i.Vec3i; +import ru.windcorp.progressia.common.world.context.WorldDataContext; +import ru.windcorp.progressia.common.world.rels.BlockFace; +import ru.windcorp.progressia.server.world.TileLogicStack; import ru.windcorp.progressia.server.world.WorldLogic; -public interface ServerWorldContext extends WorldData, ServerWorldContextRO { - - public interface Logic extends ServerWorldContextRO.Logic, WorldLogic { - +public interface ServerWorldContext extends WorldDataContext, ServerWorldContextRO { + + public interface Logic extends ServerWorldContextRO.Logic, + WorldLogic { + @Override ServerWorldContext data(); + @Override + TileLogicStack getTiles(Vec3i blockInWorld, BlockFace face); + } - + @Override ServerWorldContext.Logic logic(); - + } \ No newline at end of file diff --git a/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContextRO.java b/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContextRO.java index 7672a12..43eeedc 100644 --- a/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContextRO.java +++ b/src/main/java/ru/windcorp/progressia/server/world/context/ServerWorldContextRO.java @@ -1,16 +1,41 @@ package ru.windcorp.progressia.server.world.context; -import ru.windcorp.progressia.common.world.WorldDataRO; +import ru.windcorp.progressia.common.world.context.WorldDataContextRO; +import ru.windcorp.progressia.common.world.entity.EntityData; +import ru.windcorp.progressia.common.world.generic.context.WorldGenericContextRO; +import ru.windcorp.progressia.server.world.ChunkLogicRO; +import ru.windcorp.progressia.server.world.TileLogicReferenceRO; +import ru.windcorp.progressia.server.world.TileLogicStackRO; import ru.windcorp.progressia.server.world.WorldLogicRO; +import ru.windcorp.progressia.server.world.block.BlockLogic; +import ru.windcorp.progressia.server.world.tile.TileLogic; -public interface ServerWorldContextRO extends WorldDataRO, ServerContext { +public interface ServerWorldContextRO extends WorldDataContextRO, ServerContext { - public interface Logic extends WorldLogicRO { + public interface Logic + extends + WorldGenericContextRO, + WorldLogicRO, + ServerContext { + /** + * Acquires the data view of this context. Use this method to + * conveniently access data content. The returned object is linked to + * this context and operates on the same data. + * + * @return a view of this context that returns data objects + */ ServerWorldContextRO data(); } + /** + * Acquires the logic view of this context. Use this method to conveniently + * access logic content. The returned object is linked to this context and + * operates on the same data. + * + * @return a view of this context that returns appropriate logic objects + */ ServerWorldContextRO.Logic logic(); }