1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package MyGame 4 5 import java.nio.* 6 import kotlin.math.sign 7 import com.google.flatbuffers.* 8 9 @Suppress("unused") 10 @ExperimentalUnsignedTypes 11 class MonsterExtra : Table() { 12 __initnull13 fun __init(_i: Int, _bb: ByteBuffer) { 14 __reset(_i, _bb) 15 } __assignnull16 fun __assign(_i: Int, _bb: ByteBuffer) : MonsterExtra { 17 __init(_i, _bb) 18 return this 19 } 20 val d0 : Double 21 get() { 22 val o = __offset(4) 23 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NaN 24 } mutateD0null25 fun mutateD0(d0: Double) : Boolean { 26 val o = __offset(4) 27 return if (o != 0) { 28 bb.putDouble(o + bb_pos, d0) 29 true 30 } else { 31 false 32 } 33 } 34 val d1 : Double 35 get() { 36 val o = __offset(6) 37 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NaN 38 } mutateD1null39 fun mutateD1(d1: Double) : Boolean { 40 val o = __offset(6) 41 return if (o != 0) { 42 bb.putDouble(o + bb_pos, d1) 43 true 44 } else { 45 false 46 } 47 } 48 val d2 : Double 49 get() { 50 val o = __offset(8) 51 return if(o != 0) bb.getDouble(o + bb_pos) else Double.POSITIVE_INFINITY 52 } mutateD2null53 fun mutateD2(d2: Double) : Boolean { 54 val o = __offset(8) 55 return if (o != 0) { 56 bb.putDouble(o + bb_pos, d2) 57 true 58 } else { 59 false 60 } 61 } 62 val d3 : Double 63 get() { 64 val o = __offset(10) 65 return if(o != 0) bb.getDouble(o + bb_pos) else Double.NEGATIVE_INFINITY 66 } mutateD3null67 fun mutateD3(d3: Double) : Boolean { 68 val o = __offset(10) 69 return if (o != 0) { 70 bb.putDouble(o + bb_pos, d3) 71 true 72 } else { 73 false 74 } 75 } 76 val f0 : Float 77 get() { 78 val o = __offset(12) 79 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NaN 80 } mutateF0null81 fun mutateF0(f0: Float) : Boolean { 82 val o = __offset(12) 83 return if (o != 0) { 84 bb.putFloat(o + bb_pos, f0) 85 true 86 } else { 87 false 88 } 89 } 90 val f1 : Float 91 get() { 92 val o = __offset(14) 93 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NaN 94 } mutateF1null95 fun mutateF1(f1: Float) : Boolean { 96 val o = __offset(14) 97 return if (o != 0) { 98 bb.putFloat(o + bb_pos, f1) 99 true 100 } else { 101 false 102 } 103 } 104 val f2 : Float 105 get() { 106 val o = __offset(16) 107 return if(o != 0) bb.getFloat(o + bb_pos) else Float.POSITIVE_INFINITY 108 } mutateF2null109 fun mutateF2(f2: Float) : Boolean { 110 val o = __offset(16) 111 return if (o != 0) { 112 bb.putFloat(o + bb_pos, f2) 113 true 114 } else { 115 false 116 } 117 } 118 val f3 : Float 119 get() { 120 val o = __offset(18) 121 return if(o != 0) bb.getFloat(o + bb_pos) else Float.NEGATIVE_INFINITY 122 } mutateF3null123 fun mutateF3(f3: Float) : Boolean { 124 val o = __offset(18) 125 return if (o != 0) { 126 bb.putFloat(o + bb_pos, f3) 127 true 128 } else { 129 false 130 } 131 } dvecnull132 fun dvec(j: Int) : Double { 133 val o = __offset(20) 134 return if (o != 0) { 135 bb.getDouble(__vector(o) + j * 8) 136 } else { 137 0.0 138 } 139 } 140 val dvecLength : Int 141 get() { 142 val o = __offset(20); return if (o != 0) __vector_len(o) else 0 143 } 144 val dvecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(20, 8) dvecInByteBuffernull145 fun dvecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 20, 8) 146 fun mutateDvec(j: Int, dvec: Double) : Boolean { 147 val o = __offset(20) 148 return if (o != 0) { 149 bb.putDouble(__vector(o) + j * 8, dvec) 150 true 151 } else { 152 false 153 } 154 } fvecnull155 fun fvec(j: Int) : Float { 156 val o = __offset(22) 157 return if (o != 0) { 158 bb.getFloat(__vector(o) + j * 4) 159 } else { 160 0.0f 161 } 162 } 163 val fvecLength : Int 164 get() { 165 val o = __offset(22); return if (o != 0) __vector_len(o) else 0 166 } 167 val fvecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(22, 4) fvecInByteBuffernull168 fun fvecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 22, 4) 169 fun mutateFvec(j: Int, fvec: Float) : Boolean { 170 val o = __offset(22) 171 return if (o != 0) { 172 bb.putFloat(__vector(o) + j * 4, fvec) 173 true 174 } else { 175 false 176 } 177 } 178 companion object { validateVersionnull179 fun validateVersion() = Constants.FLATBUFFERS_2_0_0() 180 fun getRootAsMonsterExtra(_bb: ByteBuffer): MonsterExtra = getRootAsMonsterExtra(_bb, MonsterExtra()) 181 fun getRootAsMonsterExtra(_bb: ByteBuffer, obj: MonsterExtra): MonsterExtra { 182 _bb.order(ByteOrder.LITTLE_ENDIAN) 183 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 184 } MonsterExtraBufferHasIdentifiernull185 fun MonsterExtraBufferHasIdentifier(_bb: ByteBuffer) : Boolean = __has_identifier(_bb, "MONE") 186 fun createMonsterExtra(builder: FlatBufferBuilder, d0: Double, d1: Double, d2: Double, d3: Double, f0: Float, f1: Float, f2: Float, f3: Float, dvecOffset: Int, fvecOffset: Int) : Int { 187 builder.startTable(11) 188 addD3(builder, d3) 189 addD2(builder, d2) 190 addD1(builder, d1) 191 addD0(builder, d0) 192 addFvec(builder, fvecOffset) 193 addDvec(builder, dvecOffset) 194 addF3(builder, f3) 195 addF2(builder, f2) 196 addF1(builder, f1) 197 addF0(builder, f0) 198 return endMonsterExtra(builder) 199 } startMonsterExtranull200 fun startMonsterExtra(builder: FlatBufferBuilder) = builder.startTable(11) 201 fun addD0(builder: FlatBufferBuilder, d0: Double) = builder.addDouble(0, d0, Double.NaN) 202 fun addD1(builder: FlatBufferBuilder, d1: Double) = builder.addDouble(1, d1, Double.NaN) 203 fun addD2(builder: FlatBufferBuilder, d2: Double) = builder.addDouble(2, d2, Double.POSITIVE_INFINITY) 204 fun addD3(builder: FlatBufferBuilder, d3: Double) = builder.addDouble(3, d3, Double.NEGATIVE_INFINITY) 205 fun addF0(builder: FlatBufferBuilder, f0: Float) = builder.addFloat(4, f0, Double.NaN) 206 fun addF1(builder: FlatBufferBuilder, f1: Float) = builder.addFloat(5, f1, Double.NaN) 207 fun addF2(builder: FlatBufferBuilder, f2: Float) = builder.addFloat(6, f2, Double.POSITIVE_INFINITY) 208 fun addF3(builder: FlatBufferBuilder, f3: Float) = builder.addFloat(7, f3, Double.NEGATIVE_INFINITY) 209 fun addDvec(builder: FlatBufferBuilder, dvec: Int) = builder.addOffset(8, dvec, 0) 210 fun createDvecVector(builder: FlatBufferBuilder, data: DoubleArray) : Int { 211 builder.startVector(8, data.size, 8) 212 for (i in data.size - 1 downTo 0) { 213 builder.addDouble(data[i]) 214 } 215 return builder.endVector() 216 } startDvecVectornull217 fun startDvecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 218 fun addFvec(builder: FlatBufferBuilder, fvec: Int) = builder.addOffset(9, fvec, 0) 219 fun createFvecVector(builder: FlatBufferBuilder, data: FloatArray) : Int { 220 builder.startVector(4, data.size, 4) 221 for (i in data.size - 1 downTo 0) { 222 builder.addFloat(data[i]) 223 } 224 return builder.endVector() 225 } startFvecVectornull226 fun startFvecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 227 fun endMonsterExtra(builder: FlatBufferBuilder) : Int { 228 val o = builder.endTable() 229 return o 230 } finishMonsterExtraBuffernull231 fun finishMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset, "MONE") 232 fun finishSizePrefixedMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset, "MONE") 233 } 234 } 235