Compare commits
4 Commits
fdfc406ca6
...
ddcfe11780
Author | SHA1 | Date | |
---|---|---|---|
ddcfe11780 | |||
6226621b95 | |||
1bb612b07c | |||
588b9c1b7c |
@ -103,6 +103,8 @@ object OverdriveThatMatters {
|
||||
fun loc(path: String): ResourceLocation = ResourceLocation.fromNamespaceAndPath(MOD_ID, path)
|
||||
|
||||
init {
|
||||
MBuiltInRegistries.register(MOD_BUS)
|
||||
|
||||
MBlocks.register(MOD_BUS)
|
||||
MFluids.register(MOD_BUS)
|
||||
MBlockEntities.register(MOD_BUS)
|
||||
@ -133,9 +135,7 @@ object OverdriveThatMatters {
|
||||
MOD_BUS.addListener(::registerNetworkPackets)
|
||||
|
||||
DecimalProvider.register(MOD_BUS)
|
||||
AndroidResearchDescription.register(MOD_BUS)
|
||||
AndroidResearchDescriptions.register(MOD_BUS)
|
||||
AndroidResearchResult.register(MOD_BUS)
|
||||
AndroidResearchResults.register(MOD_BUS)
|
||||
|
||||
AbstractRegistryAction.register(MOD_BUS)
|
||||
|
@ -7,12 +7,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.util.RandomSource
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.math.nextDecimal
|
||||
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
|
||||
fun interface SampledDecimal {
|
||||
fun sample(source: RandomSource): Decimal
|
||||
@ -28,33 +28,25 @@ abstract class DecimalProvider : SampledDecimal {
|
||||
abstract val type: Type<*>
|
||||
|
||||
companion object {
|
||||
private val registryHolder = RegistryDelegate<Type<*>>("decimal_provider_type") {
|
||||
defaultKey(ResourceLocation(OverdriveThatMatters.MOD_ID, "zero"))
|
||||
}
|
||||
|
||||
val CODEC: Codec<DecimalProvider> by lazy {
|
||||
Codec
|
||||
.either(DecimalCodec, registry.byNameCodec().dispatch({ it.type }, { it.codec }))
|
||||
.either(DecimalCodec, MBuiltInRegistries.DECIMAL_PROVIDER_TYPE.byNameCodec().dispatch({ it.type }, { it.codec }))
|
||||
.xmap(
|
||||
{ c -> c.map(::ConstantDecimal, { it }) },
|
||||
{ if (it.type === ConstantDecimal) Either.left(it.minValue) else Either.right(it) }
|
||||
)
|
||||
}
|
||||
|
||||
val registry by registryHolder
|
||||
val registryKey get() = registryHolder.key
|
||||
|
||||
private val registror = MDeferredRegister(registryKey, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.DECIMAL_PROVIDER_TYPE, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registror.register("zero") { ConstantDecimal.Zero }
|
||||
registror.register("constant") { ConstantDecimal }
|
||||
registror.register("uniform") { UniformDecimal }
|
||||
registrar.register("zero") { ConstantDecimal.Zero }
|
||||
registrar.register("constant") { ConstantDecimal }
|
||||
registrar.register("uniform") { UniformDecimal }
|
||||
}
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
bus.addListener(registryHolder::build)
|
||||
registror.register(bus)
|
||||
registrar.register(bus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,9 @@ import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.Item
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractRegistryAction(
|
||||
@ -99,12 +100,7 @@ abstract class AbstractRegistryAction(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val registryDelegate = RegistryDelegate<Type<*>>("matter_registry_action") { sync(false) }
|
||||
|
||||
val registryKey get() = registryDelegate.key
|
||||
val registry by registryDelegate
|
||||
|
||||
private val registrar = MDeferredRegister(registryKey, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.MATTER_REGISTRY_ACTION, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registrar.register("insert") { InsertAction.Companion }
|
||||
@ -116,11 +112,10 @@ abstract class AbstractRegistryAction(
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
registrar.register(bus)
|
||||
bus.addListener(registryDelegate::build)
|
||||
}
|
||||
|
||||
val CODEC: Codec<AbstractRegistryAction> by lazy {
|
||||
registry.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
MBuiltInRegistries.MATTER_REGISTRY_ACTION.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import net.minecraft.world.item.Item
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
|
||||
import ru.dbotthepony.mc.otm.data.codec.PredicatedCodecList
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import java.util.Optional
|
||||
import java.util.function.Predicate
|
||||
|
||||
@ -29,8 +30,8 @@ class ComputeAction(
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("matter").forGetter(Constant::matter),
|
||||
Codec.DOUBLE.fieldOf("complexity").forGetter(Constant::complexity),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
).apply(it, ::Constant)
|
||||
} to Predicate { true }
|
||||
}
|
||||
@ -40,7 +41,7 @@ class ComputeAction(
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("matter").forGetter(Constant::matter),
|
||||
Codec.DOUBLE.fieldOf("complexity").forGetter(Constant::complexity),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
).apply(it) { a, b, c -> Constant(a, b, c, c) }
|
||||
} to Predicate { it.matterFunction == it.complexityFunction }
|
||||
}
|
||||
@ -49,8 +50,8 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("value").forGetter(Constant::matter),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
).apply(it) { a, b, c -> Constant(a, a.toDouble(), b, c) }
|
||||
} to Predicate { it.matter == Decimal(it.complexity.toString()) }
|
||||
}
|
||||
@ -59,7 +60,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("value").forGetter(Constant::matter),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
).apply(it) { a, b -> Constant(a, a.toDouble(), b, b) }
|
||||
} to Predicate { it.matter == Decimal(it.complexity.toString()) && it.matterFunction == it.complexityFunction }
|
||||
}
|
||||
@ -68,7 +69,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
Codec.DOUBLE.fieldOf("complexity").forGetter(Constant::complexity),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("function").forGetter(Constant::complexityFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("function").forGetter(Constant::complexityFunction),
|
||||
).apply(it) { a, b -> Constant(Decimal.ZERO, a.toDouble(), IMatterFunction.NOOP, b) }
|
||||
} to Predicate { it.matterFunction == IMatterFunction.NOOP }
|
||||
}
|
||||
@ -77,7 +78,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
Codec.DOUBLE.fieldOf("complexity").forGetter(Constant::complexity),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("complexityFunction").forGetter(Constant::complexityFunction),
|
||||
).apply(it) { a, b -> Constant(Decimal.ZERO, a.toDouble(), IMatterFunction.NOOP, b) }
|
||||
} to Predicate { it.matterFunction == IMatterFunction.NOOP }
|
||||
}
|
||||
@ -86,7 +87,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("matter").forGetter(Constant::matter),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("function").forGetter(Constant::matterFunction),
|
||||
).apply(it) { a, b -> Constant(a, 0.0, b, IMatterFunction.NOOP) }
|
||||
} to Predicate { it.complexityFunction == IMatterFunction.NOOP }
|
||||
}
|
||||
@ -95,7 +96,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create<Constant> {
|
||||
it.group(
|
||||
DecimalCodec.fieldOf("matter").forGetter(Constant::matter),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("matterFunction").forGetter(Constant::matterFunction),
|
||||
).apply(it) { a, b -> Constant(a, 0.0, b, IMatterFunction.NOOP) }
|
||||
} to Predicate { it.complexityFunction == IMatterFunction.NOOP }
|
||||
}
|
||||
@ -182,7 +183,7 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create {
|
||||
it.group(
|
||||
TargetCodec.fieldOf("id").forGetter(Value::id),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("function").forGetter(Value::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("function").forGetter(Value::matterFunction),
|
||||
).apply(it, ::Value)
|
||||
}
|
||||
}
|
||||
@ -191,8 +192,8 @@ class ComputeAction(
|
||||
RecordCodecBuilder.create {
|
||||
it.group(
|
||||
TargetCodec.fieldOf("id").forGetter(Value::id),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("matterFunction").forGetter(Value::matterFunction),
|
||||
IMatterFunction.registry.byNameCodec().fieldOf("complexityFunction").forGetter(Value::complexityFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("matterFunction").forGetter(Value::matterFunction),
|
||||
MBuiltInRegistries.MATTER_FUNCTION.byNameCodec().fieldOf("complexityFunction").forGetter(Value::complexityFunction),
|
||||
).apply(it, ::Value)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import ru.dbotthepony.mc.otm.matter.SimpleMatterFunction.DecimalFunction
|
||||
import ru.dbotthepony.mc.otm.matter.SimpleMatterFunction.DoubleFunction
|
||||
import ru.dbotthepony.mc.otm.matter.SimpleMatterFunction.IntFunction
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
|
||||
interface IMatterFunction {
|
||||
fun updateValue(self: Int, other: Int): Int
|
||||
@ -15,12 +15,7 @@ interface IMatterFunction {
|
||||
fun updateValue(self: Double, other: Double): Double
|
||||
|
||||
companion object : IMatterFunction {
|
||||
private val registryDelegate = RegistryDelegate<IMatterFunction>("matter_function") { sync(false) }
|
||||
|
||||
val registryKey get() = registryDelegate.key
|
||||
val registry by registryDelegate
|
||||
|
||||
private val registrar = MDeferredRegister(registryKey, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.MATTER_FUNCTION, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registrar.register("noop") { this }
|
||||
@ -38,7 +33,6 @@ interface IMatterFunction {
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
registrar.register(bus)
|
||||
bus.addListener(registryDelegate::build)
|
||||
}
|
||||
|
||||
override fun updateValue(self: Int, other: Int): Int {
|
||||
|
@ -102,8 +102,9 @@ import ru.dbotthepony.mc.otm.core.writeItemType
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager.Finder
|
||||
import ru.dbotthepony.mc.otm.milliTime
|
||||
import ru.dbotthepony.mc.otm.onceServer
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
import ru.dbotthepony.mc.otm.secondTime
|
||||
import ru.dbotthepony.mc.otm.storage.ItemStorageStack
|
||||
import ru.dbotthepony.mc.otm.storage.StorageStack
|
||||
@ -397,12 +398,10 @@ object MatterManager {
|
||||
}
|
||||
|
||||
private object Resolver : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(), FINDER_DIRECTORY) {
|
||||
val delegate = RegistryDelegate<Finder>("recipe_finder") { sync(false) }
|
||||
|
||||
var ready = false
|
||||
private set
|
||||
|
||||
val registrar = MDeferredRegister(delegate.key, OverdriveThatMatters.MOD_ID)
|
||||
val registrar = MDeferredRegister(MRegistries.RECIPE_FINDER, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registrar.register("simple") {
|
||||
@ -639,11 +638,11 @@ object MatterManager {
|
||||
|
||||
val location = (json["type"] ?: throw JsonSyntaxException("Missing resolver type")).let { ResourceLocation.tryParse(it.asString) } ?: throw JsonSyntaxException("Invalid resolver type: ${json["type"]}")
|
||||
|
||||
if (!recipeFinders.containsKey(location)) {
|
||||
if (!MBuiltInRegistries.RECIPE_FINDER.containsKey(location)) {
|
||||
throw JsonParseException("Resolver type $location does not exist (in $key)")
|
||||
}
|
||||
|
||||
val resolver = recipeFinders.get(location) ?: throw ConcurrentModificationException()
|
||||
val resolver = MBuiltInRegistries.RECIPE_FINDER.get(location) ?: throw ConcurrentModificationException()
|
||||
builder.put(key, resolver to json)
|
||||
}
|
||||
|
||||
@ -1495,20 +1494,6 @@ object MatterManager {
|
||||
return Registry.direct(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Access recipe finders registry
|
||||
*
|
||||
* @throws IllegalStateException if calling too early
|
||||
*/
|
||||
@JvmStatic val recipeFinders get() = Resolver.delegate.get()
|
||||
|
||||
/**
|
||||
* Access recipe finders registry key
|
||||
*
|
||||
* Use this with your [DeferredRegister]
|
||||
*/
|
||||
@JvmStatic val recipeFindersKey get() = Resolver.delegate.key
|
||||
|
||||
private val commentary = Reference2ObjectOpenHashMap<Item, ArrayList<Component>>()
|
||||
|
||||
@JvmStatic
|
||||
@ -1533,7 +1518,6 @@ object MatterManager {
|
||||
}
|
||||
|
||||
internal fun initialize(bus: IEventBus) {
|
||||
bus.addListener(Resolver.delegate::build)
|
||||
Resolver.registrar.register(bus)
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import net.minecraft.world.item.Item
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.data.codec.DecimalCodec
|
||||
import ru.dbotthepony.mc.otm.data.codec.simpleCodec
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
|
||||
class UpdateAction(
|
||||
id: Either<ResourceLocation, TagKey<Item>>,
|
||||
@ -22,7 +23,7 @@ class UpdateAction(
|
||||
data class MatterFunction(val function: IMatterFunction, val value: Decimal) {
|
||||
companion object {
|
||||
val CODEC: Codec<MatterFunction> by lazy {
|
||||
simpleCodec(::MatterFunction, MatterFunction::function, IMatterFunction.registry.byNameCodec(), MatterFunction::value, DecimalCodec)
|
||||
simpleCodec(::MatterFunction, MatterFunction::function, MBuiltInRegistries.MATTER_FUNCTION.byNameCodec(), MatterFunction::value, DecimalCodec)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -30,7 +31,7 @@ class UpdateAction(
|
||||
data class ComplexityFunction(val function: IMatterFunction, val value: Double) {
|
||||
companion object {
|
||||
val CODEC: Codec<ComplexityFunction> by lazy {
|
||||
simpleCodec(::ComplexityFunction, ComplexityFunction::function, IMatterFunction.registry.byNameCodec(), ComplexityFunction::value, Codec.DOUBLE)
|
||||
simpleCodec(::ComplexityFunction, ComplexityFunction::function, MBuiltInRegistries.MATTER_FUNCTION.byNameCodec(), ComplexityFunction::value, Codec.DOUBLE)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,7 +39,7 @@ class UpdateAction(
|
||||
data class PriorityFunction(val function: IMatterFunction, val value: Int) {
|
||||
companion object {
|
||||
val CODEC: Codec<PriorityFunction> by lazy {
|
||||
simpleCodec(::PriorityFunction, PriorityFunction::function, IMatterFunction.registry.byNameCodec(), PriorityFunction::value, Codec.INT)
|
||||
simpleCodec(::PriorityFunction, PriorityFunction::function, MBuiltInRegistries.MATTER_FUNCTION.byNameCodec(), PriorityFunction::value, Codec.INT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,14 @@ import ru.dbotthepony.mc.otm.core.readComponent
|
||||
import ru.dbotthepony.mc.otm.core.writeComponent
|
||||
import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu
|
||||
import ru.dbotthepony.mc.otm.onceServer
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
|
||||
|
||||
class AndroidFeatureSyncPacket(val type: AndroidFeatureType<*>, val data: ByteArrayList) : CustomPacketPayload {
|
||||
fun write(buff: RegistryFriendlyByteBuf) {
|
||||
buff.writeInt(MRegistry.ANDROID_FEATURES.getId(type))
|
||||
buff.writeInt(MBuiltInRegistries.ANDROID_FEATURE.getId(type))
|
||||
buff.writeBytes(data.elements(), 0, data.size)
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ class AndroidFeatureSyncPacket(val type: AndroidFeatureType<*>, val data: ByteAr
|
||||
|
||||
fun read(buff: RegistryFriendlyByteBuf): AndroidFeatureSyncPacket {
|
||||
return AndroidFeatureSyncPacket(
|
||||
MRegistry.ANDROID_FEATURES.byIdOrThrow(buff.readInt()),
|
||||
MBuiltInRegistries.ANDROID_FEATURE.byIdOrThrow(buff.readInt()),
|
||||
ByteArrayList.wrap(ByteArray(buff.readableBytes()).also { buff.readBytes(it) })
|
||||
)
|
||||
}
|
||||
@ -140,7 +141,7 @@ class AndroidResearchRequestPacket(val type: AndroidResearchType) : CustomPacket
|
||||
|
||||
class AndroidFeatureRemovePacket(val type: AndroidFeatureType<*>) : CustomPacketPayload {
|
||||
fun write(buff: FriendlyByteBuf) {
|
||||
buff.writeInt(MRegistry.ANDROID_FEATURES.getId(type))
|
||||
buff.writeInt(MBuiltInRegistries.ANDROID_FEATURE.getId(type))
|
||||
}
|
||||
|
||||
fun play(context: IPayloadContext) {
|
||||
@ -164,7 +165,7 @@ class AndroidFeatureRemovePacket(val type: AndroidFeatureType<*>) : CustomPacket
|
||||
StreamCodec.ofMember(AndroidFeatureRemovePacket::write, ::read)
|
||||
|
||||
fun read(buff: FriendlyByteBuf): AndroidFeatureRemovePacket {
|
||||
return AndroidFeatureRemovePacket(MRegistry.ANDROID_FEATURES.byIdOrThrow(buff.readInt()))
|
||||
return AndroidFeatureRemovePacket(MBuiltInRegistries.ANDROID_FEATURE.byIdOrThrow(buff.readInt()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -219,7 +220,7 @@ class PlayerIterationPacket(val iteration: Int, val deathLog: List<Pair<Int, Com
|
||||
|
||||
class SwitchAndroidFeaturePacket(val type: AndroidFeatureType<*>, val newState: Boolean) : CustomPacketPayload {
|
||||
fun write(buff: FriendlyByteBuf) {
|
||||
buff.writeInt(MRegistry.ANDROID_FEATURES.getId(type))
|
||||
buff.writeInt(MBuiltInRegistries.ANDROID_FEATURE.getId(type))
|
||||
buff.writeBoolean(newState)
|
||||
}
|
||||
|
||||
@ -259,14 +260,14 @@ class SwitchAndroidFeaturePacket(val type: AndroidFeatureType<*>, val newState:
|
||||
StreamCodec.ofMember(SwitchAndroidFeaturePacket::write, ::read)
|
||||
|
||||
fun read(buff: FriendlyByteBuf): SwitchAndroidFeaturePacket {
|
||||
return SwitchAndroidFeaturePacket(MRegistry.ANDROID_FEATURES.byIdOrThrow(buff.readInt()), buff.readBoolean())
|
||||
return SwitchAndroidFeaturePacket(MBuiltInRegistries.ANDROID_FEATURE.byIdOrThrow(buff.readInt()), buff.readBoolean())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ActivateAndroidFeaturePacket(val type: AndroidFeatureType<*>) : CustomPacketPayload {
|
||||
fun write(buff: FriendlyByteBuf) {
|
||||
buff.writeInt(MRegistry.ANDROID_FEATURES.getId(type))
|
||||
buff.writeInt(MBuiltInRegistries.ANDROID_FEATURE.getId(type))
|
||||
}
|
||||
|
||||
fun play(context: IPayloadContext) {
|
||||
@ -298,7 +299,7 @@ class ActivateAndroidFeaturePacket(val type: AndroidFeatureType<*>) : CustomPack
|
||||
StreamCodec.ofMember(ActivateAndroidFeaturePacket::write, ::read)
|
||||
|
||||
fun read(buff: FriendlyByteBuf): ActivateAndroidFeaturePacket {
|
||||
return ActivateAndroidFeaturePacket(MRegistry.ANDROID_FEATURES.byIdOrThrow(buff.readInt()))
|
||||
return ActivateAndroidFeaturePacket(MBuiltInRegistries.ANDROID_FEATURE.byIdOrThrow(buff.readInt()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu
|
||||
import ru.dbotthepony.mc.otm.menu.IItemStackSortingSettings
|
||||
import ru.dbotthepony.mc.otm.network.*
|
||||
import ru.dbotthepony.mc.otm.network.SmokeParticlesPacket.Companion.makeSmoke
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.game.MItems
|
||||
@ -1004,7 +1005,7 @@ class MatteryPlayer(val ply: Player) {
|
||||
research.clear()
|
||||
|
||||
for (featureTag in tag.getCompoundList("features")) {
|
||||
val feature = MRegistry.ANDROID_FEATURES.get(ResourceLocation.parse(featureTag.getString("id")))
|
||||
val feature = MBuiltInRegistries.ANDROID_FEATURE.get(ResourceLocation.parse(featureTag.getString("id")))
|
||||
|
||||
if (feature?.isApplicable(this) == true) {
|
||||
val instance = feature.create(this)
|
||||
|
@ -6,6 +6,7 @@ import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.network.chat.contents.TranslatableContents
|
||||
import ru.dbotthepony.mc.otm.player.MatteryPlayer
|
||||
import ru.dbotthepony.mc.otm.core.getKeyNullable
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
|
||||
open class AndroidFeatureType<T : AndroidFeature> {
|
||||
@ -26,7 +27,7 @@ open class AndroidFeatureType<T : AndroidFeature> {
|
||||
open fun isApplicable(android: MatteryPlayer) = true
|
||||
|
||||
val registryName by lazy {
|
||||
MRegistry.ANDROID_FEATURES.getKeyNullable(this)
|
||||
MBuiltInRegistries.ANDROID_FEATURE.getKeyNullable(this)
|
||||
}
|
||||
|
||||
open val displayContents: ComponentContents by lazy {
|
||||
|
@ -13,11 +13,12 @@ import ru.dbotthepony.mc.otm.config.PlayerConfig
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.util.formatPower
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
|
||||
object AndroidResearchDescriptions {
|
||||
private val registrar = MDeferredRegister(AndroidResearchDescription.registryKey, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.ANDROID_RESEARCH_DESCRIPTION, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registrar.register("plain") { PlainAndroidResearchDescription }
|
||||
@ -140,17 +141,8 @@ interface AndroidResearchDescription {
|
||||
val type: Type<*>
|
||||
|
||||
companion object {
|
||||
private val delegate = RegistryDelegate<Type<*>>("android_research_description") {}
|
||||
|
||||
val registry by delegate
|
||||
val registryKey get() = delegate.key
|
||||
|
||||
val CODEC: Codec<AndroidResearchDescription> by lazy {
|
||||
registry.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
}
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
bus.addListener(delegate::build)
|
||||
MBuiltInRegistries.ANDROID_RESEARCH_DESCRIPTION.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
}
|
||||
|
||||
fun singleton(callback: (research: AndroidResearch) -> Component): Singleton {
|
||||
|
@ -7,13 +7,14 @@ import net.minecraft.resources.ResourceLocation
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
|
||||
object AndroidResearchResults {
|
||||
private val registrar = MDeferredRegister(AndroidResearchResult.registryKey, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.ANDROID_RESEARCH_RESULT, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
init {
|
||||
registrar.register("feature") { AndroidResearchResult.Feature }
|
||||
@ -71,7 +72,7 @@ interface AndroidResearchResult {
|
||||
* Adds specific android feature [id] to target, does nothing if target already has specified feature
|
||||
*/
|
||||
class Feature(val id: ResourceLocation, val optional: Boolean = false) : AndroidResearchResult {
|
||||
val feature = MRegistry.ANDROID_FEATURES.get(id) ?: if (optional) null else throw NoSuchElementException("Unknown android feature $id")
|
||||
val feature = MBuiltInRegistries.ANDROID_FEATURE.get(id) ?: if (optional) null else throw NoSuchElementException("Unknown android feature $id")
|
||||
|
||||
override val type: Type<*>
|
||||
get() = Companion
|
||||
@ -101,7 +102,7 @@ interface AndroidResearchResult {
|
||||
*/
|
||||
class FeatureLevel(val id: ResourceLocation, val optional: Boolean = false, val levels: Int = 1) :
|
||||
AndroidResearchResult {
|
||||
val feature = MRegistry.ANDROID_FEATURES.get(id) ?: if (optional) null else throw NoSuchElementException("Unknown android feature $id")
|
||||
val feature = MBuiltInRegistries.ANDROID_FEATURE.get(id) ?: if (optional) null else throw NoSuchElementException("Unknown android feature $id")
|
||||
|
||||
override val type: Type<*>
|
||||
get() = Companion
|
||||
@ -153,17 +154,9 @@ interface AndroidResearchResult {
|
||||
|
||||
companion object {
|
||||
private val LOGGER = LogManager.getLogger()
|
||||
private val delegate = RegistryDelegate<Type<*>>("android_research_result") {}
|
||||
|
||||
val registry by delegate
|
||||
val registryKey get() = delegate.key
|
||||
|
||||
val CODEC: Codec<AndroidResearchResult> by lazy {
|
||||
registry.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
}
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
bus.addListener(delegate::build)
|
||||
MBuiltInRegistries.ANDROID_RESEARCH_RESULT.byNameCodec().dispatch({ it.type }, { it.codec })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import net.neoforged.neoforge.registries.NewRegistryEvent
|
||||
import net.neoforged.neoforge.registries.RegistryBuilder
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object MBuiltInRegistries {
|
||||
private val delegates = ArrayList<Delegate<*>>()
|
||||
|
||||
private class Delegate<T : Any>(private val key: ResourceKey<Registry<T>>, private val configurator: RegistryBuilder<T>.() -> Unit = {}) {
|
||||
init {
|
||||
delegates.add(this)
|
||||
}
|
||||
|
||||
private var _value: Registry<T>? = null
|
||||
|
||||
operator fun getValue(thisRef: Any, property: KProperty<*>): Registry<T> {
|
||||
return _value ?: throw IllegalStateException("Tried to access uninitialized registry ${key.location()}")
|
||||
}
|
||||
|
||||
fun build(event: NewRegistryEvent) {
|
||||
if (_value != null) {
|
||||
throw IllegalStateException("Already created registry ${key.location()}!")
|
||||
}
|
||||
|
||||
_value = RegistryBuilder(key).let {
|
||||
configurator.invoke(it)
|
||||
event.create(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val DECIMAL_PROVIDER_TYPE by Delegate(MRegistries.DECIMAL_PROVIDER_TYPE) {
|
||||
defaultKey(ResourceLocation(OverdriveThatMatters.MOD_ID, "zero"))
|
||||
}
|
||||
|
||||
val MATTER_REGISTRY_ACTION by Delegate(MRegistries.MATTER_REGISTRY_ACTION)
|
||||
|
||||
val MATTER_FUNCTION by Delegate(MRegistries.MATTER_FUNCTION) {
|
||||
defaultKey(ResourceLocation(OverdriveThatMatters.MOD_ID, "noop"))
|
||||
}
|
||||
|
||||
val RECIPE_FINDER by Delegate(MRegistries.RECIPE_FINDER)
|
||||
val ANDROID_RESEARCH_DESCRIPTION by Delegate(MRegistries.ANDROID_RESEARCH_DESCRIPTION)
|
||||
val ANDROID_RESEARCH_RESULT by Delegate(MRegistries.ANDROID_RESEARCH_RESULT)
|
||||
val ANDROID_FEATURE by Delegate(MRegistries.ANDROID_FEATURE) { sync(true) }
|
||||
val STACK_TYPE by Delegate(MRegistries.STACK_TYPE)
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
delegates.forEach { bus.addListener(it::build) }
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import ru.dbotthepony.mc.otm.data.world.DecimalProvider
|
||||
import ru.dbotthepony.mc.otm.matter.AbstractRegistryAction
|
||||
import ru.dbotthepony.mc.otm.matter.IMatterFunction
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager
|
||||
import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType
|
||||
import ru.dbotthepony.mc.otm.player.android.AndroidResearchDescription
|
||||
import ru.dbotthepony.mc.otm.player.android.AndroidResearchResult
|
||||
import ru.dbotthepony.mc.otm.storage.StorageStack
|
||||
|
||||
object MRegistries {
|
||||
private fun <T> k(name: String): ResourceKey<Registry<T>> {
|
||||
return ResourceKey.createRegistryKey(ResourceLocation(OverdriveThatMatters.MOD_ID, name))
|
||||
}
|
||||
|
||||
val DECIMAL_PROVIDER_TYPE = k<DecimalProvider.Type<*>>("decimal_provider_type")
|
||||
val MATTER_REGISTRY_ACTION = k<AbstractRegistryAction.Type<*>>("matter_registry_action")
|
||||
val MATTER_FUNCTION = k<IMatterFunction>("matter_function")
|
||||
val RECIPE_FINDER = k<MatterManager.Finder>("recipe_finder")
|
||||
val ANDROID_RESEARCH_DESCRIPTION = k<AndroidResearchDescription.Type<*>>("android_research_description")
|
||||
val ANDROID_RESEARCH_RESULT = k<AndroidResearchResult.Type<*>>("android_research_result")
|
||||
val ANDROID_FEATURE = k<AndroidFeatureType<*>>("android_feature")
|
||||
val STACK_TYPE = k<StorageStack.Type<*>>("stack_type")
|
||||
}
|
@ -53,11 +53,6 @@ import ru.dbotthepony.mc.otm.registry.objects.IBlockItemRegistryAcceptor
|
||||
import ru.dbotthepony.mc.otm.registry.objects.StripedColoredDecorativeBlock
|
||||
|
||||
object MRegistry : IBlockItemRegistryAcceptor {
|
||||
private val features = RegistryDelegate<AndroidFeatureType<*>>("android_features") { sync(true) }
|
||||
val ANDROID_FEATURES by features
|
||||
val ANDROID_FEATURES_LOCATION get() = features.location
|
||||
val ANDROID_FEATURES_KEY get() = features.key
|
||||
|
||||
val DYE_ORDER: ImmutableList<DyeColor> = ImmutableList.of(
|
||||
DyeColor.BLACK,
|
||||
DyeColor.BLUE,
|
||||
@ -251,7 +246,6 @@ object MRegistry : IBlockItemRegistryAcceptor {
|
||||
}
|
||||
|
||||
internal fun initialize(bus: IEventBus) {
|
||||
bus.addListener(features::build)
|
||||
bus.addListener(this::initializeClient)
|
||||
bus.addListener(this::initializeCommon)
|
||||
bus.addListener(MStats::registerVanilla)
|
||||
|
@ -1,45 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.neoforged.neoforge.registries.NewRegistryEvent
|
||||
import net.neoforged.neoforge.registries.RegistryBuilder
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import java.util.function.Supplier
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class RegistryDelegate<T>(key: String, private val configurator: RegistryBuilder<T>.() -> Unit = {}) : ReadOnlyProperty<Any, Registry<T>>, Supplier<Registry<T>>, Lazy<Registry<T>> {
|
||||
private var _value: Registry<T>? = null
|
||||
|
||||
override val value: Registry<T>
|
||||
get() = get()
|
||||
|
||||
override fun isInitialized(): Boolean {
|
||||
return _value != null
|
||||
}
|
||||
|
||||
val location = ResourceLocation(OverdriveThatMatters.MOD_ID, key)
|
||||
val key: ResourceKey<Registry<T>> = ResourceKey.createRegistryKey(location)
|
||||
|
||||
override fun get(): Registry<T> {
|
||||
val value = _value ?: throw IllegalStateException("Tried to access uninitialized registry $location")
|
||||
return value
|
||||
}
|
||||
|
||||
override fun getValue(thisRef: Any, property: KProperty<*>): Registry<T> {
|
||||
return get()
|
||||
}
|
||||
|
||||
fun build(event: NewRegistryEvent) {
|
||||
if (_value != null) {
|
||||
throw IllegalStateException("Already built registry $location!")
|
||||
}
|
||||
|
||||
_value = RegistryBuilder(key).let {
|
||||
configurator.invoke(it)
|
||||
event.create(it)
|
||||
}
|
||||
}
|
||||
}
|
@ -18,10 +18,11 @@ import ru.dbotthepony.mc.otm.player.android.feature.StepAssistFeature
|
||||
import ru.dbotthepony.mc.otm.player.android.feature.SwimBoostersFeature
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.MNames
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
|
||||
object AndroidFeatures {
|
||||
private val registry = MDeferredRegister(MRegistry.ANDROID_FEATURES_KEY)
|
||||
private val registry = MDeferredRegister(MRegistries.ANDROID_FEATURE)
|
||||
|
||||
val AIR_BAGS by registry.register(MNames.AIR_BAGS) { AndroidFeatureType(::DummyAndroidFeature) }
|
||||
val STEP_ASSIST by registry.register(MNames.STEP_ASSIST) { AndroidFeatureType(::StepAssistFeature) }
|
||||
|
@ -5,14 +5,13 @@ import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.getValue
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.readBigInteger
|
||||
import ru.dbotthepony.mc.otm.core.readItem
|
||||
import ru.dbotthepony.mc.otm.core.writeBigInteger
|
||||
import ru.dbotthepony.mc.otm.core.writeItem
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistries
|
||||
import java.math.BigInteger
|
||||
|
||||
abstract class StorageStack<S : StorageStack<S>>(val count: BigInteger) {
|
||||
@ -110,11 +109,7 @@ abstract class StorageStack<S : StorageStack<S>>(val count: BigInteger) {
|
||||
return o?.hashCodeWithoutCount() ?: 0
|
||||
}
|
||||
|
||||
private val delegate = RegistryDelegate<Type<*>>("stack_type") {}
|
||||
val REGISTRY by delegate
|
||||
val REGISTRY_KEY by delegate::key
|
||||
|
||||
private val registrar = MDeferredRegister(REGISTRY_KEY, OverdriveThatMatters.MOD_ID)
|
||||
private val registrar = MDeferredRegister(MRegistries.STACK_TYPE, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
val ITEMS: Type<ItemStorageStack> by registrar.register("items") {
|
||||
SimpleType(
|
||||
@ -131,7 +126,6 @@ abstract class StorageStack<S : StorageStack<S>>(val count: BigInteger) {
|
||||
}
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
bus.addListener(delegate::build)
|
||||
registrar.register(bus)
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.player.MatteryPlayer
|
||||
import ru.dbotthepony.mc.otm.player.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.core.ResourceLocation
|
||||
import ru.dbotthepony.mc.otm.data.codec.SingletonCodec
|
||||
import ru.dbotthepony.mc.otm.registry.MBuiltInRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import java.util.Optional
|
||||
import java.util.function.Predicate
|
||||
@ -76,7 +77,7 @@ object KillAsAndroidTrigger : MCriterionTrigger<KillAsAndroidTrigger.Instance>(R
|
||||
}
|
||||
|
||||
class Has(val name: ResourceLocation) : FeaturePredicate() {
|
||||
private val resolved by lazy { MRegistry.ANDROID_FEATURES.get(name) }
|
||||
private val resolved by lazy { MBuiltInRegistries.ANDROID_FEATURE.get(name) }
|
||||
|
||||
override val type: PredicateType
|
||||
get() = PredicateType.HAS
|
||||
|
@ -18,7 +18,7 @@ function initializeCoreMod() {
|
||||
if (insn.getOpcode() == Opcodes.BIPUSH) {
|
||||
node.instructions.insert(insn, new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
'ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature',
|
||||
'ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature',
|
||||
'getBrushCooldown',
|
||||
'(Lnet/minecraft/world/entity/LivingEntity;)I'
|
||||
))
|
||||
@ -31,7 +31,7 @@ function initializeCoreMod() {
|
||||
if (insn.getOpcode() == Opcodes.ICONST_5) {
|
||||
node.instructions.insert(insn, new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
'ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature',
|
||||
'ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature',
|
||||
'getBrushTick',
|
||||
'(Lnet/minecraft/world/entity/LivingEntity;)I'
|
||||
))
|
||||
@ -59,7 +59,7 @@ function initializeCoreMod() {
|
||||
if (insn.getOpcode() == Opcodes.LDC && insn.cst == 10) {
|
||||
node.instructions.insert(insn, new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
'ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature',
|
||||
'ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature',
|
||||
'getBrushableBlockCooldown',
|
||||
'(Lnet/minecraft/world/entity/player/Player;)J'
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user