Skip to content

Commit 9de2a56

Browse files
0.5.4.2
1 parent 2e7bae5 commit 9de2a56

File tree

17 files changed

+142
-16
lines changed

17 files changed

+142
-16
lines changed

changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 0.5.4.2
2+
Hotfix #2 for 0.5.4
3+
4+
#### Bugfixes:
5+
- Copter bearing crashing fabric cause I'm dumb
6+
- Add gas nozzle back to creative inventory for real this time
7+
- Readjust exhaust gas values
8+
- Colored wings should now place with their color when using placement helper
9+
- Universal joints return their item when disconnected
10+
- Universal joint distance is now configurable
11+
- Increased default Gas Thruster force by 10x
12+
- Maybe fix gyro and reaction wheel models
13+
114
## 0.5.4.1
215
Hotfix for 0.5.4
316

common/src/main/kotlin/org/valkyrienskies/clockwork/ClockworkConfig.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ object ClockworkConfig {
8888
@ConfigEntry(description = "The max size that a propeller blade can reach. Sizes higher than this will refuse to craft.")
8989
var maxBladeSize = 4.0
9090

91+
@ConfigEntry(description = "The maximum distance (in blocks) allowed between two Universal Joints while connected.", min = 1.0)
92+
var maxUniversalJointDistance = 10.0
93+
9194
@ConfigEntry(description = "The length of the raycast made by the Gas Nozzle when attempting to find a valid balloon ceiling.", min = 1.0)
9295
var hotAirBalloonMaxRaycastDistance = 64.0
9396

@@ -116,7 +119,7 @@ object ClockworkConfig {
116119
var wanderOreForceMultiplier = 2.0
117120

118121
@ConfigEntry(min = 0.0)
119-
var gasThrusterForceMul = 20.0
122+
var gasThrusterForceMul = 200.0
120123

121124
@ConfigEntry(min = 0.0)
122125
var sugarRocketBlockThrust = 10000.0

common/src/main/kotlin/org/valkyrienskies/clockwork/content/kinetics/universal_shaft/UniversalShaftBlock.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class UniversalShaftBlock(properties: Properties?) : DirectionalKineticBlock(pro
9393
if (be.connectedBe != null) be.connectedBe!!.disconnect()
9494
be.disconnect()
9595
level.playSound(null, be.blockPos, ClockworkSounds.HOSE_RELEASE.mainEvent, SoundSource.BLOCKS, 1.0f, 1.0f)
96+
if (!player.isCreative) player.addItem(be.getConnectionItem())
9697
return InteractionResult.SUCCESS
9798
}
9899

common/src/main/kotlin/org/valkyrienskies/clockwork/content/kinetics/universal_shaft/UniversalShaftBlockEntity.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import net.minecraft.core.BlockPos
66
import net.minecraft.nbt.CompoundTag
77
import net.minecraft.server.level.ServerLevel
88
import net.minecraft.sounds.SoundSource
9+
import net.minecraft.world.item.ItemStack
910
import net.minecraft.world.level.block.entity.BlockEntity
1011
import net.minecraft.world.level.block.entity.BlockEntityType
1112
import net.minecraft.world.level.block.state.BlockState
13+
import org.valkyrienskies.clockwork.ClockworkConfig
14+
import org.valkyrienskies.clockwork.ClockworkItems
1215
import org.valkyrienskies.clockwork.ClockworkSounds
1316
import org.valkyrienskies.clockwork.content.physicalities.extendon.ExtendonBlockEntity
1417
import org.valkyrienskies.clockwork.util.universal_joint.IUniversalJoint
@@ -23,7 +26,7 @@ class UniversalShaftBlockEntity(typeIn: BlockEntityType<*>?, pos: BlockPos?, sta
2326
var main: Boolean = false
2427

2528
override val maxCreationDistance: Double
26-
get() = 10.0 //todo add config
29+
get() = ClockworkConfig.SERVER.maxUniversalJointDistance
2730

2831
override fun onSpeedChanged(previousSpeed: Float) {
2932
super.onSpeedChanged(previousSpeed)
@@ -121,6 +124,10 @@ class UniversalShaftBlockEntity(typeIn: BlockEntityType<*>?, pos: BlockPos?, sta
121124
return be is UniversalShaftBlockEntity
122125
}
123126

127+
override fun getConnectionItem(): ItemStack {
128+
return ClockworkItems.UNIVERSAL_SHAFT_ITEM.asStack()
129+
}
130+
124131
override fun write(compound: CompoundTag, clientPacket: Boolean) {
125132
if (connectedPos != null) {
126133
compound.putInt("otherPosX",connectedPos!!.x)

common/src/main/kotlin/org/valkyrienskies/clockwork/content/logistics/gas/exhaust/ExhaustBlockEntity.kt

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,27 @@ import org.valkyrienskies.clockwork.ClockworkModClient
1818
import org.valkyrienskies.clockwork.mixinduck.MixinAirCurrentDuck
1919
import org.valkyrienskies.clockwork.util.KNodeBlockEntity
2020
import org.valkyrienskies.clockwork.util.KelvinParticleHelper
21+
import org.valkyrienskies.core.api.ships.PhysShip
22+
import org.valkyrienskies.core.api.world.PhysLevel
23+
import org.valkyrienskies.core.api.world.properties.DimensionId
2124
import org.valkyrienskies.kelvin.KelvinMod
25+
import org.valkyrienskies.mod.api.BlockEntityPhysicsListener
2226
import org.valkyrienskies.mod.common.util.toJOMLD
2327
import kotlin.math.floor
2428
import kotlin.math.min
2529
import kotlin.math.pow
2630

2731
class ExhaustBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: BlockState) : KNodeBlockEntity(type, pos, state),
28-
IAirCurrentSource {
29-
32+
IAirCurrentSource, BlockEntityPhysicsListener {
3033
val MASS_PER_EXHAUST = 0.0005
34+
35+
val facing: Direction = state.getValue(BlockStateProperties.FACING)
36+
37+
override lateinit var dimension: DimensionId
3138
// Airflow speed parameters cannot be easily made configurable because air current code runs both on server and client
3239
// so values need to somehow be synced.
3340
val MAX_AIRFLOW_SPEED = 256F // like a maxed out encased fan with default max rpm cap
34-
val PRESSURE_TO_SPEED = 256F / 2500 // outflow pressure in exhausts is very low compared to thrusters, may need tweaking later
41+
val PRESSURE_TO_SPEED = 256F / 2500F // outflow pressure in exhausts is very low compared to thrusters, may need tweaking later
3542

3643
@JvmField
3744
var airCurrent: AirCurrent? = null
@@ -40,6 +47,10 @@ class ExhaustBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: BlockSt
4047
var entitySearchCooldown: Int = 0
4148
var updateAirFlow: Boolean = false
4249

50+
51+
@Volatile
52+
var currentAirflowThrust: Double = 0.0
53+
4354
init {
4455
airCurrent = AirCurrent(this)
4556
updateAirFlow = true
@@ -110,12 +121,14 @@ class ExhaustBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: BlockSt
110121
sendData();
111122
}
112123

124+
currentAirflowThrust = speed.toDouble()
125+
113126
if (speed == 0.0F)
114-
return;
127+
return
115128

116129
if (entitySearchCooldown-- <= 0) {
117130
entitySearchCooldown = 5;
118-
airCurrent!!.findEntities();
131+
airCurrent!!.findEntities()
119132
}
120133

121134
airCurrent!!.tick();
@@ -154,4 +167,11 @@ class ExhaustBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: BlockSt
154167
override fun isSourceRemoved(): Boolean {
155168
return remove
156169
}
170+
171+
override fun physTick(
172+
physShip: PhysShip?,
173+
physLevel: PhysLevel
174+
) {
175+
// will implement later
176+
}
157177
}

common/src/main/kotlin/org/valkyrienskies/clockwork/content/logistics/gas/hoseport/HosePortBlock.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ class HosePortBlock(properties: Properties) : DirectionalBlock(properties), IBE<
121121
val be = level.getBlockEntity(pos) as? HosePortBlockEntity? ?: return super.use(state, level, pos, player, hand, hit)
122122
if (player.getItemInHand(InteractionHand.MAIN_HAND).item !is BlockItem && be.connectedJoint != null) {
123123
be.disconnect()
124-
if (!player.isCreative) player.addItem(ClockworkItems.EXTENDON_HOSE.asStack())
124+
if (!player.isCreative) player.addItem(be.getConnectionItem())
125125
return InteractionResult.SUCCESS
126126
}
127127

128128
return super.use(state, level, pos, player, hand, hit)
129129
}
130-
}
130+
}

common/src/main/kotlin/org/valkyrienskies/clockwork/content/logistics/gas/hoseport/HosePortBlockEntity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import net.minecraft.core.BlockPos
88
import net.minecraft.nbt.CompoundTag
99
import net.minecraft.network.chat.Component
1010
import net.minecraft.server.level.ServerLevel
11+
import net.minecraft.world.item.ItemStack
1112
import net.minecraft.world.level.block.entity.BlockEntityType
1213
import net.minecraft.world.level.block.state.BlockState
1314
import net.minecraft.world.level.block.state.properties.BlockStateProperties
1415
import org.valkyrienskies.clockwork.ClockworkGasses
16+
import org.valkyrienskies.clockwork.ClockworkItems
1517
import org.valkyrienskies.clockwork.ClockworkMod
1618
import org.valkyrienskies.clockwork.ClockworkModClient
1719
import org.valkyrienskies.clockwork.ClockworkSounds
@@ -217,6 +219,10 @@ class HosePortBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: BlockS
217219
return og || other
218220
}
219221

222+
override fun getConnectionItem(): ItemStack {
223+
return ClockworkItems.EXTENDON_HOSE.asStack()
224+
}
225+
220226
fun safeHeatableGoggleTooltip(tooltip: MutableList<Component>, isPlayerSneaking: Boolean): Boolean {
221227
var found = false
222228

common/src/main/kotlin/org/valkyrienskies/clockwork/content/physicalities/extendon/ExtendonBlock.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class ExtendonBlock(properties: Properties) : DirectionalBlock(properties), IBE<
119119
val be = level.getBlockEntity(pos) as? ExtendonBlockEntity? ?: return super.use(state, level, pos, player, hand, hit)
120120
if (player.getItemInHand(InteractionHand.MAIN_HAND).item !is BlockItem && be.connectedJoint != null) {
121121
be.disconnect()
122-
if (!player.isCreative) player.addItem(ClockworkItems.EXTENDON_HOSE.asStack())
122+
if (!player.isCreative) player.addItem(be.getConnectionItem())
123123
return InteractionResult.SUCCESS
124124
}
125125

common/src/main/kotlin/org/valkyrienskies/clockwork/content/physicalities/extendon/ExtendonBlockEntity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import net.minecraft.core.Direction
1010
import net.minecraft.nbt.CompoundTag
1111
import net.minecraft.network.chat.Component
1212
import net.minecraft.server.level.ServerLevel
13+
import net.minecraft.world.item.ItemStack
1314
import net.minecraft.world.level.block.entity.BlockEntityType
1415
import net.minecraft.world.level.block.state.BlockState
1516
import net.minecraft.world.level.block.state.properties.BlockStateProperties
@@ -18,6 +19,7 @@ import org.joml.AxisAngle4d
1819
import org.joml.Quaterniond
1920
import org.joml.Vector3d
2021
import org.valkyrienskies.clockwork.ClockworkGasses
22+
import org.valkyrienskies.clockwork.ClockworkItems
2123
import org.valkyrienskies.clockwork.ClockworkMod
2224
import org.valkyrienskies.clockwork.ClockworkModClient
2325
import org.valkyrienskies.clockwork.ClockworkSounds
@@ -208,7 +210,7 @@ class ExtendonBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: Block
208210
}
209211

210212

211-
fun getShipID(): ShipId {
213+
fun getShipID(): ShipId? {
212214
val ship = level.getShipManagingPos(blockPos)
213215

214216
if (ship == null) return -1L
@@ -274,6 +276,10 @@ class ExtendonBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: Block
274276
return og || other
275277
}
276278

279+
override fun getConnectionItem(): ItemStack {
280+
return ClockworkItems.EXTENDON_HOSE.asStack()
281+
}
282+
277283
fun safeHeatableGoggleTooltip(tooltip: MutableList<Component>, isPlayerSneaking: Boolean): Boolean {
278284
var found = false
279285

common/src/main/kotlin/org/valkyrienskies/clockwork/util/blocktype/ConnectedWingAlike.kt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import net.minecraft.world.phys.shapes.CollisionContext
2626
import net.minecraft.world.phys.shapes.VoxelShape
2727
import org.valkyrienskies.clockwork.ClockworkBlocks
2828
import org.valkyrienskies.clockwork.ClockworkShapes
29+
import org.valkyrienskies.clockwork.content.generic.ColorBlockEntity
30+
import org.valkyrienskies.clockwork.content.physicalities.wing.DyedWingBlockItem
2931
import java.util.function.Predicate
3032
import kotlin.collections.getValue
3133

@@ -85,8 +87,23 @@ abstract class ConnectedWingAlike(properties: Properties?) : Block(properties) {
8587
val placementHelper: IPlacementHelper = PlacementHelpers.get(placementHelperId);
8688
if (!player.isShiftKeyDown() && player.mayBuild()) {
8789
if (placementHelper.matchesItem(heldItem)) {
88-
placementHelper.getOffset(player, level, state, pos, hit)
89-
.placeInWorld(level, (heldItem.item) as BlockItem, player, hand, hit);
90+
var color = -1
91+
if (heldItem.item is DyedWingBlockItem) {
92+
color = if (heldItem.hasTag() && heldItem.getOrCreateTag().contains("Clockwork\$color")) heldItem.getOrCreateTag()
93+
.getInt("Clockwork\$color") else -1
94+
}
95+
val offset = placementHelper.getOffset(player, level, state, pos, hit)
96+
val result = offset.placeInWorld(level, (heldItem.item) as BlockItem, player, hand, hit)
97+
98+
if (result != InteractionResult.SUCCESS) {
99+
return result
100+
}
101+
102+
if (level.getBlockEntity(offset.blockPos) is ColorBlockEntity) {
103+
val be: ColorBlockEntity = (level.getBlockEntity(offset.blockPos) as ColorBlockEntity)
104+
be.setColor(color)
105+
}
106+
90107
return InteractionResult.SUCCESS;
91108
}
92109
}

0 commit comments

Comments
 (0)