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.
This commit is contained in:
OLEGSHA 2021-07-31 20:47:23 +03:00
parent a338a00f1d
commit 1ee9a55d19
16 changed files with 568 additions and 10 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStack, TileDataReference, ChunkData, EntityData>,
WorldDataContext,
BlockDataContextRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStackRO, TileDataReferenceRO, ChunkDataRO, EntityData>,
WorldDataContextRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStack, TileDataReference, ChunkData, EntityData>,
BlockDataContext,
BlockFaceDataContextRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStackRO, TileDataReferenceRO, ChunkDataRO, EntityData>,
BlockDataContext {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStack, TileDataReference, ChunkData, EntityData>,
BlockFaceDataContext,
TileDataContextRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStackRO, TileDataReferenceRO, ChunkDataRO, EntityData>,
BlockFaceDataContextRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStack, TileDataReference, ChunkData, EntityData>,
WorldDataContextRO,
WorldData {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockData, TileData, TileDataStackRO, TileDataReferenceRO, ChunkDataRO, EntityData>,
WorldDataRO {
// currently empty
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockLogic, TileLogic, TileLogicStackRO, TileLogicReferenceRO, ChunkLogicRO, EntityData> {
@Override
ServerBlockContextRO data();
}
@Override
ServerBlockContextRO.Logic logic();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockLogic, TileLogic, TileLogicStackRO, TileLogicReferenceRO, ChunkLogicRO, EntityData> {
@Override
ServerBlockFaceContextRO data();
}
@Override
ServerBlockFaceContextRO.Logic logic();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<BlockLogic, TileLogic, TileLogicStackRO, TileLogicReferenceRO, ChunkLogicRO, EntityData> {
@Override
ServerTileContextRO data();
}
@Override
ServerTileContextRO.Logic logic();
}

View File

@ -17,19 +17,26 @@
*/ */
package ru.windcorp.progressia.server.world.context; 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; import ru.windcorp.progressia.server.world.WorldLogic;
public interface ServerWorldContext extends WorldData, ServerWorldContextRO { public interface ServerWorldContext extends WorldDataContext, ServerWorldContextRO {
public interface Logic extends ServerWorldContextRO.Logic, WorldLogic { public interface Logic extends ServerWorldContextRO.Logic,
WorldLogic {
@Override @Override
ServerWorldContext data(); ServerWorldContext data();
@Override
TileLogicStack getTiles(Vec3i blockInWorld, BlockFace face);
} }
@Override @Override
ServerWorldContext.Logic logic(); ServerWorldContext.Logic logic();
} }

View File

@ -1,16 +1,41 @@
package ru.windcorp.progressia.server.world.context; 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.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<BlockLogic, TileLogic, TileLogicStackRO, TileLogicReferenceRO, ChunkLogicRO, EntityData>,
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(); 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(); ServerWorldContextRO.Logic logic();
} }