Skip to content

Commit d0e8ba7

Browse files
Merge branch '1.18.x/main' into 1.18.x/WoodType-Compat
2 parents 559c36f + 7caa63d commit d0e8ba7

File tree

13 files changed

+142
-161
lines changed

13 files changed

+142
-161
lines changed

changelogs/1.5.2-beta.1.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Additions
2+
* Added french translation [#381](https://github.com/ValkyrienSkies/Eureka/pull/381)
3+
* Added block tags for assembly blacklist [#413](https://github.com/ValkyrienSkies/Eureka/pull/413) *(tag available here `data/vs_eureka/tags/blocks/assemble_blacklist.json`)*
4+
# Changes
5+
* Stability decreases with high speed on low mass [#371](https://github.com/ValkyrienSkies/Eureka/pull/371)
6+
* Cleansed the blacklist config [#413](https://github.com/ValkyrienSkies/Eureka/pull/413) *(for now the blacklist config is still supported, use blacklist block tag instead)*
7+
# Fixes
8+
* Improved fuel compatibility [#406](https://github.com/ValkyrienSkies/Eureka/pull/406)

common/src/main/kotlin/org/valkyrienskies/eureka/EurekaConfig.kt

+7-100
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ object EurekaConfig {
122122

123123
// Instability scaled with mass and squared speed
124124
@JsonSchema(description = "Stronger stabilization with higher mass, less at higher speeds.")
125-
var scaledInstability = 1000.0
125+
var scaledInstability = 70.0
126126

127127
// Unscaled linear instability cased by speed
128128
@JsonSchema(description = "Less stabilization at higher speed.")
129-
var unscaledInstability = 0.271828
129+
var unscaledInstability = 0.1
130130

131131
@JsonSchema(description = "How fast a ship will stop and accelerate.")
132132
var linearMassScaling = 0.0002
@@ -151,104 +151,6 @@ object EurekaConfig {
151151
@JsonSchema(description = "Chance for popped balloons to pop adjacent balloons, per side")
152152
var popSideBalloonChance = 0.3
153153

154-
// Blacklist of blocks that don't get added for ship building
155-
@JsonSchema(description = "Blacklist of blocks that don't get assembled")
156-
var blockBlacklist = setOf(
157-
"vs_eureka:ship_helm",
158-
"minecraft:dirt",
159-
"minecraft:grass_block",
160-
"minecraft:grass_path",
161-
"minecraft:stone",
162-
"minecraft:bedrock",
163-
"minecraft:sand",
164-
"minecraft:gravel",
165-
"minecraft:water",
166-
"minecraft:flowing_water",
167-
"minecraft:lava",
168-
"minecraft:flowing_lava",
169-
"minecraft:lily_pad",
170-
"minecraft:coarse_dirt",
171-
"minecraft:podzol",
172-
"minecraft:granite",
173-
"minecraft:diorite",
174-
"minecraft:andesite",
175-
"minecraft:deepslate",
176-
"minecraft:tuff",
177-
"minecraft:crimson_nylium",
178-
"minecraft:warped_nylium",
179-
"minecraft:red_sand",
180-
"minecraft:sandstone",
181-
"minecraft:end_stone",
182-
"minecraft:red_sandstone",
183-
"minecraft:blackstone",
184-
"minecraft:netherrack",
185-
"minecraft:soul_sand",
186-
"minecraft:soul_soil",
187-
"minecraft:grass",
188-
"minecraft:fern",
189-
"minecraft:dead_bush",
190-
"minecraft:seagrass",
191-
"minecraft:tall_seagrass",
192-
"minecraft:sea_pickle",
193-
"minecraft:kelp",
194-
"minecraft:bamboo",
195-
"minecraft:dandelion",
196-
"minecraft:poppy",
197-
"minecraft:blue_orchid",
198-
"minecraft:allium",
199-
"minecraft:azure_bluet",
200-
"minecraft:red_tulip",
201-
"minecraft:orange_tulip",
202-
"minecraft:white_tulip",
203-
"minecraft:pink_tulip",
204-
"minecraft:oxeye_daisy",
205-
"minecraft:cornflower",
206-
"minecraft:lily_of_the_valley",
207-
"minecraft:brown_mushroom",
208-
"minecraft:red_mushroom",
209-
"minecraft:crimson_fungus",
210-
"minecraft:warped_fungus",
211-
"minecraft:crimson_roots",
212-
"minecraft:warped_roots",
213-
"minecraft:nether_sprouts",
214-
"minecraft:weeping_vines",
215-
"minecraft:twisting_vines",
216-
"minecraft:chorus_plant",
217-
"minecraft:chorus_flower",
218-
"minecraft:snow",
219-
"minecraft:snow_block",
220-
"minecraft:cactus",
221-
"minecraft:vine",
222-
"minecraft:sunflower",
223-
"minecraft:lilac",
224-
"minecraft:rose_bush",
225-
"minecraft:peony",
226-
"minecraft:tall_grass",
227-
"minecraft:large_fern",
228-
"minecraft:air",
229-
"minecraft:ice",
230-
"minecraft:packed_ice",
231-
"minecraft:blue_ice",
232-
"minecraft:portal",
233-
"minecraft:bedrock",
234-
"minecraft:end_portal_frame",
235-
"minecraft:end_portal",
236-
"minecraft:end_gateway",
237-
"minecraft:portal",
238-
"minecraft:oak_sapling",
239-
"minecraft:spruce_sapling",
240-
"minecraft:birch_sapling",
241-
"minecraft:jungle_sapling",
242-
"minecraft:acacia_sapling",
243-
"minecraft:dark_oak_sapling",
244-
"minecraft:oak_leaves",
245-
"minecraft:spruce_leaves",
246-
"minecraft:birch_leaves",
247-
"minecraft:jungle_leaves",
248-
"minecraft:acacia_leaves",
249-
"minecraft:dark_oak_leaves"
250-
)
251-
252154
@JsonSchema(description = "Whether the ship helm assembles diagonally connected blocks or not")
253155
val diagonals = true
254156

@@ -263,5 +165,10 @@ object EurekaConfig {
263165

264166
@JsonSchema(description = "Maximum number of blocks allowed in a ship. Set to 0 for no limit")
265167
val maxShipBlocks = 32 * 32 * 32
168+
169+
// TODO: Remove blockBlacklist
170+
// Blacklist of blocks that don't get added for ship building
171+
@JsonSchema(description = "Blacklist of blocks that don't get assembled (Use Block Tag instead)")
172+
var blockBlacklist : Set<String> = emptySet()
266173
}
267174
}

common/src/main/kotlin/org/valkyrienskies/eureka/EurekaMod.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.valkyrienskies.eureka
22

3-
import org.valkyrienskies.core.impl.config.VSConfigClass
3+
import org.valkyrienskies.mod.common.ValkyrienSkiesMod
44

55
object EurekaMod {
66
const val MOD_ID = "vs_eureka"
@@ -13,7 +13,7 @@ object EurekaMod {
1313
EurekaScreens.register()
1414
EurekaEntities.register()
1515
EurekaWeights.register()
16-
VSConfigClass.registerConfig("vs_eureka", EurekaConfig::class.java)
16+
ValkyrienSkiesMod.vsCore.registerConfigLegacy("vs_eureka", EurekaConfig::class.java)
1717
}
1818

1919
@JvmStatic

common/src/main/kotlin/org/valkyrienskies/eureka/EurekaWeights.kt

-11
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,10 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties
77
import org.valkyrienskies.core.apigame.world.chunks.BlockType
88
import org.valkyrienskies.mod.common.BlockStateInfo
99
import org.valkyrienskies.mod.common.BlockStateInfoProvider
10-
import org.valkyrienskies.physics_api.Lod1BlockStateId
11-
import org.valkyrienskies.physics_api.Lod1LiquidBlockStateId
12-
import org.valkyrienskies.physics_api.Lod1SolidBlockStateId
13-
import org.valkyrienskies.physics_api.voxel.Lod1LiquidBlockState
14-
import org.valkyrienskies.physics_api.voxel.Lod1SolidBlockState
1510

1611
object EurekaWeights : BlockStateInfoProvider {
17-
override val blockStateData: List<Triple<Lod1SolidBlockStateId, Lod1LiquidBlockStateId, Lod1BlockStateId>>
18-
get() = emptyList()
19-
override val liquidBlockStates: List<Lod1LiquidBlockState>
20-
get() = emptyList()
2112
override val priority: Int
2213
get() = 200
23-
override val solidBlockStates: List<Lod1SolidBlockState>
24-
get() = emptyList()
2514

2615
override fun getBlockStateMass(blockState: BlockState): Double? {
2716
if (blockState.block == EurekaBlocks.BALLAST.get()) {

common/src/main/kotlin/org/valkyrienskies/eureka/block/BalloonBlock.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import net.minecraft.world.damagesource.DamageSource
77
import net.minecraft.world.entity.Entity
88
import net.minecraft.world.entity.projectile.Projectile
99
import net.minecraft.world.level.Level
10-
import net.minecraft.world.level.LevelAccessor
1110
import net.minecraft.world.level.block.Block
1211
import net.minecraft.world.level.block.state.BlockState
1312
import net.minecraft.world.phys.BlockHitResult
@@ -48,7 +47,7 @@ class BalloonBlock(properties: Properties) : Block(properties) {
4847
if (level.isClientSide) return
4948

5049
level.destroyBlock(hit.blockPos, false)
51-
Direction.values().forEach {
50+
Direction.entries.forEach {
5251
val neighbor = hit.blockPos.relative(it)
5352
if (level.getBlockState(neighbor).block == this &&
5453
level.random.nextFloat() < EurekaConfig.SERVER.popSideBalloonChance

common/src/main/kotlin/org/valkyrienskies/eureka/blockentity/ShipHelmBlockEntity.kt

+21-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ import net.minecraft.core.Registry
88
import net.minecraft.network.chat.Component
99
import net.minecraft.network.chat.TextComponent
1010
import net.minecraft.network.chat.TranslatableComponent
11+
import net.minecraft.resources.ResourceLocation
1112
import net.minecraft.server.level.ServerLevel
13+
import net.minecraft.tags.TagKey
1214
import net.minecraft.world.MenuProvider
1315
import net.minecraft.world.entity.player.Inventory
1416
import net.minecraft.world.entity.player.Player
1517
import net.minecraft.world.inventory.AbstractContainerMenu
18+
import net.minecraft.world.level.block.Block
1619
import net.minecraft.world.level.block.HorizontalDirectionalBlock
1720
import net.minecraft.world.level.block.StairBlock
1821
import net.minecraft.world.level.block.entity.BlockEntity
@@ -23,9 +26,9 @@ import org.joml.Vector3d
2326
import org.joml.Vector3dc
2427
import org.valkyrienskies.core.api.ships.ServerShip
2528
import org.valkyrienskies.core.api.ships.getAttachment
26-
import org.valkyrienskies.core.impl.util.logger
2729
import org.valkyrienskies.eureka.EurekaBlockEntities
2830
import org.valkyrienskies.eureka.EurekaConfig
31+
import org.valkyrienskies.eureka.EurekaMod
2932
import org.valkyrienskies.eureka.block.ShipHelmBlock
3033
import org.valkyrienskies.eureka.gui.shiphelm.ShipHelmScreenMenu
3134
import org.valkyrienskies.eureka.ship.EurekaShipControl
@@ -35,6 +38,10 @@ import org.valkyrienskies.mod.common.entity.ShipMountingEntity
3538
import org.valkyrienskies.mod.common.getShipObjectManagingPos
3639
import org.valkyrienskies.mod.common.util.toDoubles
3740
import org.valkyrienskies.mod.common.util.toJOMLD
41+
import org.valkyrienskies.mod.util.logger
42+
43+
var ASSEMBLE_BLACKLIST: TagKey<Block> =
44+
TagKey.create(Registry.BLOCK_REGISTRY, ResourceLocation(EurekaMod.MOD_ID, "assemble_blacklist"))
3845

3946
class ShipHelmBlockEntity(pos: BlockPos, state: BlockState) :
4047
BlockEntity(EurekaBlockEntities.SHIP_HELM.get(), pos, state), MenuProvider {
@@ -122,14 +129,26 @@ class ShipHelmBlockEntity(pos: BlockPos, state: BlockState) :
122129
val blockState = level.getBlockState(blockPos)
123130
if (blockState.block !is ShipHelmBlock) return
124131

132+
var helmCount = 0
125133
val builtShip = ShipAssembler.collectBlocks(
126134
level,
127135
blockPos
128-
) { !it.isAir && !EurekaConfig.SERVER.blockBlacklist.contains(Registry.BLOCK.getKey(it.block).toString()) }
136+
) {
137+
val allowed = !it.isAir && !it.`is`(ASSEMBLE_BLACKLIST) &&
138+
// TODO: Remove blockBlacklist
139+
!(EurekaConfig.SERVER.blockBlacklist.isNotEmpty() && EurekaConfig.SERVER.blockBlacklist.contains(Registry.BLOCK.getKey(it.block).toString()))
140+
// This isn't the best way to count helms, but it'll work I promise!
141+
if (allowed && it.block is ShipHelmBlock) {
142+
helmCount++
143+
}
144+
return@collectBlocks allowed
145+
}
129146

130147
if (builtShip == null) {
131148
player.sendMessage(TextComponent("Ship is too big! Max size is ${EurekaConfig.SERVER.maxShipBlocks} blocks (changeable in the config)"), Util.NIL_UUID)
132149
logger.warn("Failed to assemble ship for ${player.name.string}")
150+
} else {
151+
EurekaShipControl.getOrCreate(builtShip).helms = helmCount
133152
}
134153
}
135154

common/src/main/kotlin/org/valkyrienskies/eureka/ship/EurekaShipControl.kt

+20-23
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import org.valkyrienskies.core.api.ships.ServerTickListener
1515
import org.valkyrienskies.core.api.ships.ShipForcesInducer
1616
import org.valkyrienskies.core.api.ships.getAttachment
1717
import org.valkyrienskies.core.api.ships.saveAttachment
18-
import org.valkyrienskies.core.impl.game.ships.PhysShipImpl
1918
import org.valkyrienskies.eureka.EurekaConfig
2019
import org.valkyrienskies.mod.api.SeatedControllingPlayer
2120
import org.valkyrienskies.mod.common.util.toJOMLD
@@ -92,13 +91,11 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
9291
// Disable fluid drag when helms are present, because it makes ships hard to drive
9392
physShip.doFluidDrag = EurekaConfig.SERVER.doFluidDrag
9493

95-
physShip as PhysShipImpl
96-
9794
val ship = ship ?: return
98-
val mass = physShip.inertia.shipMass
99-
val moiTensor = physShip.inertia.momentOfInertiaTensor
100-
val omega: Vector3dc = physShip.poseVel.omega
101-
val vel: Vector3dc = physShip.poseVel.vel
95+
val mass = physShip.mass
96+
val moiTensor = physShip.momentOfInertia
97+
val omega: Vector3dc = physShip.omega
98+
val vel: Vector3dc = physShip.velocity
10299
val balloonForceProvided = balloons * forcePerBalloon
103100

104101
val buoyantFactorPerFloater = min(
@@ -123,7 +120,7 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
123120

124121
// region Aligning
125122

126-
val invRotation = physShip.poseVel.rot.invert(Quaterniond())
123+
val invRotation = physShip.transform.shipToWorldRotation.invert(Quaterniond())
127124
val invRotationAxisAngle = AxisAngle4d(invRotation)
128125
// Floor makes a number 0 to 3, which corresponds to direction
129126
val alignTarget = floor((invRotationAxisAngle.angle / (PI * 0.5)) + 4.5).toInt() % 4
@@ -233,16 +230,16 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
233230
return currentControlData
234231
}
235232

236-
private fun applyPlayerControl(control: ControlData, physShip: PhysShipImpl) {
233+
private fun applyPlayerControl(control: ControlData, physShip: PhysShip) {
237234

238235
val ship = ship ?: return
239236
val transform = physShip.transform
240237
val aabb = ship.worldAABB
241238
val center = transform.positionInWorld
242239

243240
// region Player controlled rotation
244-
val moiTensor = physShip.inertia.momentOfInertiaTensor
245-
val omega: Vector3dc = physShip.poseVel.omega
241+
val moiTensor = physShip.momentOfInertia
242+
val omega: Vector3dc = physShip.omega
246243

247244
val largestDistance = run {
248245
var dist = center.distance(aabb.minX(), center.y(), aabb.minZ())
@@ -277,42 +274,42 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
277274
physShip.applyInvariantForce(getPlayerForwardVel(control, physShip))
278275
}
279276

280-
private fun getPlayerControlledBanking(control: ControlData, physShip: PhysShipImpl, moiTensor: Matrix3dc, strength: Double): Vector3d {
277+
private fun getPlayerControlledBanking(control: ControlData, physShip: PhysShip, moiTensor: Matrix3dc, strength: Double): Vector3d {
281278
val rotationVector = control.seatInDirection.normal.toJOMLD()
282-
physShip.poseVel.transformDirection(rotationVector)
279+
physShip.transform.shipToWorldRotation.transform(rotationVector)
283280
rotationVector.y = 0.0
284281
rotationVector.mul(strength * 1.5)
285282

286-
physShip.poseVel.rot.transform(
283+
physShip.transform.shipToWorldRotation.transform(
287284
moiTensor.transform(
288-
physShip.poseVel.rot.transformInverse(rotationVector)
285+
physShip.transform.shipToWorldRotation.transformInverse(rotationVector)
289286
)
290287
)
291288

292289
return rotationVector
293290
}
294291

295292
// Player controlled forward and backward thrust
296-
private fun getPlayerForwardVel(control: ControlData, physShip: PhysShipImpl): Vector3d {
293+
private fun getPlayerForwardVel(control: ControlData, physShip: PhysShip): Vector3d {
297294

298-
val scaledMass = physShip.inertia.shipMass * EurekaConfig.SERVER.speedMassScale
299-
val vel: Vector3dc = physShip.poseVel.vel
295+
val scaledMass = physShip.mass * EurekaConfig.SERVER.speedMassScale
296+
val vel: Vector3dc = physShip.velocity
300297

301298
// region Player controlled forward and backward thrust
302299
val forwardVector = control.seatInDirection.normal.toJOMLD()
303-
physShip.poseVel.rot.transform(forwardVector)
300+
physShip.transform.shipToWorldRotation.transform(forwardVector)
304301
forwardVector.normalize()
305302

306303
val s = 1 / smoothingATanMax(
307304
EurekaConfig.SERVER.linearMaxMass,
308-
physShip.inertia.shipMass * EurekaConfig.SERVER.linearMassScaling + EurekaConfig.SERVER.linearBaseMass
305+
physShip.mass * EurekaConfig.SERVER.linearMassScaling + EurekaConfig.SERVER.linearBaseMass
309306
)
310307

311308
val maxSpeed = EurekaConfig.SERVER.linearMaxSpeed / 15
312309
oldSpeed = max(min(oldSpeed * (1 - s) + control.forwardImpulse.toDouble() * s, maxSpeed), -maxSpeed)
313310
forwardVector.mul(oldSpeed)
314311

315-
val playerUpDirection = physShip.poseVel.transformDirection(Vector3d(0.0, 1.0, 0.0))
312+
val playerUpDirection = physShip.transform.shipToWorldRotation.transform(Vector3d(0.0, 1.0, 0.0))
316313
val velOrthogonalToPlayerUp = vel.sub(playerUpDirection.mul(playerUpDirection.dot(vel)), Vector3d())
317314

318315
// This is the speed that the ship is always allowed to go out, without engines
@@ -321,8 +318,8 @@ class EurekaShipControl : ShipForcesInducer, ServerTickListener {
321318

322319
if (extraForceLinear != 0.0) {
323320
// engine boost
324-
val boost = max((extraForceLinear - EurekaConfig.SERVER.enginePowerLinear * EurekaConfig.SERVER.engineBoostOffset) * EurekaConfig.SERVER.engineBoost, 0.0);
325-
extraForceLinear += boost + boost * boost * EurekaConfig.SERVER.engineBoostExponentialPower;
321+
val boost = max((extraForceLinear - EurekaConfig.SERVER.enginePowerLinear * EurekaConfig.SERVER.engineBoostOffset) * EurekaConfig.SERVER.engineBoost, 0.0)
322+
extraForceLinear += boost + boost * boost * EurekaConfig.SERVER.engineBoostExponentialPower
326323

327324
// This is the maximum speed we want to go in any scenario (when not sprinting)
328325
val idealForwardVel = Vector3d(forwardVector).mul(EurekaConfig.SERVER.maxCasualSpeed)

0 commit comments

Comments
 (0)