Skip to content

Commit

Permalink
Add in code documents.
Browse files Browse the repository at this point in the history
Add reified type in declarations.
Fix bug of crush client when client player interaction to synchronized data in '1.0.0-alpha6'.
Let item can force override mining speed, instead of only use material template.
  • Loading branch information
cao-awa committed Dec 6, 2024
1 parent cd2e298 commit 592bddf
Show file tree
Hide file tree
Showing 32 changed files with 2,220 additions and 569 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/github/cao/awa/conium/Conium.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Conium : ModInitializer {
val isClient: Boolean get() = ConiumClient.initialized

@JvmField
var VERSION = "1.0.0-alpha5-fix1"
var VERSION = "1.0.0-alpha6"

@JvmField
var LANGUAGE_TRANSLATOR_VERSION: String = LanguageTranslator.getVersion()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.github.cao.awa.conium.annotation.bedrock

annotation class BedrockScriptApi
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package com.github.cao.awa.conium.bedrock
package com.github.cao.awa.conium.annotation.bedrock

annotation class BedrockScriptApiFacade(vararg val sapiType: String)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.event

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.event.item.use.BedrockItemUseOnBeforeEvent

@BedrockScriptApi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.event.context.item.use

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.event.context.BedrockEventContext
import com.github.cao.awa.conium.bedrock.item.stack.BedrockItemStack
import com.github.cao.awa.conium.bedrock.item.stack.toBedrock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.event.item.use

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.event.context.BedrockEventContext
import com.github.cao.awa.conium.bedrock.event.context.item.use.BedrockItemUseOnEventContext
import com.github.cao.awa.conium.bedrock.event.context.item.use.toBedrock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.item.stack

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import net.minecraft.item.ItemStack
import net.minecraft.registry.Registries

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.script

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.parameter.DynamicArgType
import com.github.cao.awa.conium.parameter.type.DynamicArgTypeBuilder.arg
import com.github.cao.awa.sinuatum.util.collection.CollectionFactor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.system

import com.github.cao.awa.catheter.receptacle.IntegerReceptacle
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade

@BedrockScriptApiFacade("System")
abstract class AbstractBedrockSystem {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.system

import com.github.cao.awa.catheter.receptacle.IntegerReceptacle
import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.system.task.ConiumTask
import com.github.cao.awa.sinuatum.util.collection.CollectionFactor
import net.minecraft.server.MinecraftServer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.cao.awa.conium.bedrock.world

import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.event.BedrockBeforeEvents
import com.github.cao.awa.conium.bedrock.world.player.delegate.BedrockPlayerDelegate

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.cao.awa.conium.bedrock.world

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.world.player.delegate.BedrockPlayerDelegate
import net.minecraft.world.World

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.world.dimension

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade

@BedrockScriptApi
@BedrockScriptApiFacade("DimensionLocation")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.world.player

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.world.player.screen.BedrockOnScreenDisplay
import net.minecraft.entity.player.PlayerEntity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.world.player.delegate

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.world.player.BedrockPlayer
import com.github.cao.awa.conium.bedrock.world.player.toBedrock
import net.minecraft.world.World
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.cao.awa.conium.bedrock.world.player.screen

import com.github.cao.awa.conium.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApi
import com.github.cao.awa.conium.annotation.bedrock.BedrockScriptApiFacade
import com.github.cao.awa.conium.bedrock.script.BedrockScriptAnonymousObjectMap
import com.github.cao.awa.conium.bedrock.world.player.BedrockPlayer
import com.github.cao.awa.conium.bedrock.world.player.screen.title.BedrockScreenDisplayTitle
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/github/cao/awa/conium/block/ConiumBlock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class ConiumBlock(private val setting: ConiumBlockSettings) : Block(setting.vani
fun create(builder: ConiumBlockBuilder, settings: ConiumBlockSettings): ConiumBlock {
builder.templates.forEach { it.prepare(settings) }

return ConiumBlock(settings).also { block: ConiumBlock ->
builder.templates.forEach { it.attach(block) }
return ConiumBlock(settings).apply {
builder.templates.forEach { it.attach(this) }

builder.templates.forEach { it.complete(block) }
builder.templates.forEach { it.complete(this) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ConiumShulkerBoxOpeningEvent : ConiumEvent<ParameterSelective5<Boolean, Wo
ConiumEventType.USE_BLOCK,
ConiumEventArgTypes.BLOCK_POS,
ConiumEventArgTypes.PLAYER,
ConiumEventArgTypes.BLOCK_ENTITY,
ConiumEventArgTypes.BLOCK_ENTITY
) { block: Block, pos: BlockPos, player: PlayerEntity, blockEntity: BlockEntity ->
if (blockEntity is ShulkerBoxBlockEntity && blockEntity.world != null && !blockEntity.isRemoved && block == blockEntity.cachedState.block) {
// Request the opening shulker box context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ class ConiumItemManager(
)

if (json["schema_style"]?.asString == "conium") {
ConiumSchemaItemBuilder.deserialize(json, this.registryLookup).register {
// TODO enchanting
}
ConiumSchemaItemBuilder.deserialize(json, this.registryLookup).register()
} else {
BedrockSchemaItemBuilder.deserialize(json, this.registryLookup).register()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ConiumEventContext<P : ParameterSelective?>(
private val args: MutableMap<DynamicArgType<*>, Any?> = CollectionFactor.hashMap()
private val attaches: MutableList<ConiumEventContext<*>> = CollectionFactor.arrayList()
private val attachesDynamic: MutableList<P> = CollectionFactor.arrayList()
private var lastIdentity: Any? = null

private var targetedIdentity: ParameterSelective1<Boolean, Any> = ParameterSelective1 { true }

Expand Down Expand Up @@ -112,8 +111,6 @@ class ConiumEventContext<P : ParameterSelective?>(
return true
}

this.lastIdentity = identity

var success: Boolean = this.presageTrigger == null || this.dynamicArgs.arising(identity, this.args, this.presageTrigger!!)
for (attach: ConiumEventContext<*> in this.attaches) {
if (attach.hasPresaging()) {
Expand All @@ -132,8 +129,6 @@ class ConiumEventContext<P : ParameterSelective?>(
return true
}

this.lastIdentity = identity

var success: Boolean = this.ariseTrigger == null || this.dynamicArgs.arising(identity, this.args, this.ariseTrigger!!)
for (attach: ConiumEventContext<*> in this.attaches) {
if (attach.hasArising()) {
Expand All @@ -152,7 +147,6 @@ class ConiumEventContext<P : ParameterSelective?>(
}

fun inherit(context: ConiumEventContext<*>): ConiumEventContext<P> {
this.lastIdentity = context.lastIdentity
return resetArgs(context.args)
}
}
Loading

0 comments on commit 592bddf

Please sign in to comment.