refactor!: rename CTS to CA

This commit is contained in:
xtex 2023-07-27 16:33:34 +08:00
parent 11c232228a
commit c162186f1a
Signed by: xtex
GPG Key ID: B918086ED8045B91
12 changed files with 43 additions and 42 deletions

View File

@ -10,7 +10,7 @@ import net.minecraft.world.item.CreativeModeTab
import net.minecraft.world.item.ItemStack
import org.slf4j.LoggerFactory
import quaedam.config.QuaedamConfig
import quaedam.misc.cts.ConstantTemporalSink
import quaedam.misc.causality.CausalityAnchor
import quaedam.projection.ProjectionCommand
import quaedam.projection.ProjectionEffectType
import quaedam.projection.SimpleProjectionUpdate
@ -55,7 +55,7 @@ object Quaedam {
ProjectionCommand
SimpleProjectionUpdate
ProjectionShell
ConstantTemporalSink
CausalityAnchor
creativeModeTabs.register()
items.register()

View File

@ -1,4 +1,4 @@
package quaedam.misc.cts
package quaedam.misc.causality
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
@ -15,7 +15,7 @@ import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
object CTSBlock : HorizontalDirectionalBlock(
object CABlock : HorizontalDirectionalBlock(
Properties.of()
.lightLevel { 2 }
.noOcclusion()
@ -31,7 +31,7 @@ object CTSBlock : HorizontalDirectionalBlock(
)
}
override fun newBlockEntity(pos: BlockPos, state: BlockState) = CTSBlockEntity(pos, state)
override fun newBlockEntity(pos: BlockPos, state: BlockState) = CABlockEntity(pos, state)
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
super.createBlockStateDefinition(builder)

View File

@ -1,4 +1,4 @@
package quaedam.misc.cts
package quaedam.misc.causality
import net.minecraft.core.BlockPos
import net.minecraft.nbt.CompoundTag
@ -7,10 +7,9 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState
import quaedam.projector.Projector
class CTSBlockEntity(pos: BlockPos, state: BlockState) :
BlockEntity(ConstantTemporalSink.blockEntity.get(), pos, state) {
class CABlockEntity(pos: BlockPos, state: BlockState) :
BlockEntity(CausalityAnchor.blockEntity.get(), pos, state) {
override fun getUpdateTag(): CompoundTag = saveWithoutMetadata()

View File

@ -1,4 +1,4 @@
package quaedam.misc.cts
package quaedam.misc.causality
import net.minecraft.core.BlockPos
import net.minecraft.world.item.BlockItem
@ -7,26 +7,26 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.entity.BlockEntityType
import quaedam.Quaedam
object ConstantTemporalSink {
object CausalityAnchor {
const val ID = "cts"
const val ID = "causality_anchor"
val block = Quaedam.blocks.register(ID) { CTSBlock }!!
val block = Quaedam.blocks.register(ID) { CABlock }!!
val item = Quaedam.items.register(ID) {
BlockItem(
CTSBlock, Item.Properties()
CABlock, Item.Properties()
.stacksTo(1)
.`arch$tab`(Quaedam.creativeModeTab)
)
}!!
val blockEntity = Quaedam.blockEntities.register(ID) {
BlockEntityType.Builder.of(::CTSBlockEntity, block.get()).build(null)
BlockEntityType.Builder.of(::CABlockEntity, block.get()).build(null)
}!!
fun checkEffect(level: Level, pos: BlockPos) = level.getChunkAt(pos)
.blockEntities
.any { (_, v) -> v is CTSBlockEntity }
.any { (_, v) -> v is CABlockEntity }
}

View File

@ -26,7 +26,7 @@ import net.minecraft.world.entity.npc.InventoryCarrier
import net.minecraft.world.level.Level
import net.minecraft.world.level.ServerLevelAccessor
import quaedam.Quaedam
import quaedam.misc.cts.ConstantTemporalSink
import quaedam.misc.causality.CausalityAnchor
import quaedam.projection.misc.SoundProjection
import quaedam.projection.swarm.ai.ProjectedPersonAI
import quaedam.projection.swarm.ai.ProjectedPersonNavigation
@ -178,7 +178,7 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
override fun checkDespawn() {
super.checkDespawn()
if (!checkProjectionEffect() && !ConstantTemporalSink.checkEffect(level(), blockPosition())) {
if (!checkProjectionEffect() && !CausalityAnchor.checkEffect(level(), blockPosition())) {
dropEquipment()
remove(RemovalReason.KILLED)
}

View File

@ -4,7 +4,7 @@ import net.minecraft.core.BlockPos
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation
import net.minecraft.world.level.Level
import net.minecraft.world.level.pathfinder.Path
import quaedam.misc.cts.ConstantTemporalSink
import quaedam.misc.causality.CausalityAnchor
import quaedam.projection.swarm.ProjectedPersonEntity
import quaedam.projection.swarm.SwarmProjection
import quaedam.projector.Projector
@ -14,7 +14,7 @@ class ProjectedPersonNavigation(val entity: ProjectedPersonEntity, level: Level)
override fun createPath(set: MutableSet<BlockPos>, i: Int, bl: Boolean, j: Int, f: Float): Path? {
if (set.any {
Projector.findNearbyProjections(level, it, SwarmProjection.effect.get())
.isEmpty() && !ConstantTemporalSink.checkEffect(level, it)
.isEmpty() && !CausalityAnchor.checkEffect(level, it)
}) {
return null
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"facing=east": {
"model": "quaedam:block/causality_anchor",
"y": 270
},
"facing=south": {
"model": "quaedam:block/causality_anchor",
"y": 0
},
"facing=west": {
"model": "quaedam:block/causality_anchor",
"y": 90
},
"facing=north": {
"model": "quaedam:block/causality_anchor",
"y": 180
}
}
}

View File

@ -1,20 +0,0 @@
{
"variants": {
"facing=east": {
"model": "quaedam:block/cts",
"y": 270
},
"facing=south": {
"model": "quaedam:block/cts",
"y": 0
},
"facing=west": {
"model": "quaedam:block/cts",
"y": 90
},
"facing=north": {
"model": "quaedam:block/cts",
"y": 180
}
}
}

View File

@ -5,6 +5,7 @@
"block.quaedam.swarm_projection": "Swarm Projection",
"block.quaedam.sound_projection": "Sound Projection",
"block.quaedam.noise_projection": "Noise Projection",
"block.quaedam.causality_anchor": "Causality Anchor",
"entity.quaedam.projected_person": "Virtual Person",
"item.quaedam.projection_shell": "Projection Shell",
"quaedam.screen.projection_shell": "Projection Shell",

View File

@ -5,6 +5,7 @@
"block.quaedam.swarm_projection": "人群投影",
"block.quaedam.sound_projection": "声音投影",
"block.quaedam.noise_projection": "噪音投影",
"block.quaedam.causality_anchor": "因果锚",
"entity.quaedam.projected_person": "虚拟个体",
"item.quaedam.projection_shell": "投影操作面板",
"quaedam.screen.projection_shell": "投影操作",

View File

@ -5,8 +5,8 @@
64
],
"textures": {
"0": "quaedam:block/cts",
"particle": "quaedam:block/cts"
"0": "quaedam:block/causality_anchor",
"particle": "quaedam:block/causality_anchor"
},
"elements": [
{