1.21.1 is so back
This commit is contained in:
@@ -1,16 +1,54 @@
|
||||
package org.neoflock.neocomputers.entity;
|
||||
|
||||
import com.mojang.datafixers.types.templates.TypeTemplate
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.datafixers.types.Type as DataFixType
|
||||
import dev.architectury.registry.registries.DeferredRegister
|
||||
import dev.architectury.registry.registries.RegistrySupplier
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.util.datafix.DataFixTypes
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import org.neoflock.neocomputers.NeoComputers
|
||||
import org.neoflock.neocomputers.block.Blocks
|
||||
import org.neoflock.neocomputers.block.CapacitorEntity
|
||||
import org.neoflock.neocomputers.network.PowerManager
|
||||
|
||||
// complete fucking bullshit btw
|
||||
class BullshitFix: DataFixType<Unit>() {
|
||||
override fun buildTemplate(): TypeTemplate? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun buildCodec(): Codec<Unit?>? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun equals(
|
||||
o: Any?,
|
||||
ignoreRecursionPoints: Boolean,
|
||||
checkIndex: Boolean
|
||||
): Boolean {
|
||||
return o == this
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object BlockEntities {
|
||||
val BLOCKENTITIES: DeferredRegister<BlockEntityType<*>> = DeferredRegister.create(NeoComputers.MODID, Registries.BLOCK_ENTITY_TYPE);
|
||||
|
||||
val SCREEN_ENTITY: RegistrySupplier<BlockEntityType<ScreenEntity>> = BLOCKENTITIES.register("screen_entity") { BlockEntityType(::ScreenEntity, mutableSetOf(Blocks.SCREEN_BLOCK.get()))}
|
||||
val CAPACITOR_ENTITY: RegistrySupplier<BlockEntityType<CapacitorEntity>> = BLOCKENTITIES.register("capacitor_entity") { BlockEntityType(::CapacitorEntity, mutableSetOf(Blocks.CAPACITOR_BLOCK.get()))}
|
||||
val SCREEN_ENTITY: RegistrySupplier<BlockEntityType<ScreenEntity>> = BLOCKENTITIES.register("screen_entity") {
|
||||
BlockEntityType(
|
||||
::ScreenEntity, mutableSetOf(Blocks.SCREEN_BLOCK.get()), BullshitFix()
|
||||
)
|
||||
}
|
||||
val CAPACITOR_ENTITY: RegistrySupplier<BlockEntityType<CapacitorEntity>> = BLOCKENTITIES.register("capacitor_entity") {
|
||||
BlockEntityType(
|
||||
::CapacitorEntity, mutableSetOf(Blocks.CAPACITOR_BLOCK.get()), BullshitFix()
|
||||
)
|
||||
}
|
||||
|
||||
fun registerPowerBlocks() {
|
||||
PowerManager.registerPowerBlockEntity(CAPACITOR_ENTITY.get())
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,5 @@ import org.neoflock.neocomputers.network.PowerRole
|
||||
class ScreenEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
NodeBlockEntity(BlockEntities.SCREEN_ENTITY.get(), blockPos, blockState) {
|
||||
|
||||
var energyStored: Double = 0.0
|
||||
|
||||
override val node = object : Networking.Node() {
|
||||
override fun getPowerRole() = PowerRole.CONSUMER
|
||||
override fun getEnergy() = energyStored
|
||||
override fun setEnergy(energy: Double) {
|
||||
energyStored = energy
|
||||
}
|
||||
override fun maxEnergyCapacity(): Double = 10.0
|
||||
}
|
||||
override val node = Networking.Node()
|
||||
}
|
||||
Reference in New Issue
Block a user