Merge remote-tracking branch 'origin/1.21' into 1.21
This commit is contained in:
commit
f03081f0f2
@ -52,6 +52,7 @@ import ru.dbotthepony.mc.otm.datagen.tags.addDyeTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addEquipmentTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addMineableTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addResourceTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addStructureTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addSuspiciousTags
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.addTags
|
||||
import ru.dbotthepony.mc.otm.matter.MatterDataProvider
|
||||
@ -533,6 +534,7 @@ object DataGen {
|
||||
addEquipmentTags(tagsProvider)
|
||||
addMineableTags(tagsProvider)
|
||||
addDyeTags(tagsProvider)
|
||||
addStructureTags(tagsProvider)
|
||||
|
||||
event.generator.addProvider(event.includeClient(), blockModelProvider)
|
||||
event.generator.addProvider(event.includeServer(), blockStateProvider)
|
||||
|
@ -1183,6 +1183,13 @@ private fun jade(provider: MatteryLanguageProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun maps(provider: MatteryLanguageProvider) {
|
||||
with(provider.english) {
|
||||
map("laboratory", "Laboratory Map")
|
||||
map("wreckage", "Wreckage Map")
|
||||
}
|
||||
}
|
||||
|
||||
fun AddEnglishLanguage(provider: MatteryLanguageProvider) {
|
||||
decoratives(provider)
|
||||
sounds(provider)
|
||||
@ -1199,6 +1206,8 @@ fun AddEnglishLanguage(provider: MatteryLanguageProvider) {
|
||||
|
||||
jade(provider)
|
||||
|
||||
maps(provider)
|
||||
|
||||
with(provider.english) {
|
||||
add("itemGroup.otm", "Overdrive That Matters")
|
||||
add("itemGroup.otm_decorative", "Overdrive That Matters Decorative")
|
||||
|
@ -107,6 +107,8 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
|
||||
fun jade(key: String, value: String) = slave.add("otm.jade.$key", value)
|
||||
fun jadeloc(key: String, value: String) = slave.add("config.jade.plugin_${DataGen.MOD_ID}.$key", value)
|
||||
|
||||
fun map(key: String, value: String) = slave.add("filled_map.otm_$key", value)
|
||||
|
||||
inner class Prepended(path: String) {
|
||||
val path = "$path."
|
||||
constructor(vararg path: String) : this(path.joinToString("."))
|
||||
|
@ -1169,6 +1169,13 @@ private fun jade(provider: MatteryLanguageProvider) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun maps(provider: MatteryLanguageProvider) {
|
||||
with(provider.russian) {
|
||||
map("laboratory", "Карта лаборатории")
|
||||
map("wreckage", "Карта кораблекрушения")
|
||||
}
|
||||
}
|
||||
|
||||
fun AddRussianLanguage(provider: MatteryLanguageProvider) {
|
||||
decoratives(provider)
|
||||
blocks(provider)
|
||||
@ -1181,4 +1188,5 @@ fun AddRussianLanguage(provider: MatteryLanguageProvider) {
|
||||
death(provider)
|
||||
androidFeatures(provider)
|
||||
jade(provider)
|
||||
maps(provider)
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.tags
|
||||
|
||||
import ru.dbotthepony.mc.otm.registry.MStructureTags
|
||||
import ru.dbotthepony.mc.otm.registry.game.MStructures
|
||||
|
||||
fun addStructureTags(tagsProvider: TagsProvider) {
|
||||
tagsProvider.structures.Appender(MStructureTags.LABORATORIES).add(MStructures.LABORATORY)
|
||||
|
||||
tagsProvider.structures.Appender(MStructureTags.FIELD_RESEARCH_PODS)
|
||||
.add(MStructures.FIELD_RESEARCH_POD)
|
||||
.add(MStructures.FIELD_RESEARCH_POD_RUIN)
|
||||
|
||||
tagsProvider.structures.Appender(MStructureTags.WRECKAGES).add(MStructures.WRECKAGE)
|
||||
}
|
@ -185,6 +185,7 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
val mobEffects = Delegate(BuiltInRegistries.MOB_EFFECT)
|
||||
val entityTypes = Delegate(BuiltInRegistries.ENTITY_TYPE)
|
||||
val damageTypes = Delegate(Registries.DAMAGE_TYPE)
|
||||
val structures = Delegate(Registries.STRUCTURE)
|
||||
|
||||
private val coloredItems = EnumMap<DyeColor, Delegate<Item>.Appender>(DyeColor::class.java)
|
||||
|
||||
|
@ -241,6 +241,8 @@ object OverdriveThatMatters {
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, NotNormalFood::onInteract)
|
||||
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, MStructureTags::registerVillagerTrades)
|
||||
|
||||
if (isCuriosLoaded) {
|
||||
FORGE_BUS.addListener(EventPriority.NORMAL, ::onCuriosSlotModifiersUpdated)
|
||||
}
|
||||
|
@ -192,6 +192,8 @@ class GrillBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryBloc
|
||||
level!!.setBlock(blockPos, blockState.set(GrillBlock.STATE_PROPERTY, GrillBlock.State.FUELED), Block.UPDATE_ALL)
|
||||
}
|
||||
}
|
||||
|
||||
markDirtyFast()
|
||||
} else {
|
||||
fuelTotalTicks = 0
|
||||
|
||||
|
@ -37,6 +37,13 @@ class FlywheelBatteryBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
|
||||
private var multiblock: ShapedMultiblock? = null
|
||||
private var lastHeight = -1
|
||||
var batteryLevel = Decimal.ZERO
|
||||
set(value) {
|
||||
if (field != value) {
|
||||
field = value
|
||||
markDirtyFast()
|
||||
}
|
||||
}
|
||||
|
||||
private var cachedChargeEfficiency = Decimal.ONE
|
||||
|
||||
val formed: Boolean
|
||||
|
@ -188,24 +188,6 @@ fun <T : Enum<T>> T.prev(values: Array<out T>): T {
|
||||
return values[next]
|
||||
}
|
||||
|
||||
fun IntArray.shuffle(random: RandomGenerator) {
|
||||
for (i in lastIndex downTo 1) {
|
||||
val j = random.nextInt(i + 1)
|
||||
val copy = this[i]
|
||||
this[i] = this[j]
|
||||
this[j] = copy
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> MutableList<T>.shuffle(random: RandomGenerator) {
|
||||
for (i in lastIndex downTo 1) {
|
||||
val j = random.nextInt(i + 1)
|
||||
val copy = this[i]
|
||||
this[i] = this[j]
|
||||
this[j] = copy
|
||||
}
|
||||
}
|
||||
|
||||
fun IntArray.shuffle(random: RandomSource) {
|
||||
for (i in lastIndex downTo 1) {
|
||||
val j = random.nextInt(i + 1)
|
||||
@ -216,12 +198,7 @@ fun IntArray.shuffle(random: RandomSource) {
|
||||
}
|
||||
|
||||
fun <T> MutableList<T>.shuffle(random: RandomSource) {
|
||||
for (i in lastIndex downTo 1) {
|
||||
val j = random.nextInt(i + 1)
|
||||
val copy = this[i]
|
||||
this[i] = this[j]
|
||||
this[j] = copy
|
||||
}
|
||||
return Util.shuffle(this, random)
|
||||
}
|
||||
|
||||
fun <T> List<T>.random(random: RandomGenerator): T {
|
||||
|
@ -7,8 +7,8 @@ import net.minecraft.world.level.levelgen.PositionalRandomFactory
|
||||
import java.lang.StringBuilder
|
||||
import java.util.random.RandomGenerator
|
||||
|
||||
class CMWCRandom(seed: Long = System.nanoTime(), private val stateSize: Int = CMWC_DEFAULT_STATE_SIZE) : RandomGenerator, RandomSource {
|
||||
private val state = IntArray(stateSize)
|
||||
class CMWCRandom(seed: Long = System.nanoTime()) : RandomGenerator, RandomSource {
|
||||
private val state = IntArray(CMWC_STATE_SIZE)
|
||||
private var carry = 0
|
||||
private var stateIndex = 0
|
||||
private val gaussian = MarsagliaPolarGaussian(this)
|
||||
@ -37,7 +37,7 @@ class CMWCRandom(seed: Long = System.nanoTime(), private val stateSize: Int = CM
|
||||
}
|
||||
|
||||
override fun nextInt(): Int {
|
||||
stateIndex = (stateIndex + 1) % state.size
|
||||
stateIndex = (stateIndex + 1).and(CMWC_STATE_SIZE - 1)
|
||||
val t = 18782L * state[stateIndex] + carry
|
||||
|
||||
carry = t.ushr(32).toInt()
|
||||
@ -83,24 +83,24 @@ class CMWCRandom(seed: Long = System.nanoTime(), private val stateSize: Int = CM
|
||||
}
|
||||
|
||||
override fun fork(): RandomSource {
|
||||
return CMWCRandom(nextLong(), stateSize)
|
||||
return CMWCRandom(nextLong())
|
||||
}
|
||||
|
||||
override fun forkPositional(): PositionalRandomFactory {
|
||||
return Positional(nextLong(), stateSize)
|
||||
return Positional(nextLong())
|
||||
}
|
||||
|
||||
class Positional(val seed: Long, val stateSize: Int = CMWC_DEFAULT_STATE_SIZE) : PositionalRandomFactory {
|
||||
class Positional(val seed: Long) : PositionalRandomFactory {
|
||||
override fun at(x: Int, y: Int, z: Int): RandomSource {
|
||||
return CMWCRandom(Mth.getSeed(x, y, z).xor(seed), stateSize)
|
||||
return CMWCRandom(Mth.getSeed(x, y, z).xor(seed))
|
||||
}
|
||||
|
||||
override fun fromHashOf(name: String): RandomSource {
|
||||
return CMWCRandom(name.hashCode().toLong().xor(seed), stateSize)
|
||||
return CMWCRandom(name.hashCode().toLong().xor(seed))
|
||||
}
|
||||
|
||||
override fun fromSeed(seed: Long): RandomSource {
|
||||
return CMWCRandom(seed, stateSize)
|
||||
return CMWCRandom(seed)
|
||||
}
|
||||
|
||||
override fun parityConfigString(builder: StringBuilder) {
|
||||
@ -109,7 +109,7 @@ class CMWCRandom(seed: Long = System.nanoTime(), private val stateSize: Int = CM
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val CMWC_DEFAULT_STATE_SIZE = 256 // 4096
|
||||
const val CMWC_STATE_SIZE = 256 // 4096
|
||||
const val CMWC_CARRY_MAX = 809430660
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.entity.npc.VillagerProfession
|
||||
import net.minecraft.world.entity.npc.VillagerTrades
|
||||
import net.minecraft.world.level.levelgen.structure.Structure
|
||||
import net.minecraft.world.level.saveddata.maps.MapDecorationTypes
|
||||
import net.neoforged.neoforge.event.village.VillagerTradesEvent
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
|
||||
|
||||
object MStructureTags {
|
||||
val LABORATORIES = create("laboratories")
|
||||
val FIELD_RESEARCH_PODS = create("field_research_pods")
|
||||
val WRECKAGES = create("wreckages")
|
||||
|
||||
fun create(location: String): TagKey<Structure> {
|
||||
return TagKey.create(Registries.STRUCTURE, loc(location))
|
||||
}
|
||||
|
||||
fun registerVillagerTrades(event: VillagerTradesEvent) {
|
||||
if (event.type == VillagerProfession.CARTOGRAPHER) {
|
||||
with (event.trades.get(2)) {
|
||||
add(VillagerTrades.TreasureMapForEmeralds(10, WRECKAGES, "filled_map.otm_wreckage",
|
||||
MapDecorationTypes.RED_X, 12, 5))
|
||||
}
|
||||
with (event.trades.get(3)) {
|
||||
add(VillagerTrades.TreasureMapForEmeralds(25, LABORATORIES, "filled_map.otm_laboratory",
|
||||
MapDecorationTypes.LIGHT_BLUE_BANNER, 12, 10))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package ru.dbotthepony.mc.otm.registry.game
|
||||
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.world.level.levelgen.structure.Structure
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
|
||||
|
||||
object MStructures {
|
||||
val CARGO_CONTAINER = create("cargo_container")
|
||||
val FIELD_RESEARCH_POD = create("field_research_pod")
|
||||
val FIELD_RESEARCH_POD_RUIN = create("field_research_pod_ruin")
|
||||
val FRIGATE = create("frigate")
|
||||
val FUEL_BASE = create("fuel_base")
|
||||
val LABORATORY = create("laboratory")
|
||||
val OCEAN_CONTAINER = create("ocean_container")
|
||||
val WRECKAGE = create("wreckage")
|
||||
|
||||
fun create(location: String): ResourceKey<Structure> {
|
||||
return ResourceKey.create(Registries.STRUCTURE, loc(location))
|
||||
}
|
||||
}
|
@ -174,3 +174,5 @@ public net.minecraft.advancements.critereon.InventoryChangeTrigger$TriggerInstan
|
||||
#public-f net.minecraft.advancements.critereon.SimpleCriterionTrigger addPlayerListener(Lnet/minecraft/server/PlayerAdvancements;Lnet/minecraft/advancements/CriterionTrigger$Listener;)V
|
||||
#public-f net.minecraft.advancements.critereon.SimpleCriterionTrigger removePlayerListener(Lnet/minecraft/server/PlayerAdvancements;Lnet/minecraft/advancements/CriterionTrigger$Listener;)V
|
||||
#public-f net.minecraft.advancements.critereon.SimpleCriterionTrigger removePlayerListeners(Lnet/minecraft/server/PlayerAdvancements;)V
|
||||
|
||||
public net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds
|
||||
|
Loading…
Reference in New Issue
Block a user