Skip to content

Commit

Permalink
Merge from 1.19.2/main
Browse files Browse the repository at this point in the history
  • Loading branch information
StewStrong committed Oct 28, 2024
2 parents 0044230 + 369f4ee commit d253add
Show file tree
Hide file tree
Showing 23 changed files with 220 additions and 169 deletions.
8 changes: 7 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ body:
- type: input
attributes:
label: Eureka version
description: The version of Eureka ships
description: What version of Eureka ships does this issue occur on?
validations:
required: true
- type: input
attributes:
label: VS2 version
description: What version of Valkyrien Skies 2 does this issue occur on?
validations:
required: true
- type: dropdown
Expand Down
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/compatibility_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ body:
- 1.16
- 1.18
- 1.19
- 1.20
validations:
required: true
- type: dropdown
Expand All @@ -41,6 +42,12 @@ body:
- Quilt
validations:
required: true
- type: input
attributes:
label: Eureka version
description: What version of Eureka ships does this issue occur on?
validations:
required: true
- type: textarea
attributes:
label: Issue description
Expand Down
2 changes: 1 addition & 1 deletion changelogs/1.5.1-beta.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Updated `en_pt.json`
* Updated helm hitbox.
* Changed anchor blast resistance from 1200 to 6.
* Halev the mass effect on max speed.
* Halved the mass effect on max speed.
# Fixes
* Updated dependencies.
* Fixed an issue where the helm GUI lost data.
8 changes: 8 additions & 0 deletions changelogs/1.5.2-beta.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Additions
* Added french translation [#381](https://github.com/ValkyrienSkies/Eureka/pull/381)
* 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`)*
# Changes
* Stability decreases with high speed on low mass [#371](https://github.com/ValkyrienSkies/Eureka/pull/371)
* 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)*
# Fixes
* Improved fuel compatibility [#406](https://github.com/ValkyrienSkies/Eureka/pull/406)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.valkyrienskies.eureka.registry;

import net.minecraft.world.item.ItemStack;

public abstract class FuelRegistry {
public static FuelRegistry INSTANCE = null;

public abstract int get(ItemStack stack);
}
111 changes: 13 additions & 98 deletions common/src/main/kotlin/org/valkyrienskies/eureka/EurekaConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ object EurekaConfig {
@JsonSchema(description = "How fast a ship will stop. 1 = fast stop, 0 = slow stop")
var linearStabilizeMaxAntiVelocity = 1.0

// Instability scaled with mass and squared speed
@JsonSchema(description = "Stronger stabilization with higher mass, less at higher speeds.")
var scaledInstability = 1000.0

// Unscaled linear instability cased by speed
@JsonSchema(description = "Less stabilization at higher speed.")
var unscaledInstability = 0.271828

@JsonSchema(description = "How fast a ship will stop and accelerate.")
var linearMassScaling = 0.0002

Expand All @@ -143,104 +151,6 @@ object EurekaConfig {
@JsonSchema(description = "Chance for popped balloons to pop adjacent balloons, per side")
var popSideBalloonChance = 0.3

// Blacklist of blocks that don't get added for ship building
@JsonSchema(description = "Blacklist of blocks that don't get assembled")
var blockBlacklist = setOf(
"vs_eureka:ship_helm",
"minecraft:dirt",
"minecraft:grass_block",
"minecraft:grass_path",
"minecraft:stone",
"minecraft:bedrock",
"minecraft:sand",
"minecraft:gravel",
"minecraft:water",
"minecraft:flowing_water",
"minecraft:lava",
"minecraft:flowing_lava",
"minecraft:lily_pad",
"minecraft:coarse_dirt",
"minecraft:podzol",
"minecraft:granite",
"minecraft:diorite",
"minecraft:andesite",
"minecraft:deepslate",
"minecraft:tuff",
"minecraft:crimson_nylium",
"minecraft:warped_nylium",
"minecraft:red_sand",
"minecraft:sandstone",
"minecraft:end_stone",
"minecraft:red_sandstone",
"minecraft:blackstone",
"minecraft:netherrack",
"minecraft:soul_sand",
"minecraft:soul_soil",
"minecraft:grass",
"minecraft:fern",
"minecraft:dead_bush",
"minecraft:seagrass",
"minecraft:tall_seagrass",
"minecraft:sea_pickle",
"minecraft:kelp",
"minecraft:bamboo",
"minecraft:dandelion",
"minecraft:poppy",
"minecraft:blue_orchid",
"minecraft:allium",
"minecraft:azure_bluet",
"minecraft:red_tulip",
"minecraft:orange_tulip",
"minecraft:white_tulip",
"minecraft:pink_tulip",
"minecraft:oxeye_daisy",
"minecraft:cornflower",
"minecraft:lily_of_the_valley",
"minecraft:brown_mushroom",
"minecraft:red_mushroom",
"minecraft:crimson_fungus",
"minecraft:warped_fungus",
"minecraft:crimson_roots",
"minecraft:warped_roots",
"minecraft:nether_sprouts",
"minecraft:weeping_vines",
"minecraft:twisting_vines",
"minecraft:chorus_plant",
"minecraft:chorus_flower",
"minecraft:snow",
"minecraft:snow_block",
"minecraft:cactus",
"minecraft:vine",
"minecraft:sunflower",
"minecraft:lilac",
"minecraft:rose_bush",
"minecraft:peony",
"minecraft:tall_grass",
"minecraft:large_fern",
"minecraft:air",
"minecraft:ice",
"minecraft:packed_ice",
"minecraft:blue_ice",
"minecraft:portal",
"minecraft:bedrock",
"minecraft:end_portal_frame",
"minecraft:end_portal",
"minecraft:end_gateway",
"minecraft:portal",
"minecraft:oak_sapling",
"minecraft:spruce_sapling",
"minecraft:birch_sapling",
"minecraft:jungle_sapling",
"minecraft:acacia_sapling",
"minecraft:dark_oak_sapling",
"minecraft:oak_leaves",
"minecraft:spruce_leaves",
"minecraft:birch_leaves",
"minecraft:jungle_leaves",
"minecraft:acacia_leaves",
"minecraft:dark_oak_leaves"
)

@JsonSchema(description = "Whether the ship helm assembles diagonally connected blocks or not")
val diagonals = true

Expand All @@ -255,5 +165,10 @@ object EurekaConfig {

@JsonSchema(description = "Maximum number of blocks allowed in a ship. Set to 0 for no limit")
val maxShipBlocks = 32 * 32 * 32

// TODO: Remove blockBlacklist
// Blacklist of blocks that don't get added for ship building
@JsonSchema(description = "Blacklist of blocks that don't get assembled (Use Block Tag instead)")
var blockBlacklist : Set<String> = emptySet()
}
}
4 changes: 2 additions & 2 deletions common/src/main/kotlin/org/valkyrienskies/eureka/EurekaMod.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.valkyrienskies.eureka

import org.valkyrienskies.core.impl.config.VSConfigClass
import org.valkyrienskies.mod.common.ValkyrienSkiesMod

object EurekaMod {
const val MOD_ID = "vs_eureka"
Expand All @@ -13,7 +13,7 @@ object EurekaMod {
EurekaScreens.register()
EurekaEntities.register()
EurekaWeights.register()
VSConfigClass.registerConfig("vs_eureka", EurekaConfig::class.java)
ValkyrienSkiesMod.vsCore.registerConfigLegacy("vs_eureka", EurekaConfig::class.java)
}

@JvmStatic
Expand Down
11 changes: 0 additions & 11 deletions common/src/main/kotlin/org/valkyrienskies/eureka/EurekaWeights.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,10 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties
import org.valkyrienskies.core.apigame.world.chunks.BlockType
import org.valkyrienskies.mod.common.BlockStateInfo
import org.valkyrienskies.mod.common.BlockStateInfoProvider
import org.valkyrienskies.physics_api.Lod1BlockStateId
import org.valkyrienskies.physics_api.Lod1LiquidBlockStateId
import org.valkyrienskies.physics_api.Lod1SolidBlockStateId
import org.valkyrienskies.physics_api.voxel.Lod1LiquidBlockState
import org.valkyrienskies.physics_api.voxel.Lod1SolidBlockState

object EurekaWeights : BlockStateInfoProvider {
override val blockStateData: List<Triple<Lod1SolidBlockStateId, Lod1LiquidBlockStateId, Lod1BlockStateId>>
get() = emptyList()
override val liquidBlockStates: List<Lod1LiquidBlockState>
get() = emptyList()
override val priority: Int
get() = 200
override val solidBlockStates: List<Lod1SolidBlockState>
get() = emptyList()

override fun getBlockStateMass(blockState: BlockState): Double? {
if (blockState.block == EurekaBlocks.BALLAST.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.projectile.Projectile
import net.minecraft.world.level.Level
import net.minecraft.world.level.LevelAccessor
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.BlockHitResult
Expand Down Expand Up @@ -48,7 +47,7 @@ class BalloonBlock(properties: Properties) : Block(properties) {
if (level.isClientSide) return

level.destroyBlock(hit.blockPos, false)
Direction.values().forEach {
Direction.entries.forEach {
val neighbor = hit.blockPos.relative(it)
if (level.getBlockState(neighbor).block == this &&
level.random.nextFloat() < EurekaConfig.SERVER.popSideBalloonChance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import net.minecraft.world.entity.player.StackedContents
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.StackedContentsCompatible
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity
import net.minecraft.world.level.block.entity.BaseContainerBlockEntity
import net.minecraft.world.level.block.entity.FurnaceBlockEntity
import net.minecraft.world.level.block.state.BlockState
import org.joml.Math.lerp
import org.joml.Math.min
Expand All @@ -24,6 +22,7 @@ import org.valkyrienskies.eureka.EurekaBlockEntities
import org.valkyrienskies.eureka.EurekaConfig
import org.valkyrienskies.eureka.EurekaProperties.HEAT
import org.valkyrienskies.eureka.gui.engine.EngineScreenMenu
import org.valkyrienskies.eureka.registry.FuelRegistry
import org.valkyrienskies.eureka.ship.EurekaShipControl
import org.valkyrienskies.eureka.util.KtContainerData
import org.valkyrienskies.mod.common.getShipManagingPos
Expand Down Expand Up @@ -124,7 +123,8 @@ class EngineBlockEntity(pos: BlockPos, state: BlockState) :
* @return scaled fuel ticks.
*/
private fun getScaledFuel(): Int =
((FurnaceBlockEntity.getFuel()[fuel.item] ?: 0) * EurekaConfig.SERVER.engineFuelMultiplier).toInt()
(FuelRegistry.INSTANCE.get(fuel) * EurekaConfig.SERVER.engineFuelMultiplier).toInt()


/**
* Absorb one fuel item into the engine.
Expand Down Expand Up @@ -222,10 +222,10 @@ class EngineBlockEntity(pos: BlockPos, state: BlockState) :

override fun canTakeItemThroughFace(index: Int, stack: ItemStack, direction: Direction): Boolean =
// Allow extraction from slot 0 (fuel slot) when the hopper is below the block entity
index == 0 && direction == Direction.DOWN && !fuel.isEmpty && !AbstractFurnaceBlockEntity.isFuel(fuel)
index == 0 && direction == Direction.DOWN && !fuel.isEmpty && FuelRegistry.INSTANCE.get(fuel) <= 0

override fun canPlaceItem(index: Int, stack: ItemStack): Boolean =
index == 0 && AbstractFurnaceBlockEntity.isFuel(stack)
index == 0 && FuelRegistry.INSTANCE.get(stack) > 0

override fun fillStackedContents(helper: StackedContents) = helper.accountStack(fuel)
// endregion Container Stuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import net.minecraft.core.BlockPos
import net.minecraft.core.Direction.Axis
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerLevel
import net.minecraft.tags.TagKey
import net.minecraft.world.MenuProvider
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.HorizontalDirectionalBlock
import net.minecraft.world.level.block.StairBlock
import net.minecraft.world.level.block.entity.BlockEntity
Expand All @@ -20,9 +23,9 @@ import org.joml.Vector3d
import org.joml.Vector3dc
import org.valkyrienskies.core.api.ships.ServerShip
import org.valkyrienskies.core.api.ships.getAttachment
import org.valkyrienskies.core.impl.util.logger
import org.valkyrienskies.eureka.EurekaBlockEntities
import org.valkyrienskies.eureka.EurekaConfig
import org.valkyrienskies.eureka.EurekaMod
import org.valkyrienskies.eureka.block.ShipHelmBlock
import org.valkyrienskies.eureka.gui.shiphelm.ShipHelmScreenMenu
import org.valkyrienskies.eureka.ship.EurekaShipControl
Expand All @@ -32,6 +35,10 @@ import org.valkyrienskies.mod.common.entity.ShipMountingEntity
import org.valkyrienskies.mod.common.getShipObjectManagingPos
import org.valkyrienskies.mod.common.util.toDoubles
import org.valkyrienskies.mod.common.util.toJOMLD
import org.valkyrienskies.mod.util.logger

// var ASSEMBLE_BLACKLIST: TagKey<Block> =
// TagKey.create(Registry.BLOCK_REGISTRY, ResourceLocation(EurekaMod.MOD_ID, "assemble_blacklist"))

class ShipHelmBlockEntity(pos: BlockPos, state: BlockState) :
BlockEntity(EurekaBlockEntities.SHIP_HELM.get(), pos, state), MenuProvider {
Expand Down Expand Up @@ -119,14 +126,24 @@ class ShipHelmBlockEntity(pos: BlockPos, state: BlockState) :
val blockState = level.getBlockState(blockPos)
if (blockState.block !is ShipHelmBlock) return

var helmCount = 0
val builtShip = ShipAssembler.collectBlocks(
level,
blockPos
) { !it.isAir && !EurekaConfig.SERVER.blockBlacklist.contains(BuiltInRegistries.BLOCK.getKey(it.block).toString()) }
) {
val allowed = !it.isAir && !EurekaConfig.SERVER.blockBlacklist.contains(BuiltInRegistries.BLOCK.getKey(it.block).toString())
// This isn't the best way to count helms, but it'll work I promise!
if (allowed && it.block is ShipHelmBlock) {
helmCount++
}
return@collectBlocks allowed
}

if (builtShip == null) {
player.displayClientMessage(Component.translatable("Ship is too big! Max size is ${EurekaConfig.SERVER.maxShipBlocks} blocks (changeable in the config)"), true)
logger.warn("Failed to assemble ship for ${player.name.string}")
} else {
EurekaShipControl.getOrCreate(builtShip).helms = helmCount
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.FurnaceFuelSlot.isBucket
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity
import org.valkyrienskies.eureka.EurekaScreens
import org.valkyrienskies.eureka.blockentity.EngineBlockEntity
import org.valkyrienskies.eureka.registry.FuelRegistry
import org.valkyrienskies.eureka.util.KtContainerData
import org.valkyrienskies.eureka.util.inventorySlots

Expand Down Expand Up @@ -39,7 +39,7 @@ class EngineScreenMenu(syncId: Int, playerInv: Inventory, val blockEntity: Engin

override fun quickMoveStack(player: Player, index: Int): ItemStack {
val slot = this.slots[index]
if (slot != null && slot.hasItem() && (AbstractFurnaceBlockEntity.isFuel(slot.item) || isBucket(slot.item))) {
if (slot != null && slot.hasItem() && (isBucket(slot.item) || FuelRegistry.INSTANCE.get(slot.item) > 0 )) {
if (index != 0) {
this.moveItemStackTo(slot.item, 0, 1, false)
slot.setChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import net.minecraft.world.Container
import net.minecraft.world.inventory.Slot
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity
import org.valkyrienskies.eureka.registry.FuelRegistry

class FuelSlot(container: Container, slot: Int, x: Int, y: Int) : Slot(container, slot, x, y) {
override fun mayPlace(stack: ItemStack): Boolean {
return AbstractFurnaceBlockEntity.isFuel(stack) || isBucket(stack)
return FuelRegistry.INSTANCE.get(stack) > 0 || isBucket(stack)
}

override fun getMaxStackSize(stack: ItemStack): Int {
Expand Down
Loading

0 comments on commit d253add

Please sign in to comment.