Compare commits
296 Commits
Author | SHA1 | Date | |
---|---|---|---|
33a1145bc5 | |||
29daea9bce | |||
ecb8a8ecd0 | |||
c83476225d | |||
9f9a140432 | |||
69172b58e6 | |||
f0846a7b3a | |||
f8277e55c3 | |||
9366267a63 | |||
57c1644ccc | |||
e9f4b22cb8 | |||
49dd781a82 | |||
a2465b0dc2 | |||
ed8faa11a5 | |||
eeb5d3ba73 | |||
0f355150a2 | |||
baeef3816f | |||
9264e24c42 | |||
65dbeeeb4f | |||
f6138671d2 | |||
34b60be434 | |||
6153c2e972 | |||
433fec51b2 | |||
0b91f54863 | |||
d75c6e2016 | |||
5fde1376b9 | |||
b6ef6c5e8e | |||
376e548cec | |||
4244a226e5 | |||
2e427f05b1 | |||
5829dc8e5a | |||
653ecedafb | |||
e8d5c96147 | |||
cc3d7535fc | |||
53b9a7ec02 | |||
5f6fb9c731 | |||
87e64a102a | |||
0b7e54b4ef | |||
f0dba4ccc3 | |||
854339fdbb | |||
b4c4410432 | |||
5eb78b6e9c | |||
b35dfaeacd | |||
327963f4e5 | |||
b4ae0bb6ae | |||
6e143e072d | |||
6a2eb3dec2 | |||
5fd6df3447 | |||
4d26cffbc8 | |||
410ba675ea | |||
ce94d22212 | |||
829c4e68ef | |||
d9b18ddaa6 | |||
fccf97c4c8 | |||
21b84651a8 | |||
fb3e556523 | |||
c3373bca30 | |||
55c975f1e8 | |||
80917f7d12 | |||
65914a9d03 | |||
c652f8d6d4 | |||
07bc48887e | |||
12b10ee6fe | |||
e5c67d2085 | |||
a045791714 | |||
46bc642385 | |||
9e72d73bfd | |||
a88549f17f | |||
5552be70d5 | |||
d4dc6b09c3 | |||
c210e9f842 | |||
d29f68fc4e | |||
cb386d39f5 | |||
6d007f4a27 | |||
55e6a4cb19 | |||
6bbe2f2750 | |||
22c3c22081 | |||
558e40bf58 | |||
d38df3d927 | |||
562e6c509f | |||
0da77bc453 | |||
c9d56f9204 | |||
5645d5f56f | |||
4a606b8d36 | |||
f2aade3a8e | |||
46820a311f | |||
48a756ea93 | |||
abd6a93fd4 | |||
19b4942c90 | |||
3743a3402d | |||
f4c9f9d057 | |||
c17e0aac04 | |||
d88801d8bf | |||
055b9cc489 | |||
241f13914d | |||
f1df27d5d7 | |||
640f62d63b | |||
c0a7559d3d | |||
f115f1f4a7 | |||
44183a45a8 | |||
c88023470f | |||
d3423a6160 | |||
55c0be74d3 | |||
abe3681ecc | |||
667dcf6b58 | |||
a59fe8c256 | |||
9d9b19da9d | |||
8430e2bf79 | |||
eb460d04ec | |||
6dce3a37e6 | |||
652acf3ce1 | |||
f2afd5b350 | |||
9dbf40f170 | |||
6eb3700f88 | |||
101e57756a | |||
fdb2a4f15f | |||
f165c0fbdc | |||
0695f613d3 | |||
67dbcde6dc | |||
3f5339ac9f | |||
1967373a9d | |||
04ce837b02 | |||
b4c994f02f | |||
d8b71adf1a | |||
a1f29021c6 | |||
ef997ca1fe | |||
8007c1757e | |||
02ed016bf9 | |||
f3f8155027 | |||
7e6a150ab7 | |||
8aafa38c27 | |||
59d69367dc | |||
8097551fd3 | |||
cc164f669d | |||
e51ba7015a | |||
c1a224f677 | |||
1efa604578 | |||
9fe99e92f7 | |||
ee624f1b3f | |||
1d0e24095a | |||
c4b686d621 | |||
185e70c93a | |||
8f8fd8c8de | |||
2b884739f4 | |||
a7d405b5ea | |||
dd331e0881 | |||
a4b3d2ba8a | |||
74183f0982 | |||
8ee5e94a78 | |||
5f337b1d1f | |||
53ee56fdd5 | |||
d10ce72a0e | |||
cae867cb4d | |||
76c4c3e6a2 | |||
a68c08ecf8 | |||
f9dcf43cc4 | |||
42fe77e6b4 | |||
b86a982245 | |||
39ed6ccc06 | |||
0f14c3eaa0 | |||
9e9c4168d6 | |||
bc59853f4e | |||
9b80162a03 | |||
b28e180704 | |||
2deaef94aa | |||
b0ca9320ca | |||
2ae5166a01 | |||
cac468685e | |||
78ac178526 | |||
824b63b012 | |||
d06f3b5856 | |||
37ce7343d4 | |||
a8121bf81b | |||
0944e55141 | |||
c98562f2cb | |||
92f2680feb | |||
eec2f99188 | |||
783c2bde34 | |||
b8f98f0e9e | |||
077e82064b | |||
5e73687068 | |||
b763a7d1be | |||
5f60ae1896 | |||
cae417b3b4 | |||
fd831c74ea | |||
8d42686cc5 | |||
62cc823e29 | |||
c821fa76a6 | |||
672123850b | |||
57cc9730f8 | |||
1d68f32b19 | |||
d710b23223 | |||
5971db9a24 | |||
ccb5914bb2 | |||
6b6f9f8062 | |||
6e4bf4e7ec | |||
ae544e8844 | |||
03ea3a3a5c | |||
3819e5c49b | |||
d96a0e1a63 | |||
5b45cf7d0a | |||
4e1a40279b | |||
ea448788c5 | |||
37e7f42587 | |||
99cefc2ffc | |||
34a9bfd48a | |||
7f15ae6a3a | |||
edea36a8a6 | |||
477f9c3a67 | |||
f183e2a008 | |||
2220a7039f | |||
fa67353eae | |||
da901cee87 | |||
c1d6f7c061 | |||
1fa988e5fd | |||
11e66d50a4 | |||
e00f79c736 | |||
09f4db3fa9 | |||
3fc9435259 | |||
d24a72d435 | |||
9956aa1ba4 | |||
036de121c7 | |||
20469a14dd | |||
8a891e6ffb | |||
ad76b4cabc | |||
9cf66e443e | |||
2506f0fe0e | |||
2aa084290b | |||
b9f6b65900 | |||
41ce2841b1 | |||
a5ba27cf63 | |||
7b415fbce3 | |||
2a117a540e | |||
df15bd2f69 | |||
3dab053420 | |||
7258e1e4d3 | |||
34ef50f6ee | |||
4c5c2362ce | |||
0a5ae54614 | |||
45dd3e5c4b | |||
5ad9d49537 | |||
54fa8a252e | |||
4e3ca82fc7 | |||
d84af00876 | |||
a9cb2db3b4 | |||
454e4f6a63 | |||
6dbd942626 | |||
748a232569 | |||
da4c1108c2 | |||
c4bcab44e4 | |||
8e469c309d | |||
f3bf84a7a2 | |||
b6643a6dd3 | |||
31268e33ef | |||
86c426a504 | |||
afe7d698c8 | |||
0bcc078fe9 | |||
e3e02dbad2 | |||
e563b85946 | |||
cc82146f0a | |||
f4ec4c9066 | |||
108b49bedb | |||
1a5a9a6303 | |||
bf46ac0647 | |||
71850b38e5 | |||
796f29127f | |||
8c43a3ec6d | |||
477e782c7c | |||
65cf8bf9df | |||
e5a982ae13 | |||
f942093e4f | |||
5d15611f84 | |||
1803d687ab | |||
347be35184 | |||
aa0a283e06 | |||
98fcacc9a8 | |||
422ae92303 | |||
7683cacc29 | |||
520112df77 | |||
5453c8c793 | |||
3c5ea937a5 | |||
f16483d7c0 | |||
8072a7b135 | |||
44c6d0c0cf | |||
27dce0bd31 | |||
8abb4e1598 | |||
1cbf73cdfd | |||
b97e18ca5f | |||
0da87980f7 | |||
cbaf89d4a7 | |||
006cbc75e3 | |||
275e340243 | |||
3dcaed64cd | |||
04a5e87fec | |||
36c14be025 | |||
26a064fbe2 |
@ -150,14 +150,13 @@ dependencies {
|
||||
val configured_id: String by project
|
||||
val curios_version: String by project
|
||||
val jei_mc_version: String by project
|
||||
val curios_mc_version: String by project
|
||||
val resourceful_lib_id: String by project
|
||||
val resourceful_config_id: String by project
|
||||
val botarium_id: String by project
|
||||
val ad_astra_id: String by project
|
||||
val worldedit_id: String by project
|
||||
|
||||
compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_mc_version}"))
|
||||
compileOnly(fg.deobf("curse.maven:curios-309927:${curios_version}"))
|
||||
compileOnly(fg.deobf("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id"))
|
||||
|
||||
compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"))
|
||||
@ -167,13 +166,14 @@ dependencies {
|
||||
// runtimeOnly(fg.deobf("ru.dbotthepony:particle-collider:0.4.5"))
|
||||
|
||||
implementation(fg.deobf("curse.maven:jade-324717:${jade_id}"))
|
||||
implementation(fg.deobf("curse.maven:spit-it-out-857141:4888738"))
|
||||
//runtimeOnly(fg.deobf("curse.maven:configured-457570:${configured_id}"))
|
||||
|
||||
compileOnly(fg.deobf("curse.maven:resourceful-lib-570073:${resourceful_lib_id}"))
|
||||
compileOnly(fg.deobf("curse.maven:resourceful-config-714059:${resourceful_config_id}"))
|
||||
compileOnly(fg.deobf("curse.maven:botarium-704113:${botarium_id}"))
|
||||
compileOnly(fg.deobf("curse.maven:ad-astra-635042:${ad_astra_id}"))
|
||||
runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_id}"))
|
||||
// runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_id}"))
|
||||
|
||||
// runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_fileid}"))
|
||||
// runtimeOnly(fg.deobf("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
|
||||
|
@ -10,30 +10,30 @@ mod_version=1.4
|
||||
|
||||
use_commit_hash_in_version=true
|
||||
|
||||
mc_version=1.20.2
|
||||
jei_mc_version=1.20.2
|
||||
curios_mc_version=1.20.2
|
||||
mc_version=1.19.2
|
||||
jei_mc_version=1.19.2
|
||||
curios_mc_version=1.19.2
|
||||
|
||||
forge_gradle_version=[6.0.14,6.2)
|
||||
forge_version=48.1.0
|
||||
forge_version=43.3.7
|
||||
mixingradle_version=0.7.33
|
||||
mixin_version=0.8.5
|
||||
|
||||
kommons_version=3.0.2
|
||||
|
||||
jei_version=16.0.0.28
|
||||
jei_version=11.6.0.1018
|
||||
jupiter_version=5.9.2
|
||||
curios_version=6.0.2
|
||||
cosmetic_armor_reworked_id=4764779
|
||||
ad_astra_id=4594155
|
||||
botarium_id=4594094
|
||||
resourceful_lib_id=4598948
|
||||
resourceful_config_id=4576455
|
||||
jade_id=4818518
|
||||
curios_version=4985476
|
||||
cosmetic_armor_reworked_id=4016732
|
||||
ad_astra_id=4643668
|
||||
botarium_id=4306551
|
||||
resourceful_lib_id=4477753
|
||||
resourceful_config_id=4444198
|
||||
jade_id=4914105
|
||||
configured_id=4462894
|
||||
worldedit_id=4807512
|
||||
worldedit_id=3922622
|
||||
|
||||
kotlin_for_forge_version=4.7.0
|
||||
kotlin_version=1.9.0
|
||||
kotlin_for_forge_version=3.12.0
|
||||
kotlin_version=1.8.21
|
||||
|
||||
handle_deps=true
|
||||
|
@ -1,55 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.datagen
|
||||
|
||||
import net.minecraft.core.RegistrySetBuilder
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.data.worldgen.BootstapContext
|
||||
import net.minecraft.tags.DamageTypeTags
|
||||
import net.minecraft.world.damagesource.DamageScaling
|
||||
import net.minecraft.world.damagesource.DamageType
|
||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
|
||||
fun registerDamageTypes(context: BootstapContext<DamageType>) {
|
||||
context.register(MDamageTypes.EXOPACK_PROBE, DamageType("otm_exopack_probe", DamageScaling.NEVER, 4.0f))
|
||||
context.register(MDamageTypes.BECOME_ANDROID, DamageType("otm_become_android", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.BECOME_HUMANE, DamageType("otm_become_humane", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.EVENT_HORIZON, DamageType("otm_event_horizon", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.HAWKING_RADIATION, DamageType("otm_hawking_radiation", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.EMP, DamageType("otm_emp", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.SHOCKWAVE, DamageType("otm_shockwave", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.PLASMA, DamageType("otm_plasma", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.COSMIC_RAYS, DamageType("otm_cosmic_rays", DamageScaling.NEVER, 0f))
|
||||
context.register(MDamageTypes.EXPLOSIVE_HAMMER, DamageType("otm_explosive_hammer", DamageScaling.NEVER, 0.1f))
|
||||
context.register(MDamageTypes.HAMMER_NAIL, DamageType("otm_hammer_nail", DamageScaling.NEVER, 0.1f))
|
||||
context.register(MDamageTypes.ANDROID_DISCHARGE, DamageType("otm_android_discharge", DamageScaling.NEVER, 4.0f))
|
||||
}
|
||||
|
||||
fun registerDamageTypeTags(provider: TagsProvider.Delegate<DamageType>) {
|
||||
val ignoreArmor = provider.Appender(DamageTypeTags.BYPASSES_ARMOR)
|
||||
val ignoreMagic = provider.Appender(DamageTypeTags.BYPASSES_ENCHANTMENTS)
|
||||
val ignoreInvl = provider.Appender(DamageTypeTags.BYPASSES_INVULNERABILITY)
|
||||
|
||||
ignoreArmor
|
||||
.add(MDamageTypes.EXOPACK_PROBE)
|
||||
.add(MDamageTypes.BECOME_ANDROID)
|
||||
.add(MDamageTypes.BECOME_HUMANE)
|
||||
.add(MDamageTypes.EVENT_HORIZON)
|
||||
.add(MDamageTypes.EMP)
|
||||
.add(MDamageTypes.SHOCKWAVE)
|
||||
.add(MDamageTypes.COSMIC_RAYS)
|
||||
.add(MDamageTypes.ANDROID_DISCHARGE)
|
||||
|
||||
ignoreMagic
|
||||
.add(MDamageTypes.EXOPACK_PROBE)
|
||||
.add(MDamageTypes.BECOME_ANDROID)
|
||||
.add(MDamageTypes.BECOME_HUMANE)
|
||||
.add(MDamageTypes.COSMIC_RAYS)
|
||||
.add(MDamageTypes.ANDROID_DISCHARGE)
|
||||
|
||||
ignoreInvl
|
||||
.add(MDamageTypes.BECOME_HUMANE)
|
||||
.add(MDamageTypes.BECOME_ANDROID)
|
||||
.add(MDamageTypes.ANDROID_DISCHARGE)
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.datagen
|
||||
|
||||
import net.minecraft.core.RegistrySetBuilder
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.advancements.Advancement
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.data.advancements.AdvancementProvider
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -15,8 +16,7 @@ import net.minecraft.world.level.block.state.properties.DoorHingeSide
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
|
||||
import net.minecraft.world.level.block.state.properties.Half
|
||||
import net.minecraftforge.client.model.generators.ModelFile
|
||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
|
||||
import net.minecraftforge.common.data.ForgeAdvancementProvider
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
@ -51,6 +51,7 @@ import ru.dbotthepony.mc.otm.datagen.tags.addTags
|
||||
import ru.dbotthepony.mc.otm.matter.MatterDataProvider
|
||||
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
|
||||
import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock
|
||||
import java.util.function.Consumer
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
internal fun modLocation(string: String) = ResourceLocation(DataGen.MOD_ID, string)
|
||||
@ -504,12 +505,12 @@ object DataGen {
|
||||
this.matterData = matterData
|
||||
|
||||
val tagsProvider = TagsProvider(event)
|
||||
val advancementProvider = object : ForgeAdvancementProvider(event.generator.packOutput, event.lookupProvider, event.existingFileHelper, listOf(
|
||||
AdvancementGenerator { registries, saver, existingFileHelper ->
|
||||
addAdvancements(saver, languageProvider)
|
||||
addAndroidAdvancements(saver, languageProvider)
|
||||
val advancementProvider = object : AdvancementProvider(event.generator, event.existingFileHelper) {
|
||||
override fun registerAdvancements(consumer: Consumer<Advancement>, fileHelper: ExistingFileHelper) {
|
||||
addAdvancements(consumer, languageProvider)
|
||||
addAndroidAdvancements(consumer, languageProvider)
|
||||
}
|
||||
)) {}
|
||||
}
|
||||
|
||||
addTags(tagsProvider)
|
||||
|
||||
@ -517,9 +518,9 @@ object DataGen {
|
||||
event.generator.addProvider(event.includeServer(), blockStateProvider)
|
||||
event.generator.addProvider(event.includeClient(), itemModelProvider)
|
||||
event.generator.addProvider(event.includeServer(), recipeProvider)
|
||||
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), MatterBankProvider(event, it)) }
|
||||
DyeColor.values().forEach { event.generator.addProvider(event.includeClient(), MatterBankProvider(event, it)) }
|
||||
event.generator.addProvider(event.includeClient(), MatterBankProvider(event, null))
|
||||
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, it)) }
|
||||
DyeColor.values().forEach { event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, it)) }
|
||||
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, null))
|
||||
event.generator.addProvider(event.includeServer(), lootTableProvider)
|
||||
event.generator.addProvider(event.includeServer(), lootModifier)
|
||||
@ -528,16 +529,6 @@ object DataGen {
|
||||
event.generator.addProvider(event.includeServer(), advancementProvider)
|
||||
event.generator.addProvider(event.includeServer(), matterData)
|
||||
|
||||
val registrySetBuilder = RegistrySetBuilder()
|
||||
.add(Registries.DAMAGE_TYPE, ::registerDamageTypes)
|
||||
.add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures)
|
||||
.add(Registries.PLACED_FEATURE, ::registerPlacedFeatures)
|
||||
.add(ForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers)
|
||||
|
||||
event.generator.addProvider(event.includeServer(), DatapackBuiltinEntriesProvider(event.generator.packOutput, event.lookupProvider, registrySetBuilder, setOf(MOD_ID)))
|
||||
|
||||
registerDamageTypeTags(tagsProvider.damageTypes)
|
||||
|
||||
AddEnglishLanguage(languageProvider)
|
||||
AddRussianLanguage(languageProvider)
|
||||
|
||||
@ -546,7 +537,7 @@ object DataGen {
|
||||
|
||||
trapdoor(MBlocks.TRITANIUM_TRAPDOOR[null]!!, modLocation("block/decorative/tritanium_trapdoor"))
|
||||
|
||||
for (color in DyeColor.entries)
|
||||
for (color in DyeColor.values())
|
||||
trapdoor(MBlocks.TRITANIUM_TRAPDOOR[color]!!, modLocation("block/decorative/tritanium_trapdoor_${color.name.lowercase()}"))
|
||||
|
||||
addBlockModels(blockModelProvider)
|
||||
|
@ -1,102 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.datagen
|
||||
|
||||
import net.minecraft.core.HolderSet
|
||||
import net.minecraft.core.RegistrySetBuilder
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.data.worldgen.BootstapContext
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.tags.BiomeTags
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.world.level.levelgen.GenerationStep
|
||||
import net.minecraft.world.level.levelgen.VerticalAnchor
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature
|
||||
import net.minecraft.world.level.levelgen.feature.Feature
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration
|
||||
import net.minecraft.world.level.levelgen.placement.CountPlacement
|
||||
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
|
||||
import net.minecraft.world.level.levelgen.placement.InSquarePlacement
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest
|
||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
|
||||
import net.minecraftforge.common.world.BiomeModifier
|
||||
import net.minecraftforge.common.world.ForgeBiomeModifiers
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
|
||||
private object ConfiguredFeatures {
|
||||
val TRITANIUM_ORE = key("tritanium_ore")
|
||||
|
||||
private fun key(name: String): ResourceKey<ConfiguredFeature<*, *>> {
|
||||
return ResourceKey.create(Registries.CONFIGURED_FEATURE, modLocation(name))
|
||||
}
|
||||
}
|
||||
|
||||
fun registerConfiguredFeatures(context: BootstapContext<ConfiguredFeature<*, *>>) {
|
||||
val stone = TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)
|
||||
val deepslate = TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)
|
||||
|
||||
val target = listOf(
|
||||
OreConfiguration.target(stone, MBlocks.TRITANIUM_ORE.defaultBlockState()),
|
||||
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_TRITANIUM_ORE.defaultBlockState()),
|
||||
)
|
||||
|
||||
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
|
||||
}
|
||||
|
||||
private object PlacedFeatures {
|
||||
val NORMAL_TRITANIUM = key("normal_tritanium")
|
||||
val DEEP_TRITANIUM = key("deep_tritanium")
|
||||
|
||||
private fun key(name: String): ResourceKey<PlacedFeature> {
|
||||
return ResourceKey.create(Registries.PLACED_FEATURE, modLocation(name))
|
||||
}
|
||||
}
|
||||
|
||||
fun registerPlacedFeatures(context: BootstapContext<PlacedFeature>) {
|
||||
val configured = context.lookup(Registries.CONFIGURED_FEATURE)
|
||||
val ore = configured.getOrThrow(ConfiguredFeatures.TRITANIUM_ORE)
|
||||
|
||||
context.register(PlacedFeatures.NORMAL_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(8),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.triangle(VerticalAnchor.absolute(0), VerticalAnchor.absolute(50))
|
||||
)
|
||||
))
|
||||
|
||||
context.register(PlacedFeatures.DEEP_TRITANIUM, PlacedFeature(
|
||||
ore,
|
||||
listOf(
|
||||
CountPlacement.of(10),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.uniform(VerticalAnchor.aboveBottom(8), VerticalAnchor.absolute(0))
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
private object BiomeModifiers {
|
||||
val TRITANIUM_ORE = key("tritanium_ore")
|
||||
|
||||
private fun key(name: String): ResourceKey<BiomeModifier> {
|
||||
return ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, modLocation(name))
|
||||
}
|
||||
}
|
||||
|
||||
fun registerBiomeModifiers(context: BootstapContext<BiomeModifier>) {
|
||||
val placed = context.lookup(Registries.PLACED_FEATURE)
|
||||
val biomes = context.lookup(Registries.BIOME)
|
||||
|
||||
context.register(
|
||||
BiomeModifiers.TRITANIUM_ORE,
|
||||
ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(
|
||||
placed.getOrThrow(PlacedFeatures.NORMAL_TRITANIUM),
|
||||
placed.getOrThrow(PlacedFeatures.DEEP_TRITANIUM)
|
||||
),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES
|
||||
)
|
||||
)
|
||||
}
|
@ -11,7 +11,7 @@ fun SoundDefinition.subtitle(value: SoundEvent): SoundDefinition {
|
||||
return subtitle("otm.sound." + value.location.path)
|
||||
}
|
||||
|
||||
class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
override fun registerSounds() {
|
||||
add(MSoundEvents.PLASMA_WEAPON_OVERHEAT,
|
||||
definition().subtitle("otm.sound.plasma_weapon_overheat")
|
||||
|
@ -1,9 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.advancements
|
||||
|
||||
import net.minecraft.advancements.AdvancementHolder
|
||||
import net.minecraft.advancements.AdvancementRewards
|
||||
import net.minecraft.advancements.FrameType
|
||||
import net.minecraft.advancements.AdvancementRequirements.Strategy
|
||||
import net.minecraft.advancements.RequirementsStrategy
|
||||
import net.minecraft.advancements.critereon.InventoryChangeTrigger
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
@ -17,6 +16,8 @@ import ru.dbotthepony.mc.otm.triggers.BlackHoleTrigger
|
||||
import ru.dbotthepony.mc.otm.triggers.NailedEntityTrigger
|
||||
import java.util.function.Consumer
|
||||
|
||||
typealias Strategy = RequirementsStrategy
|
||||
|
||||
fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLanguageProvider) {
|
||||
val translation = lang.MultiBuilder("otm.advancements.regular")
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.advancements
|
||||
|
||||
import net.minecraft.advancements.AdvancementHolder
|
||||
import net.minecraft.advancements.AdvancementRequirements.Strategy
|
||||
import net.minecraft.advancements.AdvancementRewards
|
||||
import net.minecraft.advancements.FrameType
|
||||
import net.minecraft.advancements.critereon.EntityPredicate
|
||||
|
@ -1,12 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.advancements
|
||||
|
||||
import net.minecraft.advancements.Advancement
|
||||
import net.minecraft.advancements.AdvancementHolder
|
||||
import net.minecraft.advancements.FrameType
|
||||
import net.minecraft.advancements.critereon.ItemPredicate
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
@ -1,11 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.advancements
|
||||
|
||||
import net.minecraft.advancements.Advancement
|
||||
import net.minecraft.advancements.Criterion
|
||||
import net.minecraft.advancements.CriterionTriggerInstance
|
||||
import net.minecraft.advancements.DisplayInfo
|
||||
import net.minecraft.advancements.FrameType
|
||||
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||
import net.minecraft.advancements.critereon.EntityPredicate
|
||||
import net.minecraft.advancements.critereon.InventoryChangeTrigger
|
||||
import net.minecraft.advancements.critereon.ItemPredicate
|
||||
@ -16,6 +14,7 @@ import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.ItemLike
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import java.util.function.Consumer
|
||||
|
||||
fun AdvancementBuilder(): Advancement.Builder = Advancement.Builder.advancement()
|
||||
|
||||
@ -58,7 +57,7 @@ fun predicate(tag: TagKey<Item>): ItemPredicate {
|
||||
return ItemPredicate.Builder.item().of(tag).build()
|
||||
}
|
||||
|
||||
fun criterion(tag: TagKey<Item>): Criterion<*> {
|
||||
fun criterion(tag: TagKey<Item>): CriterionTriggerInstance {
|
||||
return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(tag))
|
||||
}
|
||||
|
||||
@ -66,8 +65,10 @@ fun predicate(item: ItemLike): ItemPredicate {
|
||||
return ItemPredicate.Builder.item().of(item).build()
|
||||
}
|
||||
|
||||
fun criterion(item: ItemLike): Criterion<*> {
|
||||
fun criterion(item: ItemLike): CriterionTriggerInstance {
|
||||
return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(item))
|
||||
}
|
||||
|
||||
fun EntityPredicate.wrap(): ContextAwarePredicate = EntityPredicate.wrap(this)
|
||||
fun EntityPredicate.wrap(): EntityPredicate.Composite = EntityPredicate.Composite.wrap(this)
|
||||
|
||||
fun Advancement.Builder.save(advancement: Consumer<Advancement>, name: ResourceLocation) = save(advancement, name.toString())
|
||||
|
@ -1,8 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.advancements
|
||||
|
||||
import net.minecraft.advancements.AdvancementHolder
|
||||
import net.minecraft.advancements.AdvancementRequirements
|
||||
import net.minecraft.advancements.Advancement
|
||||
import net.minecraft.advancements.FrameType
|
||||
import net.minecraft.advancements.RequirementsStrategy
|
||||
import net.minecraft.advancements.critereon.ItemPredicate
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
@ -16,6 +16,8 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.triggers.TakeItemOutOfReplicatorTrigger
|
||||
import java.util.function.Consumer
|
||||
|
||||
typealias AdvancementHolder = Advancement
|
||||
|
||||
data class CraftEntry(
|
||||
val item: Collection<Item>,
|
||||
val englishName: String,
|
||||
@ -59,7 +61,7 @@ data class CraftEntry(
|
||||
it.addCriterion(i.toString(), criterion(item))
|
||||
}
|
||||
}
|
||||
.requirements(AdvancementRequirements.Strategy.OR)
|
||||
.requirements(RequirementsStrategy.OR)
|
||||
.save(serializer, modLocation("machines/$path"))
|
||||
}
|
||||
}
|
||||
@ -82,7 +84,7 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
||||
for ((i, v) in MItems.CHEMICAL_GENERATOR.values.withIndex())
|
||||
it.addCriterion("has_machine_$i", criterion(v))
|
||||
}
|
||||
.requirements(AdvancementRequirements.Strategy.OR)
|
||||
.requirements(RequirementsStrategy.OR)
|
||||
.save(serializer, modLocation("machines/chemical_generator"))
|
||||
|
||||
val press = AdvancementBuilder()
|
||||
@ -100,7 +102,7 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
||||
for ((i, m) in MItems.TWIN_PLATE_PRESS.values.withIndex())
|
||||
it.addCriterion(i.toString(), criterion(m))
|
||||
}
|
||||
.requirements(AdvancementRequirements.Strategy.OR)
|
||||
.requirements(RequirementsStrategy.OR)
|
||||
.save(serializer, modLocation("machines/plate_press"))
|
||||
|
||||
CraftEntry(MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out",
|
||||
|
@ -19,7 +19,7 @@ private fun nothingOrNumber(input: Int): String {
|
||||
return (input - 1).toString()
|
||||
}
|
||||
|
||||
open class BatteryBankProvider(event: GatherDataEvent, val color: DyeColor?) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
open class BatteryBankProvider(event: GatherDataEvent, val color: DyeColor?) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
protected var block = "battery_bank"
|
||||
protected var batteryPath = "block/battery/battery"
|
||||
protected var registry: Block = MBlocks.BATTERY_BANK[color]!!
|
||||
|
@ -49,7 +49,7 @@ private fun initialTransform(it: BlockState, modelPath: String, builder: Configu
|
||||
return modelPath
|
||||
}
|
||||
|
||||
class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
private val callbacks = LinkedList<() -> Unit>()
|
||||
|
||||
fun exec(lambda: () -> Unit): MatteryBlockStateProvider {
|
||||
|
@ -88,7 +88,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
||||
|
||||
provider.handheld(MItems.TRITANIUM_TOOLS)
|
||||
provider.armorColored(MItems.TRITANIUM_ARMOR)
|
||||
provider.armorWithTrims(MItems.SIMPLE_TRITANIUM_ARMOR)
|
||||
provider.generated(MItems.SIMPLE_TRITANIUM_ARMOR)
|
||||
|
||||
provider.handheld(MItems.CHEST_UPGRADER)
|
||||
|
||||
@ -160,7 +160,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
||||
provider.block(MItems.TRITANIUM_TRAPDOOR[null]!!, "tritanium_trapdoor_bottom")
|
||||
|
||||
|
||||
for (color in DyeColor.entries)
|
||||
for (color in DyeColor.values())
|
||||
provider.block(MItems.TRITANIUM_TRAPDOOR[color]!!, "tritanium_trapdoor_${color.name.lowercase()}_bottom")
|
||||
|
||||
for (item in MRegistry.CARGO_CRATES.allItems.values)
|
||||
@ -197,7 +197,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
||||
.end()
|
||||
}
|
||||
|
||||
for (dye in DyeColor.entries) {
|
||||
for (dye in DyeColor.values()) {
|
||||
provider.exec {
|
||||
provider.withExistingParent("android_charger_${dye.name.lowercase()}", modLocation("item/android_charger")).texture("0", modLocation("block/android_charger/${dye.name.lowercase()}"))
|
||||
provider.withExistingParent("matter_panel_${dye.name.lowercase()}", modLocation("item/matter_panel")).texture("texture", modLocation("block/matter_panel/${dye.name.lowercase()}"))
|
||||
|
@ -14,7 +14,7 @@ import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import java.util.LinkedList
|
||||
|
||||
class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
private val callbacks = LinkedList<() -> Unit>()
|
||||
|
||||
fun exec(func: () -> Unit): MatteryItemModelProvider {
|
||||
@ -32,7 +32,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
||||
fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) }
|
||||
|
||||
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String) {
|
||||
for (color in DyeColor.entries) {
|
||||
for (color in DyeColor.values()) {
|
||||
block(items[color]!!, path + "_${color.name.lowercase()}")
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
||||
}
|
||||
|
||||
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String, suffix: String) {
|
||||
for (color in DyeColor.entries) {
|
||||
for (color in DyeColor.values()) {
|
||||
block(items[color]!!, path + "_${color.name.lowercase()}$suffix")
|
||||
}
|
||||
|
||||
@ -99,29 +99,6 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
||||
}
|
||||
}
|
||||
|
||||
fun armorWithTrims(item: Item, texture: ResourceLocation) = exec {
|
||||
val mainModel = withExistingParent(item.registryName!!.path, GENERATED).texture("layer0", texture)
|
||||
|
||||
if (item is ArmorItem) {
|
||||
for ((i, material) in ARMOR_TRIM_MATERIALS.withIndex()) {
|
||||
val trimLocation = ResourceLocation("trims/items/${item.type.getName()}_trim_${material}")
|
||||
existingFileHelper.trackGenerated(trimLocation, PackType.CLIENT_RESOURCES, ".png", "textures")
|
||||
|
||||
val overrideModel = withExistingParent("${item.registryName!!.path}_${material}_trim", GENERATED)
|
||||
.texture("layer0", texture)
|
||||
.texture("layer1", trimLocation)
|
||||
|
||||
mainModel.override()
|
||||
.predicate(ItemModelGenerators.TRIM_TYPE_PREDICATE_ID, (i + 1).toFloat() / ARMOR_TRIM_MATERIALS.size.toFloat())
|
||||
.model(overrideModel)
|
||||
.end()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun armorWithTrims(vararg items: Item) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
||||
fun armorWithTrims(items: Collection<Item>) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
|
||||
|
||||
fun armorColored(item: Item) = exec {
|
||||
withExistingParent(item.registryName!!.path, GENERATED)
|
||||
.texture("layer0", modLocation("item/${item.registryName!!.path}_base"))
|
||||
|
@ -39,7 +39,7 @@ private fun researchString(key: AndroidResearchType): String {
|
||||
}
|
||||
|
||||
class MatteryLanguageProvider(private val gen: DataGenerator) {
|
||||
private inner class Slave(language: String) : LanguageProvider(gen.packOutput, OverdriveThatMatters.MOD_ID, language) {
|
||||
private inner class Slave(language: String) : LanguageProvider(gen, OverdriveThatMatters.MOD_ID, language) {
|
||||
override fun addTranslations() {}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ fun PlainLootAppender(
|
||||
vararg items: Pair<ItemStack, Double>
|
||||
) = PlainLootAppender(conditions, Arrays.stream(items))
|
||||
|
||||
class LootModifiers(generator: DataGenerator) : GlobalLootModifierProvider(generator.packOutput, DataGen.MOD_ID) {
|
||||
class LootModifiers(generator: DataGenerator) : GlobalLootModifierProvider(generator, DataGen.MOD_ID) {
|
||||
private val lambdas = ArrayList<(LootModifiers) -> Unit>()
|
||||
|
||||
fun lambda(lambda: (LootModifiers) -> Unit) {
|
||||
|
@ -3,12 +3,12 @@
|
||||
|
||||
package ru.dbotthepony.mc.otm.datagen.loot
|
||||
|
||||
import com.mojang.datafixers.util.Pair
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction
|
||||
import net.minecraft.advancements.critereon.StatePropertiesPredicate
|
||||
import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.data.loot.LootTableProvider
|
||||
import net.minecraft.data.loot.LootTableSubProvider
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.level.ItemLike
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -25,10 +25,11 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition
|
||||
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.stream
|
||||
import ru.dbotthepony.mc.otm.data.loot.CopyTileNbtFunction
|
||||
import java.util.function.BiConsumer
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Supplier
|
||||
|
||||
data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
|
||||
|
||||
@ -36,7 +37,7 @@ fun TileNbtCopy(source: String, strategy: CopyNbtFunction.MergeStrategy = CopyNb
|
||||
return NbtCopy(source, "BlockEntityTag.$source", strategy)
|
||||
}
|
||||
|
||||
class LootTables(generator: DataGenerator) : LootTableProvider(generator.packOutput, setOf() /* because we don't fucking validate you fuck */, listOf() /* because we attach everything after class is constructed duh */) {
|
||||
class LootTables(generator: DataGenerator) : LootTableProvider(generator) {
|
||||
private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceLocation, () -> LootTable.Builder>>()
|
||||
|
||||
fun builder(context: LootContextParamSet, id: ResourceLocation, provider: LootTable.Builder.() -> Unit) {
|
||||
@ -51,10 +52,10 @@ class LootTables(generator: DataGenerator) : LootTableProvider(generator.packOut
|
||||
.put(id, provider) == null) { "Duplicate loot pool entry for $id" }
|
||||
}
|
||||
|
||||
override fun getTables(): List<SubProviderEntry> {
|
||||
override fun getTables(): List<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootContextParamSet>> {
|
||||
return providersTable.entries.stream().map { entry ->
|
||||
SubProviderEntry({
|
||||
LootTableSubProvider {
|
||||
Pair.of(Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>> {
|
||||
Consumer {
|
||||
for ((id, callback) in entry.value) {
|
||||
it.accept(id, callback.invoke())
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import java.util.LinkedList
|
||||
|
||||
class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
private val callbacks = LinkedList<(MatteryBlockModelProvider) -> Unit>()
|
||||
|
||||
fun exec(callback: (MatteryBlockModelProvider) -> Unit) {
|
||||
@ -99,7 +99,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
|
||||
}
|
||||
|
||||
fun colored(modelName: String, suffix: String, textureKeys: Map<String, String>) {
|
||||
for (color in DyeColor.entries) {
|
||||
for (color in DyeColor.values()) {
|
||||
exec {
|
||||
val model = withExistingParent(modelName + "_${color.name.lowercase()}$suffix", modLocation(modelName + suffix))
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
@ -9,14 +7,14 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addComponentRecipes(consumer: RecipeOutput) {
|
||||
// Обычный рецепт
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, count = 3)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES)
|
||||
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
|
||||
.unlockedBy(MItemTags.COPPER_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
// ручной рецепт
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(MItemTags.COPPER_WIRES)
|
||||
.rowB(ItemTags.WOODEN_SLABS)
|
||||
@ -24,14 +22,14 @@ fun addComponentRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer, "alt")
|
||||
|
||||
MatteryRecipe(MItems.ADVANCED_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ADVANCED_CONTROL_CIRCUIT, count = 3)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.GEMS_QUARTZ, MItemTags.COPPER_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
|
||||
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
|
||||
.unlockedBy(MItemTags.GOLD_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MACHINE_FRAME, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MACHINE_FRAME)
|
||||
.row(MItemTags.HARDENED_GLASS, MItemTags.BASIC_CIRCUIT, MItemTags.HARDENED_GLASS)
|
||||
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS)
|
||||
.rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
|
||||
@ -40,21 +38,21 @@ fun addComponentRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.GOLD_WIRING, count = 8, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.GOLD_WIRING, count = 8)
|
||||
.rowB(Tags.Items.INGOTS_GOLD)
|
||||
.row(Tags.Items.INGOTS_GOLD, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_GOLD)
|
||||
.rowB(Tags.Items.INGOTS_GOLD)
|
||||
.unlockedBy(Tags.Items.INGOTS_GOLD)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.COPPER_WIRING, count = 8, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.COPPER_WIRING, count = 8)
|
||||
.rowB(Tags.Items.INGOTS_COPPER)
|
||||
.row(Tags.Items.INGOTS_COPPER, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_COPPER)
|
||||
.rowB(Tags.Items.INGOTS_COPPER)
|
||||
.unlockedBy(Tags.Items.INGOTS_COPPER)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ENERGY_BUS, count = 2, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ENERGY_BUS, count = 2)
|
||||
.rowAB(Tags.Items.DUSTS_REDSTONE, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
|
||||
.rowBC(MItems.ELECTRIC_PARTS, Tags.Items.DUSTS_REDSTONE)
|
||||
@ -63,28 +61,28 @@ fun addComponentRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_IO_PORT, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_IO_PORT)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_TRANSFORM_MATRIX, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_TRANSFORM_MATRIX)
|
||||
.row(Tags.Items.ENDER_PEARLS, MItems.MATTER_CABLE, Tags.Items.ENDER_PEARLS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_PARTS, count = 3, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_PARTS, count = 3)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.IRON_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItemTags.HARDENED_GLASS_PANES)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ELECTRIC_PARTS, count = 4, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ELECTRIC_PARTS, count = 4)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_GOLD)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
|
||||
|
@ -1,14 +1,11 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
|
||||
import net.minecraft.util.valueproviders.ConstantFloat
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.crafting.Ingredient
|
||||
import net.minecraft.world.level.ItemLike
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
@ -18,22 +15,22 @@ private fun RecipeOutput.addRecyclingRecipe(inputs: Collection<ItemLike>, result
|
||||
|
||||
SimpleCookingRecipeBuilder.smelting(
|
||||
Ingredient.of(inputStacks.stream()),
|
||||
RecipeCategory.MISC, result, 0f, 200
|
||||
result, 0f, 200
|
||||
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("smelting/${name}"))
|
||||
|
||||
SimpleCookingRecipeBuilder.blasting(
|
||||
Ingredient.of(inputStacks.stream()),
|
||||
RecipeCategory.MISC, result, 0f, 100
|
||||
result, 0f, 100
|
||||
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("blasting/${name}"))
|
||||
}
|
||||
|
||||
fun addBlastingRecipes(consumer: RecipeOutput) {
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), RecipeCategory.MISC, MItems.MIRROR, 0.1f, 100).unlockedBy(
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), MItems.MIRROR, 0.1f, 100).unlockedBy(
|
||||
MItems.MIRROR_COMPOUND).save(consumer)
|
||||
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_PLATES), MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(
|
||||
MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_PLATES), MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(
|
||||
MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates_blasting"))
|
||||
|
||||
consumer.addRecyclingRecipe(MItems.TRITANIUM_TOOLS, MItems.TRITANIUM_NUGGET, "tritanium_nugget_from_tools")
|
||||
@ -41,14 +38,14 @@ fun addBlastingRecipes(consumer: RecipeOutput) {
|
||||
}
|
||||
|
||||
fun addOreSmeltingRecipes(consumer: RecipeOutput) {
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("smelting/tritanium_ingot_from_ore_block"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("blasting/tritanium_ingot_from_ore_block"))
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("smelting/tritanium_ingot_from_ore_block"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("blasting/tritanium_ingot_from_ore_block"))
|
||||
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("smelting/tritanium_ingot_from_raw_ore"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("blasting/tritanium_ingot_from_raw_ore"))
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("smelting/tritanium_ingot_from_raw_ore"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("blasting/tritanium_ingot_from_raw_ore"))
|
||||
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("smelting/tritanium_ingot_from_dust"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("blasting/tritanium_ingot_from_dust"))
|
||||
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("smelting/tritanium_ingot_from_dust"))
|
||||
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("blasting/tritanium_ingot_from_dust"))
|
||||
}
|
||||
|
||||
fun addMicrowaveRecipes(provider: MatteryRecipeProvider) {
|
||||
|
@ -1,8 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraft.world.item.ItemStack
|
||||
@ -17,55 +14,52 @@ import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
|
||||
import java.util.function.Consumer
|
||||
|
||||
fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
val machinesCategory = RecipeCategory.DECORATIONS
|
||||
|
||||
MatteryRecipe(MRegistry.CARGO_CRATES.item, category = RecipeCategory.DECORATIONS)
|
||||
MatteryRecipe(MRegistry.CARGO_CRATES.item)
|
||||
.row(MItemTags.TRITANIUM_PLATES, multiIngredient(Tags.Items.CHESTS_WOODEN, Tags.Items.BARRELS_WOODEN), MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(Tags.Items.CHESTS)
|
||||
.build(consumer)
|
||||
|
||||
for ((dye, crate) in MRegistry.CARGO_CRATES.blocks) {
|
||||
ShapelessRecipeBuilder(RecipeCategory.DECORATIONS, crate, 1)
|
||||
ShapelessRecipeBuilder(crate, 1)
|
||||
.requires(Ingredient.of(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
|
||||
.requires(dye.tag)
|
||||
.unlockedBy(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { it.value })
|
||||
.save(consumer, "${crate.registryName}_alt")
|
||||
}
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_INGOT_BLOCK, 1)
|
||||
ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT_BLOCK, 1)
|
||||
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.save(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 9)
|
||||
ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT, 9)
|
||||
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE))
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE)
|
||||
.save(consumer, modLocation("tritanium_ingot_from_storage"))
|
||||
|
||||
MItems.ENERGY_COUNTER.values.forEach {
|
||||
ShapelessRecipeBuilder(machinesCategory, it, 1)
|
||||
ShapelessRecipeBuilder(it, 1)
|
||||
.requires(it)
|
||||
.unlockedBy(it)
|
||||
.save(consumer, modLocation("${it.registryName!!.path}_reset"))
|
||||
}
|
||||
|
||||
ShapelessRecipeBuilder(machinesCategory, MItems.HOLO_SIGN, 1)
|
||||
ShapelessRecipeBuilder(MItems.HOLO_SIGN, 1)
|
||||
.requires(MItems.HOLO_SIGN)
|
||||
.unlockedBy(MItems.HOLO_SIGN)
|
||||
.save(consumer, modLocation("holo_sign_reset"))
|
||||
|
||||
MatteryRecipe(MBlocks.ENERGY_COUNTER[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MBlocks.ENERGY_COUNTER[null]!!)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.BASIC_CIRCUIT, Tags.Items.DUSTS_GLOWSTONE, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[null]!!)
|
||||
.rowAC(MItems.ELECTROMOTOR, MItems.ELECTROMOTOR)
|
||||
.row(MItemTags.PISTONS, MItems.MACHINE_FRAME, MItemTags.PISTONS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
@ -73,14 +67,14 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
|
||||
for ((color, item) in MItems.PLATE_PRESS) {
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!, category = machinesCategory)
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!)
|
||||
.setUpgradeSource(item)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowA(item)
|
||||
.build(consumer, "plate_press_migration/${color?.name?.lowercase() ?: "default"}")
|
||||
}
|
||||
|
||||
MatteryRecipe(MBlocks.CHEMICAL_GENERATOR[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MBlocks.CHEMICAL_GENERATOR[null]!!)
|
||||
.rowB(MItems.ENERGY_BUS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.FURNACES, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItems.ELECTRIC_PARTS, MItems.ELECTRIC_PARTS)
|
||||
@ -88,7 +82,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
|
||||
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL)
|
||||
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT)
|
||||
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
@ -96,7 +90,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
|
||||
// Машины
|
||||
MatteryRecipe(MItems.MATTER_RECYCLER[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.MATTER_RECYCLER[null]!!)
|
||||
.row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
||||
@ -104,21 +98,21 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
|
||||
// Блоки
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK[null]!!)
|
||||
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
||||
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
||||
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_BANK[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.BATTERY_BANK[null]!!)
|
||||
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
||||
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
||||
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.GRAVITATION_STABILIZER, category = machinesCategory)
|
||||
MatteryRecipe(MItems.GRAVITATION_STABILIZER)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItems.MATTER_TRANSFORM_MATRIX, MItems.MACHINE_FRAME, MItems.MATTER_TRANSFORM_MATRIX)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES)
|
||||
@ -126,7 +120,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.PORTABLE_GRAVITATION_STABILIZER, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.PORTABLE_GRAVITATION_STABILIZER)
|
||||
.rowB(MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES)
|
||||
@ -134,87 +128,87 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.GRAVITATION_FIELD_SENSOR, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.GRAVITATION_FIELD_SENSOR)
|
||||
.rowB(MItemTags.BASIC_CIRCUIT)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItemTags.IRON_PLATES)
|
||||
.unlockedBy(MItems.ELECTROMAGNET)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.GRAVITATION_FIELD_LIMITER, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.GRAVITATION_FIELD_LIMITER)
|
||||
.row(Tags.Items.ENDER_PEARLS, MItemTags.ADVANCED_CIRCUIT, Tags.Items.ENDER_PEARLS)
|
||||
.row(MItemTags.GOLD_WIRES, MItems.QUANTUM_TRANSCEIVER, MItemTags.GOLD_WIRES)
|
||||
.rowB(MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.QUANTUM_TRANSCEIVER)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BLACK_HOLE_SCANNER, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.BLACK_HOLE_SCANNER)
|
||||
.row(MItemTags.IRON_PLATES, Tags.Items.GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
|
||||
.row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
|
||||
.rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.PHANTOM_ATTRACTOR, category = machinesCategory)
|
||||
MatteryRecipe(MItems.PHANTOM_ATTRACTOR)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_COLORLESS, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.QUANTUM_TRANSCEIVER)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.QUANTUM_TRANSCEIVER, 2, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.QUANTUM_TRANSCEIVER, 2)
|
||||
.rowAC(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, Tags.Items.ENDER_PEARLS, MItemTags.GOLD_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, MItems.ELECTROMAGNET, MItemTags.GOLD_WIRES)
|
||||
.unlockedBy(Tags.Items.ENDER_PEARLS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ELECTROMAGNET, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ELECTROMAGNET)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES)
|
||||
.unlockedBy(Tags.Items.INGOTS_IRON)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ELECTROMOTOR, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ELECTROMOTOR)
|
||||
.rowB(MItems.ELECTROMAGNET)
|
||||
.row(MItems.ELECTROMAGNET, Tags.Items.INGOTS_IRON, MItems.ELECTROMAGNET)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES)
|
||||
.unlockedBy(MItems.ELECTROMAGNET)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ENERGY_SERVO[null]!!, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.ENERGY_SERVO[null]!!)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MIRROR_COMPOUND, 3, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MIRROR_COMPOUND, 3)
|
||||
.row(Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
|
||||
.unlockedBy(MItemTags.IRON_PLATES)
|
||||
.unlockedBy(Tags.Items.GLASS_PANES_COLORLESS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.REINFORCED_TRITANIUM_PLATE, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.REINFORCED_TRITANIUM_PLATE)
|
||||
.rowB(MItemTags.CARBON_PLATES)
|
||||
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES)
|
||||
.rowB(MItemTags.CARBON_PLATES)
|
||||
.unlockedBy(MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.CARBON_FIBRE_BLOCK, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MItems.CARBON_FIBRE_BLOCK)
|
||||
.rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES)
|
||||
.rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES)
|
||||
.unlockedBy(MItemTags.CARBON_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.CARBON_MESH, 4)
|
||||
ShapelessRecipeBuilder(MItems.CARBON_MESH, 4)
|
||||
.requires(Ingredient.of(MItems.CARBON_FIBRE_BLOCK))
|
||||
.unlockedBy(MItemTags.CARBON_PLATES)
|
||||
.unlockedBy(MItems.CARBON_FIBRE_BLOCK)
|
||||
.save(consumer, modLocation("carbon_mesh_from_block"))
|
||||
|
||||
// броня
|
||||
MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_HELMET)
|
||||
.setUpgradeSource(Items.LEATHER_HELMET)
|
||||
.addUpgradeOps(
|
||||
UpgradeRecipe.Direct("display"),
|
||||
@ -225,7 +219,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_PANTS)
|
||||
.setUpgradeSource(Items.LEATHER_LEGGINGS)
|
||||
.addUpgradeOps(
|
||||
UpgradeRecipe.Direct("display"),
|
||||
@ -237,7 +231,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE)
|
||||
.setUpgradeSource(Items.LEATHER_CHESTPLATE)
|
||||
.addUpgradeOps(
|
||||
UpgradeRecipe.Direct("display"),
|
||||
@ -249,7 +243,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_BOOTS)
|
||||
.setUpgradeSource(Items.LEATHER_BOOTS)
|
||||
.addUpgradeOps(
|
||||
UpgradeRecipe.Direct("display"),
|
||||
@ -261,111 +255,111 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
|
||||
// простая броня
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_HELMET)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_PANTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_CHESTPLATE)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.SIMPLE_TRITANIUM_BOOTS)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
// станция андроида
|
||||
MatteryRecipe(MItems.ANDROID_STATION[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.ANDROID_STATION[null]!!)
|
||||
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// беспроводной зарядник андроидов
|
||||
MatteryRecipe(MItems.ANDROID_CHARGER[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.ANDROID_CHARGER[null]!!)
|
||||
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// апгрейд на сетку крафта
|
||||
MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// апгрейд на переплавку
|
||||
MatteryRecipe(MItems.ExopackUpgrades.SMELTING_UPGRADE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.ExopackUpgrades.SMELTING_UPGRADE)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(Items.FURNACE, MItems.QUANTUM_TRANSCEIVER, Items.FURNACE)
|
||||
.row(MItemTags.TRITANIUM_PLATES, Items.FURNACE, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// апгрейд на эндер сундук
|
||||
MatteryRecipe(MItems.ExopackUpgrades.ENDER_UPGRADE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.ExopackUpgrades.ENDER_UPGRADE)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItems.ELECTROMAGNET, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItems.ELECTROMAGNET, Items.ENDER_CHEST, MItems.ELECTROMAGNET)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// генератор коблы
|
||||
MatteryRecipe(MItems.COBBLESTONE_GENERATOR[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.COBBLESTONE_GENERATOR[null]!!)
|
||||
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS)
|
||||
.row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET)
|
||||
.rowB(Tags.Items.CHESTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SHEARS, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_SHEARS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowA(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SHIELD, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_SHIELD)
|
||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.SHIELD, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.rowB(MItemTags.REINFORCED_TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_NUGGET, 9)
|
||||
ShapelessRecipeBuilder(MItems.TRITANIUM_NUGGET, 9)
|
||||
.requires(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
|
||||
.save(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1)
|
||||
ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT, 1)
|
||||
.requires(Ingredient.of(MItemTags.TRITANIUM_NUGGETS), 9)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
|
||||
.save(consumer, modLocation("ingot_from_nuggets"))
|
||||
|
||||
MatteryRecipe(MItems.ESSENCE_STORAGE[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.ESSENCE_STORAGE[null]!!)
|
||||
.row(MItems.MATTER_CAPACITOR_PARTS, Items.ENDER_EYE, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ESSENCE_SERVO, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.ESSENCE_SERVO)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.build(consumer)
|
||||
|
||||
for ((dye, item) in MItems.MATTER_REPLICATOR) {
|
||||
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR[dye]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR[dye]!!)
|
||||
.setUpgradeSource(item)
|
||||
.addUpgradeOps(
|
||||
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.ENERGY_KEY}", "BlockEntityTag.energy"),
|
||||
@ -377,13 +371,13 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
}
|
||||
|
||||
MatteryRecipe(MItems.MATTER_SCANNER[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.MATTER_SCANNER[null]!!)
|
||||
.row(MItems.MIRROR, MItems.MATTER_TRANSFORM_MATRIX, MItems.MIRROR)
|
||||
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.MACHINE_FRAME, MItemTags.HARDENED_GLASS_COLORLESS)
|
||||
.row(MItems.MATTER_CABLE, MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
|
||||
MatteryRecipe(MItems.FLUID_CAPSULE, count = 8)
|
||||
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
|
||||
.rowB(MItemTags.HARDENED_GLASS_PANES)
|
||||
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
|
||||
@ -391,7 +385,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.FLUID_TANK, category = RecipeCategory.DECORATIONS)
|
||||
MatteryRecipe(MItems.FLUID_TANK)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.HARDENED_GLASS_PANES, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItemTags.HARDENED_GLASS_PANES, MItemTags.HARDENED_GLASS_PANES)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.HARDENED_GLASS_PANES, MItemTags.TRITANIUM_INGOTS)
|
||||
@ -399,40 +393,40 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.EXPLOSIVE_HAMMER, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.EXPLOSIVE_HAMMER)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.rowAB(Tags.Items.INGOTS_IRON, Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(Items.FLINT_AND_STEEL)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.POWERED_FURNACE[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.POWERED_FURNACE[null]!!)
|
||||
.row(Items.FURNACE, MItems.MACHINE_FRAME, Items.FURNACE)
|
||||
.unlockedBy(MItems.MACHINE_FRAME)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.POWERED_SMOKER[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.POWERED_SMOKER[null]!!)
|
||||
.rowAC(Items.FURNACE, Items.FURNACE)
|
||||
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
||||
.unlockedBy(MItems.MACHINE_FRAME)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.POWERED_BLAST_FURNACE[null]!!, category = machinesCategory)
|
||||
MatteryRecipe(MItems.POWERED_BLAST_FURNACE[null]!!)
|
||||
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
||||
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
||||
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
||||
.unlockedBy(MItems.MACHINE_FRAME)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.INFINITE_WATER_SOURCE, category = machinesCategory)
|
||||
MatteryRecipe(MItems.INFINITE_WATER_SOURCE)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
|
||||
.rowAC(Items.WATER_BUCKET, Items.WATER_BUCKET)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
|
||||
.unlockedBy(Items.WATER_BUCKET)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.PAINTER, category = machinesCategory)
|
||||
.row(Items.BRUSH, Items.BUCKET, Items.BUCKET)
|
||||
MatteryRecipe(MItems.PAINTER)
|
||||
.row(Tags.Items.RODS_WOODEN, Items.BUCKET, Items.BUCKET)
|
||||
.row(MItemTags.IRON_PLATES, Items.BUCKET, MItemTags.IRON_PLATES)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.CRAFTING_TABLES, MItemTags.IRON_PLATES)
|
||||
.unlockedBy(Tags.Items.DYES)
|
||||
|
@ -13,10 +13,9 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import java.util.function.Consumer
|
||||
|
||||
private fun stairs(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
|
||||
MatteryRecipe(result, 4, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(result, 4)
|
||||
.rowA(base)
|
||||
.rowAB(base, base)
|
||||
.row(base, base, base)
|
||||
@ -25,14 +24,14 @@ private fun stairs(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
|
||||
}
|
||||
|
||||
private fun slab(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
|
||||
MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(result, 6)
|
||||
.row(base, base, base)
|
||||
.unlockedBy(base)
|
||||
.build(consumer, modLocation("decorative/slabs/${base.asItem().registryName!!.path}"))
|
||||
}
|
||||
|
||||
private fun wall(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
|
||||
MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(result, 6)
|
||||
.row(base, base, base)
|
||||
.row(base, base, base)
|
||||
.unlockedBy(base)
|
||||
@ -41,7 +40,7 @@ private fun wall(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
|
||||
|
||||
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: RecipeOutput) {
|
||||
SingleItemRecipeBuilder
|
||||
.stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount)
|
||||
.stonecutting(Ingredient.of(base), result, amount)
|
||||
.unlockedBy(base)
|
||||
.save(consumer, modLocation("stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}"))
|
||||
}
|
||||
@ -72,7 +71,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/floor_tiles/unrefined/${color.name.lowercase()}"))
|
||||
|
||||
if (color != DyeColor.WHITE)
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, unrefinedItem, 8)
|
||||
ShapelessRecipeBuilder(unrefinedItem, 8)
|
||||
.requires(Ingredient.of(MRegistry.UNREFINED_FLOOR_TILES.getItem(DyeColor.WHITE)), 8)
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MRegistry.UNREFINED_FLOOR_TILES.getItem(DyeColor.WHITE))
|
||||
@ -82,7 +81,6 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
for ((color, refinedItem) in MRegistry.FLOOR_TILES.items) {
|
||||
SimpleCookingRecipeBuilder.smelting(
|
||||
Ingredient.of(MRegistry.UNREFINED_FLOOR_TILES.items[color]!!),
|
||||
RecipeCategory.BUILDING_BLOCKS,
|
||||
refinedItem,
|
||||
0.15f,
|
||||
100
|
||||
@ -90,7 +88,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.save(consumer, modLocation("decorative/floor_tiles/refined/${color.name.lowercase()}"))
|
||||
|
||||
if (color != DyeColor.WHITE)
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, refinedItem, 8)
|
||||
ShapelessRecipeBuilder(refinedItem, 8)
|
||||
.requires(Ingredient.of(MRegistry.FLOOR_TILES.getItem(DyeColor.WHITE)), 8)
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MRegistry.FLOOR_TILES.getItem(DyeColor.WHITE))
|
||||
@ -124,7 +122,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
|
||||
val original = MRegistry.TRITANIUM_BLOCK.items[base]!!
|
||||
|
||||
MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(item, 8)
|
||||
.row(original, original, original)
|
||||
.row(original, stripe.tag, original)
|
||||
.row(original, original, original)
|
||||
@ -132,7 +130,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/tritanium/striped/${base.name.lowercase()}_${stripe.name.lowercase()}"))
|
||||
}
|
||||
|
||||
MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24)
|
||||
.rowAB(Tags.Items.DYES_YELLOW, Tags.Items.INGOTS_IRON)
|
||||
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
|
||||
.rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK)
|
||||
@ -140,13 +138,13 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.unlockedBy(Tags.Items.DYES_BLACK)
|
||||
.build(consumer, modLocation("decorative/danger_stripe"))
|
||||
|
||||
MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MItems.METAL_BEAM, 24)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.build(consumer, modLocation("decorative/metal_beam"))
|
||||
|
||||
MatteryRecipe(MRegistry.VENT.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MRegistry.VENT.item, 24)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Items.IRON_BARS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
@ -154,7 +152,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/vent/default"))
|
||||
|
||||
for ((color, item) in MRegistry.VENT.items) {
|
||||
MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(item, 8)
|
||||
.row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item)
|
||||
.row(MRegistry.VENT.item, color.tag, MRegistry.VENT.item)
|
||||
.row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item)
|
||||
@ -166,16 +164,16 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
for ((color, item) in MRegistry.VENT_ALTERNATIVE.allItems) {
|
||||
val other = MRegistry.VENT.allItems[color]!!
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 1).requires(other)
|
||||
ShapelessRecipeBuilder(item, 1).requires(other)
|
||||
.unlockedBy(item)
|
||||
.save(consumer, modLocation("decorative/vent/to_alt/${color?.name?.lowercase() ?: "default"}"))
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, other, 1).requires(item)
|
||||
ShapelessRecipeBuilder(other, 1).requires(item)
|
||||
.unlockedBy(other)
|
||||
.save(consumer, modLocation("decorative/vent/from_alt/${color?.name?.lowercase() ?: "default"}"))
|
||||
}
|
||||
|
||||
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
@ -183,7 +181,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/crate/rusty"))
|
||||
|
||||
for ((color, crate) in MRegistry.DECORATIVE_CRATE.items) {
|
||||
MatteryRecipe(crate, 8, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(crate, 8)
|
||||
.row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item)
|
||||
.row(MRegistry.DECORATIVE_CRATE.item, color.tag, MRegistry.DECORATIVE_CRATE.item)
|
||||
.row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item)
|
||||
@ -192,7 +190,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
}
|
||||
|
||||
for ((color, item) in MRegistry.TRITANIUM_BLOCK.items) {
|
||||
MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(item, 8)
|
||||
.row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item)
|
||||
.row(MRegistry.TRITANIUM_BLOCK.item, color.tag, MRegistry.TRITANIUM_BLOCK.item)
|
||||
.row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item)
|
||||
@ -201,14 +199,14 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/tritanium/default/${color.name.lowercase()}"))
|
||||
}
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS.item, 8)
|
||||
ShapelessRecipeBuilder(MRegistry.INDUSTRIAL_GLASS.item, 8)
|
||||
.requires(Items.GLASS, 8)
|
||||
.requires(MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
|
||||
.unlockedBy("has_glass", has(Items.GLASS))
|
||||
.save(consumer, modLocation("decorative/industrial_glass/default"))
|
||||
|
||||
ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS_PANE.item, 16)
|
||||
ShapedRecipeBuilder(MRegistry.INDUSTRIAL_GLASS_PANE.item, 16)
|
||||
.define('#', MRegistry.INDUSTRIAL_GLASS.item)
|
||||
.pattern("###").pattern("###")
|
||||
.unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item))
|
||||
@ -233,50 +231,50 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
DyeColor.BLACK to Items.BLACK_STAINED_GLASS,
|
||||
)
|
||||
|
||||
for (color in DyeColor.entries) {
|
||||
for (color in DyeColor.values()) {
|
||||
val item = MRegistry.INDUSTRIAL_GLASS.items[color]!!
|
||||
val paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[color]!!
|
||||
val mappedVanilla = mappingUpgradeVanilla[color]!!
|
||||
|
||||
// обычная покраска
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 8)
|
||||
ShapelessRecipeBuilder(item, 8)
|
||||
.requires(MRegistry.INDUSTRIAL_GLASS.item, 8)
|
||||
.requires(color.tag)
|
||||
.unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item))
|
||||
.save(consumer, modLocation("decorative/industrial_glass/recolor/${color.name.lowercase()}"))
|
||||
|
||||
// апгрейд ванильного крашенного стекла
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 8)
|
||||
ShapelessRecipeBuilder(item, 8)
|
||||
.requires(mappedVanilla, 8)
|
||||
.requires(MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
|
||||
.unlockedBy("has_colored_glass", has(mappedVanilla))
|
||||
.save(consumer, modLocation("decorative/industrial_glass/upgrade/${color.name.lowercase()}"))
|
||||
|
||||
ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 16)
|
||||
ShapedRecipeBuilder(paneItem, 16)
|
||||
.define('#', item)
|
||||
.pattern("###").pattern("###")
|
||||
.unlockedBy("has_colored_tritanium_glass", has(paneItem))
|
||||
.save(consumer, modLocation("decorative/industrial_glass_pane/${color.name.lowercase()}"))
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 8)
|
||||
ShapelessRecipeBuilder(paneItem, 8)
|
||||
.requires(MRegistry.INDUSTRIAL_GLASS_PANE.item, 8)
|
||||
.requires(color.tag)
|
||||
.unlockedBy("has_tritanium_glass_pane", has(MRegistry.INDUSTRIAL_GLASS_PANE.item))
|
||||
.save(consumer, modLocation("decorative/industrial_glass_pane/recolor/${color.name.lowercase()}"))
|
||||
}
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP, 1)
|
||||
ShapelessRecipeBuilder(MItems.LABORATORY_LAMP, 1)
|
||||
.requires(MItems.LABORATORY_LAMP_INVERTED)
|
||||
.unlockedBy(MItems.LABORATORY_LAMP_INVERTED)
|
||||
.save(consumer, MItems.LABORATORY_LAMP.registryName!!.toString() + "_inv")
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP_INVERTED, 1)
|
||||
ShapelessRecipeBuilder(MItems.LABORATORY_LAMP_INVERTED, 1)
|
||||
.requires(MItems.LABORATORY_LAMP)
|
||||
.unlockedBy(MItems.LABORATORY_LAMP)
|
||||
.save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv")
|
||||
|
||||
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS)
|
||||
@ -284,14 +282,14 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.unlockedBy(Tags.Items.DYES_YELLOW)
|
||||
.build(consumer, modLocation("decorative/blocks/striped_default"))
|
||||
|
||||
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer, modLocation("decorative/blocks/default"))
|
||||
|
||||
MatteryRecipe(MBlocks.TRITANIUM_DOOR[null]!!, 3, category = RecipeCategory.REDSTONE)
|
||||
MatteryRecipe(MBlocks.TRITANIUM_DOOR[null]!!, 3)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
@ -299,41 +297,41 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/doors/default"))
|
||||
|
||||
for (color in DyeColor.values()) {
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_DOOR[color]!!, 1)
|
||||
ShapelessRecipeBuilder.shapeless(MItems.TRITANIUM_DOOR[color]!!, 1)
|
||||
.requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { it.value })
|
||||
.save(consumer, modLocation("decorative/doors/${color.name.lowercase()}"))
|
||||
}
|
||||
|
||||
MatteryRecipe(MBlocks.TRITANIUM_TRAPDOOR[null]!!, category = RecipeCategory.REDSTONE)
|
||||
MatteryRecipe(MBlocks.TRITANIUM_TRAPDOOR[null]!!)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer, modLocation("decorative/trapdoors/default"))
|
||||
|
||||
for (color in DyeColor.values()) {
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_TRAPDOOR[color]!!, 1)
|
||||
ShapelessRecipeBuilder.shapeless(MItems.TRITANIUM_TRAPDOOR[color]!!, 1)
|
||||
.requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { it.value })
|
||||
.save(consumer, modLocation("decorative/trapdoors/${color.name.lowercase()}"))
|
||||
}
|
||||
|
||||
MatteryRecipe(MRegistry.TRITANIUM_PRESSURE_PLATE.item, category = RecipeCategory.REDSTONE)
|
||||
MatteryRecipe(MRegistry.TRITANIUM_PRESSURE_PLATE.item)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer, modLocation("pressure_plates/default"))
|
||||
|
||||
for (dye in DyeColor.values()) {
|
||||
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1)
|
||||
ShapelessRecipeBuilder(MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1)
|
||||
.requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
|
||||
.requires(dye.tag)
|
||||
.unlockedBy(MItemTags.TRITANIUM_PLATES)
|
||||
.save(consumer, modLocation("pressure_plates/${dye.name.lowercase()}"))
|
||||
}
|
||||
|
||||
MatteryRecipe(MItems.ENGINE, count = 9, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MItems.ENGINE, count = 9)
|
||||
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Items.FLINT_AND_STEEL, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItems.MATTER_CABLE, MItemTags.TRITANIUM_INGOTS)
|
||||
@ -341,7 +339,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.unlockedBy(Items.FLINT_AND_STEEL)
|
||||
.build(consumer, modLocation("decorative/engine"))
|
||||
|
||||
MatteryRecipe(MItems.METAL_MESH, count = 12, category = RecipeCategory.BUILDING_BLOCKS)
|
||||
MatteryRecipe(MItems.METAL_MESH, count = 12)
|
||||
.row(Tags.Items.NUGGETS_IRON, Items.IRON_BARS, Tags.Items.NUGGETS_IRON)
|
||||
.rowAC(Items.IRON_BARS, Items.IRON_BARS)
|
||||
.row(Tags.Items.NUGGETS_IRON, Items.IRON_BARS, Tags.Items.NUGGETS_IRON)
|
||||
@ -350,25 +348,25 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
||||
.build(consumer, modLocation("decorative/metal_mesh"))
|
||||
|
||||
// лампа
|
||||
MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
|
||||
MatteryRecipe(MItems.LABORATORY_LAMP)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
|
||||
.row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
|
||||
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer, modLocation("decorative/lamp"))
|
||||
|
||||
// Голо табличка
|
||||
MatteryRecipe(MItems.HOLO_SIGN, category = RecipeCategory.DECORATIONS)
|
||||
MatteryRecipe(MItems.HOLO_SIGN)
|
||||
.row(MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
|
||||
.rowAB(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_GLOWSTONE)
|
||||
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
|
||||
.build(consumer, modLocation("decorative/holo_sign"))
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_BARS, category = RecipeCategory.DECORATIONS, count = 16)
|
||||
MatteryRecipe(MItems.TRITANIUM_BARS, count = 16)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer, modLocation("decorative/tritanium_bars"))
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_ANVIL[0], category = RecipeCategory.DECORATIONS)
|
||||
MatteryRecipe(MItems.TRITANIUM_ANVIL[0])
|
||||
.row(MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.crafting.Ingredient
|
||||
import net.minecraftforge.common.Tags
|
||||
@ -14,6 +13,7 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
||||
fun addMatterEntanglerRecipes(consumer: RecipeOutput) {
|
||||
consumer.accept(
|
||||
MatterEntanglerRecipe(
|
||||
modLocation("quantum_capacitor"),
|
||||
IngredientMatrix.of(
|
||||
listOf(Ingredient.of(MItems.ELECTRIC_PARTS), Ingredient.of(MItemTags.GOLD_WIRES), Ingredient.of(MItems.ELECTRIC_PARTS)),
|
||||
listOf(Ingredient.of(MItems.BATTERY_CAPACITOR), Ingredient.of(MItems.QUANTUM_TRANSCEIVER), Ingredient.of(MItems.BATTERY_CAPACITOR)),
|
||||
@ -23,11 +23,12 @@ fun addMatterEntanglerRecipes(consumer: RecipeOutput) {
|
||||
400.0,
|
||||
ItemStack(MItems.QUANTUM_CAPACITOR, 2),
|
||||
experience = 15f
|
||||
).energetic().toFinished(modLocation("quantum_capacitor"))
|
||||
).energetic().toFinished()
|
||||
)
|
||||
|
||||
consumer.accept(
|
||||
MatterEntanglerRecipe(
|
||||
modLocation("quantum_battery"),
|
||||
IngredientMatrix.of(
|
||||
listOf(Ingredient.of(Tags.Items.STORAGE_BLOCKS_REDSTONE), Ingredient.of(MItemTags.GOLD_WIRES), Ingredient.of(Tags.Items.STORAGE_BLOCKS_REDSTONE)),
|
||||
listOf(Ingredient.of(MItems.BATTERY_DENSE), Ingredient.of(MItems.QUANTUM_TRANSCEIVER), Ingredient.of(MItems.BATTERY_DENSE)),
|
||||
@ -37,6 +38,6 @@ fun addMatterEntanglerRecipes(consumer: RecipeOutput) {
|
||||
600.0,
|
||||
ItemStack(MItems.QUANTUM_BATTERY, 2),
|
||||
experience = 20f
|
||||
).energetic().toFinished(modLocation("quantum_battery"))
|
||||
).energetic().toFinished()
|
||||
)
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ import net.minecraft.advancements.Advancement
|
||||
import net.minecraft.advancements.Criterion
|
||||
import net.minecraft.advancements.CriterionTriggerInstance
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.TagKey
|
||||
@ -62,10 +60,6 @@ private fun RecipeOutput.map(mapper: (FinishedRecipe) -> FinishedRecipe): Recipe
|
||||
override fun accept(recipe: FinishedRecipe) {
|
||||
this@map.accept(mapper(recipe))
|
||||
}
|
||||
|
||||
override fun advancement(): Advancement.Builder {
|
||||
return this@map.advancement()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,15 +67,15 @@ private fun RecipeOutput.map(mapper: (FinishedRecipe) -> FinishedRecipe): Recipe
|
||||
* [ShapedRecipeBuilder] that doesn't suck
|
||||
*/
|
||||
@Suppress("unused")
|
||||
class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: RecipeCategory = RecipeCategory.MISC) {
|
||||
class MatteryRecipe(val result: ItemLike, val count: Int = 1) {
|
||||
private val rows = arrayOfNulls<RecipeRow>(3)
|
||||
private var index = 0
|
||||
|
||||
private val unlockedBy = ArrayList<Pair<String, Criterion<*>>>().also {
|
||||
private val unlockedBy = ArrayList<Pair<String, CriterionTriggerInstance>>().also {
|
||||
it.add("has_result" to has(result))
|
||||
}
|
||||
|
||||
fun unlockedBy(name: String, trigger: Criterion<*>): MatteryRecipe {
|
||||
fun unlockedBy(name: String, trigger: CriterionTriggerInstance): MatteryRecipe {
|
||||
unlockedBy.add(name to trigger)
|
||||
return this
|
||||
}
|
||||
@ -143,7 +137,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
|
||||
throw NoSuchElementException("No recipe rows were defined")
|
||||
}
|
||||
|
||||
val builder = ShapedRecipeBuilder(category, result, count)
|
||||
val builder = ShapedRecipeBuilder(result, count)
|
||||
|
||||
val pairs = ArrayList<Pair<Char, RecipeCell>>()
|
||||
val iterator = charlist.iterator()
|
||||
@ -195,7 +189,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
|
||||
pJson["source"] = upgradeSource!!.toString()
|
||||
}
|
||||
|
||||
override fun type(): RecipeSerializer<*> {
|
||||
override fun getType(): RecipeSerializer<*> {
|
||||
return UpgradeRecipe.CODEC
|
||||
}
|
||||
}
|
||||
@ -227,7 +221,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
|
||||
fun buildEnergetic(consumer: RecipeOutput, name: String? = null) {
|
||||
build(consumer.map {
|
||||
object : FinishedRecipe by it {
|
||||
override fun type(): RecipeSerializer<*> {
|
||||
override fun getType(): RecipeSerializer<*> {
|
||||
return EnergyContainerRecipe.Companion
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,12 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import com.google.common.collect.ImmutableList
|
||||
import net.minecraft.advancements.CriteriaTriggers
|
||||
import net.minecraft.advancements.Criterion
|
||||
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||
import net.minecraft.advancements.CriterionTriggerInstance
|
||||
import net.minecraft.advancements.critereon.EntityPredicate
|
||||
import net.minecraft.advancements.critereon.InventoryChangeTrigger
|
||||
import net.minecraft.advancements.critereon.ItemPredicate
|
||||
import net.minecraft.advancements.critereon.MinMaxBounds
|
||||
import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.RecipeBuilder
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.RecipeProvider
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.ItemTags
|
||||
@ -27,31 +22,30 @@ import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.recipe.MicrowaveRecipe
|
||||
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
|
||||
import java.util.*
|
||||
import java.util.function.Consumer
|
||||
import java.util.stream.Stream
|
||||
|
||||
private typealias RecipeBuilderCallback = (MatteryRecipeProvider, consumer: RecipeOutput) -> Unit
|
||||
|
||||
fun has(p_176521_: MinMaxBounds.Ints, p_176522_: ItemLike): Criterion<InventoryChangeTrigger.TriggerInstance> {
|
||||
fun has(p_176521_: MinMaxBounds.Ints, p_176522_: ItemLike): CriterionTriggerInstance {
|
||||
return inventoryTrigger(ItemPredicate.Builder.item().of(p_176522_).withCount(p_176521_).build())
|
||||
}
|
||||
|
||||
fun has(p_125978_: ItemLike): Criterion<InventoryChangeTrigger.TriggerInstance> {
|
||||
fun has(p_125978_: ItemLike): CriterionTriggerInstance {
|
||||
return inventoryTrigger(ItemPredicate.Builder.item().of(p_125978_).build())
|
||||
}
|
||||
|
||||
fun has(p_125976_: TagKey<Item>): Criterion<InventoryChangeTrigger.TriggerInstance> {
|
||||
fun has(p_125976_: TagKey<Item>): CriterionTriggerInstance {
|
||||
return inventoryTrigger(ItemPredicate.Builder.item().of(p_125976_).build())
|
||||
}
|
||||
|
||||
fun inventoryTrigger(vararg p_126012_: ItemPredicate): Criterion<InventoryChangeTrigger.TriggerInstance> {
|
||||
return CriteriaTriggers.INVENTORY_CHANGED.createCriterion(InventoryChangeTrigger.TriggerInstance(
|
||||
Optional.empty(),
|
||||
fun inventoryTrigger(vararg p_126012_: ItemPredicate): CriterionTriggerInstance {
|
||||
return InventoryChangeTrigger.TriggerInstance(
|
||||
EntityPredicate.Composite.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
MinMaxBounds.Ints.ANY,
|
||||
ImmutableList.copyOf(p_126012_)
|
||||
))
|
||||
p_126012_
|
||||
)
|
||||
}
|
||||
|
||||
fun multiIngredient(vararg items: Any) : Ingredient {
|
||||
@ -87,7 +81,7 @@ fun <T : RecipeBuilder> T.unlockedBy(item: TagKey<Item>): T {
|
||||
return this
|
||||
}
|
||||
|
||||
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn.packOutput) {
|
||||
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn) {
|
||||
private val callbacks = LinkedList<RecipeBuilderCallback>()
|
||||
|
||||
fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider {
|
||||
@ -95,7 +89,7 @@ class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generat
|
||||
return this
|
||||
}
|
||||
|
||||
override fun buildRecipes(callback: RecipeOutput) {
|
||||
override fun buildCraftingRecipes(callback: RecipeOutput) {
|
||||
for (lambda in callbacks) {
|
||||
lambda(this, callback)
|
||||
}
|
||||
@ -104,24 +98,25 @@ class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generat
|
||||
fun plate(id: String, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
|
||||
exec { _, consumer ->
|
||||
consumer.accept(PlatePressRecipe(
|
||||
modLocation("plates/$id"),
|
||||
Ingredient.of(ItemTags.create(ResourceLocation("forge", "ingots/$id"))),
|
||||
Ingredient.of(ItemTags.create(ResourceLocation("forge", "plates/$id"))),
|
||||
count,
|
||||
workTicks,
|
||||
experience = experience
|
||||
).toFinished(modLocation("plates/$id")))
|
||||
).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
fun plate(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
|
||||
exec { it, callback ->
|
||||
callback.accept(PlatePressRecipe(ingredient, result, count, workTicks, experience = experience).toFinished(modLocation("plate_$id")))
|
||||
callback.accept(PlatePressRecipe(modLocation("plates/$id"), ingredient, result, count, workTicks, experience = experience).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
fun microwave(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
|
||||
exec { it, callback ->
|
||||
callback.accept(MicrowaveRecipe(ingredient, result, count, workTicks, experience = experience).toFinished(modLocation("microwave/$id")))
|
||||
callback.accept(MicrowaveRecipe(modLocation("microwave/$id"), ingredient, result, count, workTicks, experience = experience).toFinished())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.crafting.Ingredient
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.core.stream
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.recipe.PainterArmorDyeRecipe
|
||||
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import java.util.function.Consumer
|
||||
|
||||
private val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
|
||||
|
||||
@ -23,10 +19,11 @@ private fun generate(consumer: RecipeOutput, items: Map<out DyeColor?, Item>, am
|
||||
if (targetColor == null) continue
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/" + targetItem.recipeName),
|
||||
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
|
||||
ItemStack(targetItem),
|
||||
mapOf(targetColor to amount)
|
||||
).toFinished(modLocation("painter/" + targetItem.recipeName)))
|
||||
).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,19 +37,21 @@ private fun generate(consumer: RecipeOutput, default: Item, items: Map<out DyeCo
|
||||
if (k1 == null) continue
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/" + default.recipeName + "/" + v1.recipeName),
|
||||
Ingredient.of(default),
|
||||
ItemStack(v1),
|
||||
mapOf(k1 to amount)
|
||||
).toFinished(modLocation("painter/" + default.recipeName + "/" + v1.recipeName)))
|
||||
).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
private fun cleaning(consumer: RecipeOutput, to: Item, from: Map<out DyeColor?, Item>) {
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/cleaning/" + to.recipeName),
|
||||
Ingredient.of(from.entries.stream().filter { it.key != null }.map { ItemStack(it.value) }),
|
||||
ItemStack(to),
|
||||
mapOf(null to 15)
|
||||
).toFinished(modLocation("painter/cleaning/" + to.recipeName)))
|
||||
).toFinished())
|
||||
}
|
||||
|
||||
private fun striped(consumer: RecipeOutput, name: String, items: List<Pair<Item, Pair<DyeColor, DyeColor>>>, base: Map<DyeColor, Item>) {
|
||||
@ -60,10 +59,11 @@ private fun striped(consumer: RecipeOutput, name: String, items: List<Pair<Item,
|
||||
val (baseColor, stripe) = colors
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/stripes_$name/${baseColor.getName()}/${stripe.getName()}"),
|
||||
Ingredient.of(base[baseColor]),
|
||||
ItemStack(stripeItem),
|
||||
setOf(stripe)
|
||||
).toFinished(modLocation("painter/stripes_$name/${baseColor.getName()}/${stripe.getName()}")))
|
||||
).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,33 +317,37 @@ fun addPainterRecipes(consumer: RecipeOutput) {
|
||||
striped(consumer, "walls", MRegistry.TRITANIUM_STRIPED_WALL.itemsWithColor, MRegistry.TRITANIUM_WALL.items)
|
||||
striped(consumer, "slabs", MRegistry.TRITANIUM_STRIPED_SLAB.itemsWithColor, MRegistry.TRITANIUM_SLAB.items)
|
||||
|
||||
for (color in DyeColor.entries) {
|
||||
consumer.accept(PainterArmorDyeRecipe(mapOf(color to 1)).toFinished(modLocation("painter/armor_dye_" + color.getName().lowercase())))
|
||||
for (color in DyeColor.values()) {
|
||||
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_dye_" + color.getName().lowercase()), mapOf(color to 1)).toFinished())
|
||||
}
|
||||
|
||||
consumer.accept(PainterArmorDyeRecipe(mapOf(null to 15)).toFinished(modLocation("painter/armor_clear_dye")))
|
||||
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_clear_dye"), mapOf(null to 15)).toFinished())
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/tritanium_yellow_stripe"),
|
||||
Ingredient.of(MRegistry.TRITANIUM_BLOCK.item),
|
||||
ItemStack(MItems.TRITANIUM_STRIPED_BLOCK),
|
||||
mapOf(DyeColor.YELLOW to 1)
|
||||
).toFinished(modLocation("painter/tritanium_yellow_stripe")))
|
||||
).toFinished())
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/tritanium_yellow_stripe_stairs"),
|
||||
Ingredient.of(MRegistry.TRITANIUM_STAIRS.item),
|
||||
ItemStack(MItems.TRITANIUM_STRIPED_STAIRS),
|
||||
mapOf(DyeColor.YELLOW to 1)
|
||||
).toFinished(modLocation("painter/tritanium_yellow_stripe_stairs")))
|
||||
).toFinished())
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/tritanium_yellow_stripe_slab"),
|
||||
Ingredient.of(MRegistry.TRITANIUM_SLAB.item),
|
||||
ItemStack(MItems.TRITANIUM_STRIPED_SLAB),
|
||||
mapOf(DyeColor.YELLOW to 1)
|
||||
).toFinished(modLocation("painter/tritanium_yellow_stripe_slab")))
|
||||
).toFinished())
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/tritanium_yellow_stripe_wall"),
|
||||
Ingredient.of(MRegistry.TRITANIUM_WALL.item),
|
||||
ItemStack(MItems.TRITANIUM_STRIPED_WALL),
|
||||
mapOf(DyeColor.YELLOW to 1)
|
||||
).toFinished(modLocation("painter/tritanium_yellow_stripe_wall")))
|
||||
).toFinished())
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.DyeColor
|
||||
@ -16,9 +15,12 @@ import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import java.util.function.Consumer
|
||||
|
||||
typealias RecipeOutput = Consumer<FinishedRecipe>
|
||||
|
||||
fun hammerRecipe(output: ItemLike, input: ItemLike, consumer: RecipeOutput) {
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, output, 1)
|
||||
ShapelessRecipeBuilder(output, 1)
|
||||
.requires(MItemTags.TOOLS_HAMMERS)
|
||||
.requires(input)
|
||||
.unlockedBy(MItemTags.TOOLS_HAMMERS)
|
||||
@ -27,7 +29,7 @@ fun hammerRecipe(output: ItemLike, input: ItemLike, consumer: RecipeOutput) {
|
||||
}
|
||||
|
||||
fun hammerRecipe(output: ItemLike, input: TagKey<Item>, consumer: RecipeOutput) {
|
||||
ShapelessRecipeBuilder(RecipeCategory.MISC, output, 1)
|
||||
ShapelessRecipeBuilder(output, 1)
|
||||
.requires(MItemTags.TOOLS_HAMMERS)
|
||||
.requires(input)
|
||||
.unlockedBy(MItemTags.TOOLS_HAMMERS)
|
||||
@ -36,22 +38,22 @@ fun hammerRecipe(output: ItemLike, input: TagKey<Item>, consumer: RecipeOutput)
|
||||
}
|
||||
|
||||
fun addShapelessRecipes(consumer: RecipeOutput) {
|
||||
for (color in DyeColor.entries) {
|
||||
ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
|
||||
for (color in DyeColor.values()) {
|
||||
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
|
||||
.requires(Items.MINECART)
|
||||
.requires(MRegistry.CARGO_CRATES.items[color]!!)
|
||||
.unlockedBy(Items.MINECART)
|
||||
.unlockedBy(MRegistry.CARGO_CRATES.items[color]!!)
|
||||
.save(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
|
||||
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
|
||||
.requires(Ingredient.of(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { it.value })
|
||||
.save(consumer, modLocation(MItems.CARGO_CRATE_MINECARTS[color]!!.registryName!!.path + "_alt"))
|
||||
}
|
||||
|
||||
ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[null]!!, 1)
|
||||
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[null]!!, 1)
|
||||
.requires(Items.MINECART)
|
||||
.requires(MRegistry.CARGO_CRATES.item)
|
||||
.unlockedBy(Items.MINECART)
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
@ -9,14 +7,14 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
// простые батарейки
|
||||
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BATTERY_CRUDE)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(Tags.Items.CROPS_POTATO)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.unlockedBy(Tags.Items.CROPS_POTATO)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BATTERY_BASIC)
|
||||
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
.rowB(MItemTags.IRON_PLATES)
|
||||
@ -24,7 +22,7 @@ fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BATTERY_NORMAL)
|
||||
.setUpgradeSource(MItems.BATTERY_BASIC)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
@ -32,7 +30,7 @@ fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BATTERY_DENSE)
|
||||
.setUpgradeSource(MItems.BATTERY_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
@ -40,7 +38,7 @@ fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.BATTERY_CAPACITOR)
|
||||
.setUpgradeSource(MItems.BATTERY_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
@ -49,12 +47,12 @@ fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
|
||||
// накопители материи
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BASIC, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BASIC)
|
||||
.row(MItemTags.IRON_PLATES, MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS)
|
||||
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_NORMAL, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_NORMAL)
|
||||
.setUpgradeSource(MItems.MATTER_CAPACITOR_BASIC)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowB(MItems.MATTER_CAPACITOR_PARTS)
|
||||
@ -63,7 +61,7 @@ fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.MATTER_CAPACITOR_BASIC)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE)
|
||||
.setUpgradeSource(MItems.MATTER_CAPACITOR_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS, MItems.MATTER_CAPACITOR_PARTS)
|
||||
|
@ -1,55 +1,53 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addToolsRecipes(consumer: RecipeOutput) {
|
||||
MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.ENERGY_SWORD)
|
||||
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
|
||||
.unlockedBy(MItems.BATTERY_CAPACITOR)
|
||||
.buildEnergetic(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SWORD, category = RecipeCategory.COMBAT)
|
||||
MatteryRecipe(MItems.TRITANIUM_SWORD)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SHOVEL, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_SHOVEL)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_PICKAXE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_PICKAXE)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE)
|
||||
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowBC(Tags.Items.RODS_WOODEN, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer, "alt")
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_HOE, category = RecipeCategory.TOOLS)
|
||||
MatteryRecipe(MItems.TRITANIUM_HOE)
|
||||
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
|
@ -30,8 +30,8 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
tagsProvider.plates.add("gold", MItems.GOLD_PLATE)
|
||||
tagsProvider.plates.add("carbon", MItems.CARBON_MESH)
|
||||
|
||||
tagsProvider.fluids.forge("experience").add(MFluids.LIQUID_XP).add(MFluids.LIQUID_XP_FLOWING)
|
||||
tagsProvider.fluidTypes.forge("experience").add(MFluids.LIQUID_XP_TYPE)
|
||||
// tagsProvider.fluids.forge("experience").add(MFluids.LIQUID_XP).add(MFluids.LIQUID_XP_FLOWING)
|
||||
// tagsProvider.fluidTypes.forge("experience").add(MFluids.LIQUID_XP_TYPE)
|
||||
|
||||
tagsProvider.items.forge("reinforced_tritanium").add(MItems.REINFORCED_TRITANIUM_PLATE)
|
||||
|
||||
@ -125,14 +125,8 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
tagsProvider.items.Appender(Tags.Items.ARMORS_BOOTS)
|
||||
.add(MItems.TRITANIUM_BOOTS, MItems.SIMPLE_TRITANIUM_BOOTS)
|
||||
|
||||
tagsProvider.items.Appender(ItemTags.TRIMMABLE_ARMOR).add(MItems.SIMPLE_TRITANIUM_ARMOR)
|
||||
tagsProvider.items.Appender(ItemTags.FREEZE_IMMUNE_WEARABLES).add(MItems.TRITANIUM_ARMOR)
|
||||
|
||||
tagsProvider.items.Appender(ItemTags.SWORDS).add(MItems.TRITANIUM_SWORD).add(MItems.ENERGY_SWORD)
|
||||
tagsProvider.items.Appender(ItemTags.AXES).add(MItems.TRITANIUM_AXE)
|
||||
tagsProvider.items.Appender(ItemTags.PICKAXES).add(MItems.TRITANIUM_PICKAXE)
|
||||
tagsProvider.items.Appender(ItemTags.SHOVELS).add(MItems.TRITANIUM_SHOVEL)
|
||||
tagsProvider.items.Appender(ItemTags.SHOVELS).add(MItems.TRITANIUM_HOE)
|
||||
tagsProvider.items.Appender(Tags.Items.SHEARS).add(MItems.TRITANIUM_SHEARS)
|
||||
tagsProvider.items.Appender(Tags.Items.TOOLS_SHIELDS).add(MItems.TRITANIUM_SHIELD)
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.tags
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArraySet
|
||||
import net.minecraft.core.HolderLookup
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.BlockTags
|
||||
@ -16,23 +13,13 @@ import net.minecraft.world.item.Tiers
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraftforge.common.Tags
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.registries.IForgeRegistry
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||
import java.util.stream.Stream
|
||||
import net.minecraft.data.tags.TagsProvider as MinecraftTagsProvider
|
||||
|
||||
private fun <T : Any> vanillaLookup(key: ResourceKey<Registry<T>>): (T) -> ResourceLocation {
|
||||
val registry by lazy { (BuiltInRegistries.REGISTRY.get(key.location()) ?: throw NoSuchElementException("No such registry $key")) as Registry<T> }
|
||||
return { registry.getKey(it) ?: throw NoSuchElementException("Registry $key does not contain $it") }
|
||||
}
|
||||
|
||||
class TagsProvider(private val event: GatherDataEvent) {
|
||||
inner class Delegate<T : Any> private constructor(key: ResourceKey<Registry<T>>, val lookup: (T) -> ResourceLocation) : MinecraftTagsProvider<T>(event.generator.packOutput, key, event.lookupProvider, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
constructor(registry: IForgeRegistry<T>) : this(registry.registryKey, { registry.getKey(it) ?: throw NoSuchElementException("Registry $registry does not contain $it") })
|
||||
constructor(key: ResourceKey<Registry<T>>) : this(key, vanillaLookup(key))
|
||||
|
||||
inner class Delegate<T : Any>(key: Registry<T>) : MinecraftTagsProvider<T>(event.generator, key, DataGen.MOD_ID, event.existingFileHelper) {
|
||||
init {
|
||||
if (isRegistered)
|
||||
event.generator.addProvider(event.includeServer(), this)
|
||||
@ -45,10 +32,10 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
private val tagInTag = HashMap<TagKey<T>, ObjectArraySet<TagKey<T>>>()
|
||||
|
||||
inner class Appender(val tag: TagKey<T>) {
|
||||
constructor(tag: ResourceLocation) : this(TagKey.create(registryKey, tag))
|
||||
constructor(tag: ResourceLocation) : this(TagKey.create(registry.key(), tag))
|
||||
|
||||
init {
|
||||
require(tag.registry == registryKey) { "Trying to create appender for $tag inside registry $registryKey" }
|
||||
require(tag.registry == registry.key()) { "Trying to create appender for $tag inside registry ${registry.key()}" }
|
||||
}
|
||||
|
||||
private val locations by lazy { tags.computeIfAbsent(tag) { ObjectArraySet() } }
|
||||
@ -56,25 +43,25 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
private val tagsInTags by lazy { tagInTag.computeIfAbsent(tag) { ObjectArraySet() } }
|
||||
|
||||
fun add(value: ResourceLocation): Appender {
|
||||
check(locations.add(value)) { "Tag ${tag.location} of registry ${registryKey.location()} already contains $value" }
|
||||
check(locations.add(value)) { "Tag ${tag.location} of registry ${registry.key().location()} already contains $value" }
|
||||
return this
|
||||
}
|
||||
|
||||
fun add(value: ResourceKey<T>): Appender {
|
||||
require(value.registry() == registryKey.location()) { "Invalid registry in provided ResourceKey: ${value.registry()} (this tag appender is for ${registryKey.location()})" }
|
||||
require(value.registry() == registry.key().location()) { "Invalid registry in provided ResourceKey: ${value.registry()} (this tag appender is for ${registry.key().location()})" }
|
||||
// check(rigidLocations.add(value)) { "Tag ${tag.location} of registry ${registryKey.location()} already contains $value" }
|
||||
// return this
|
||||
return add(value.location())
|
||||
}
|
||||
|
||||
fun add(value: TagKey<T>): Appender {
|
||||
require(value.registry() == registryKey) { "Invalid registry in provided ResourceKey: ${value.registry().location()} (this tag appender is for ${registryKey.location()})" }
|
||||
check(tagsInTags.add(value)) { "Tag ${tag.location} of registry ${registryKey.location()} already contains $value" }
|
||||
require(value.registry() == registry.key()) { "Invalid registry in provided ResourceKey: ${value.registry().location()} (this tag appender is for ${registry.key().location()})" }
|
||||
check(tagsInTags.add(value)) { "Tag ${tag.location} of registry ${registry.key().location()} already contains $value" }
|
||||
return this
|
||||
}
|
||||
|
||||
fun add(value: T): Appender {
|
||||
return add(ResourceKey.create(registryKey, lookup.invoke(value)))
|
||||
return add(ResourceKey.create(registry.key(), registry.getKey(value)!!))
|
||||
}
|
||||
|
||||
fun add(values: Collection<T>): Appender {
|
||||
@ -123,7 +110,7 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
fun forge(path: String) = Appender(ResourceLocation("forge", path))
|
||||
fun minecraft(path: String) = Appender(ResourceLocation("minecraft", path))
|
||||
|
||||
override fun addTags(provider: HolderLookup.Provider) {
|
||||
override fun addTags() {
|
||||
for ((tag, values) in tags) {
|
||||
val appender = tag(tag)
|
||||
|
||||
@ -165,12 +152,12 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
val blocks = Delegate(ForgeRegistries.BLOCKS)
|
||||
val items = Delegate(ForgeRegistries.ITEMS)
|
||||
val fluids = Delegate(ForgeRegistries.FLUIDS)
|
||||
val fluidTypes = Delegate(ForgeRegistries.Keys.FLUID_TYPES)
|
||||
val mobEffects = Delegate(ForgeRegistries.MOB_EFFECTS)
|
||||
val damageTypes = Delegate(Registries.DAMAGE_TYPE)
|
||||
val blocks = Delegate(Registry.BLOCK)
|
||||
val items = Delegate(Registry.ITEM)
|
||||
// not supported on 1.19.4 and earlier
|
||||
// val fluids = Delegate(ForgeRegistries.FLUIDS)
|
||||
// val fluidTypes = Delegate(ForgeRegistries.Keys.FLUID_TYPES)
|
||||
val mobEffects = Delegate(Registry.MOB_EFFECT)
|
||||
|
||||
val androidImmuneEffects = mobEffects.Appender(MatteryPlayerCapability.ANDROID_IMMUNE_EFFECTS)
|
||||
|
||||
@ -217,8 +204,8 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
|
||||
fun ore(key: String, block: Block): TagsProvider {
|
||||
val forgeKey = ResourceLocation("forge", "ores/$key")
|
||||
val b = TagKey.create(Registries.BLOCK, forgeKey)
|
||||
val i = TagKey.create(Registries.ITEM, forgeKey)
|
||||
val b = TagKey.create(Registry.BLOCK_REGISTRY, forgeKey)
|
||||
val i = TagKey.create(Registry.ITEM_REGISTRY, forgeKey)
|
||||
|
||||
items.Appender(i).add(block.asItem())
|
||||
itemOres.add(block.asItem())
|
||||
@ -272,7 +259,7 @@ class TagsProvider(private val event: GatherDataEvent) {
|
||||
val itemOreRatesSingular = items.Appender(Tags.Items.ORE_RATES_SINGULAR)
|
||||
// val itemOreRatesDense = items.forge("ore_rates/dense")
|
||||
|
||||
val gameEvents = Delegate(Registries.GAME_EVENT)
|
||||
val gameEvents = Delegate(Registry.GAME_EVENT)
|
||||
val vibrations = gameEvents.Appender(GameEventTags.VIBRATIONS)
|
||||
|
||||
fun requiresPickaxe(block: Block, tier: Tier? = null): TagsProvider {
|
||||
|
@ -2,8 +2,11 @@ package ru.dbotthepony.mc.otm;
|
||||
|
||||
import kotlin.KotlinVersion;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@ -84,14 +87,38 @@ public final class OverdriveThatMatters {
|
||||
}
|
||||
}
|
||||
|
||||
public final CreativeModeTab CREATIVE_TAB = new CreativeModeTab("otm") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(MItems.INSTANCE.getBATTERY_CREATIVE(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemList(NonNullList<ItemStack> p_40778_) {
|
||||
MCreativeTabsKt.getMainTabContents().fillIn(p_40778_);
|
||||
}
|
||||
};
|
||||
|
||||
public final CreativeModeTab CREATIVE_TAB_DECORATIVE = new CreativeModeTab("otm_decorative") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(MRegistry.INSTANCE.getVENT().getItem(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemList(NonNullList<ItemStack> p_40778_) {
|
||||
MCreativeTabsKt.getDecorativeTabContents().fillIn(p_40778_);
|
||||
}
|
||||
};
|
||||
|
||||
public static OverdriveThatMatters INSTANCE;
|
||||
public static ResourceLocation loc(String path) {
|
||||
return new ResourceLocation(MOD_ID, path);
|
||||
}
|
||||
|
||||
private static void checkIfKotlinIsInstalled() {
|
||||
if (!KotlinVersion.CURRENT.isAtLeast(1, 9, 0)) {
|
||||
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.9.0 is required.");
|
||||
if (!KotlinVersion.CURRENT.isAtLeast(1, 8, 0)) {
|
||||
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.8.0 is required.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +162,6 @@ public final class OverdriveThatMatters {
|
||||
modBus.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::register);
|
||||
modBus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
|
||||
modBus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
|
||||
modBus.addListener(EventPriority.NORMAL, MCreativeTabs.INSTANCE::register);
|
||||
|
||||
modBus.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||
modBus.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||
@ -173,6 +199,8 @@ public final class OverdriveThatMatters {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onStopTracking);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::addCommands);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MCreativeTabsKt::invalidateCreativeMenus);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ExplosionQueue.Companion::onWorldTick);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::tick);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::tick);
|
||||
|
@ -21,11 +21,8 @@ import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
||||
import ru.dbotthepony.mc.otm.network.SmokeParticlesPacket;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
|
@ -34,7 +34,7 @@ public class FoodDataMixin {
|
||||
// полностью подменяем логику если андроид
|
||||
lastFoodLevel = foodLevel;
|
||||
|
||||
if (player.level().getDifficulty() == Difficulty.PEACEFUL) {
|
||||
if (player.level.getDifficulty() == Difficulty.PEACEFUL) {
|
||||
exhaustionLevel = 0f;
|
||||
} else {
|
||||
tickTimer = 0;
|
||||
|
@ -1,25 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.mixin;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import static ru.dbotthepony.mc.otm.client.render.RenderHelperKt.popScissorRect;
|
||||
import static ru.dbotthepony.mc.otm.client.render.RenderHelperKt.pushScissorRect;
|
||||
|
||||
// because scissor stack fucking sucks.
|
||||
// mostly because it is not a stack at all.
|
||||
@Mixin(GuiGraphics.class)
|
||||
public abstract class GuiGraphicsMixin {
|
||||
@Overwrite
|
||||
public void enableScissor(int x0, int y0, int x1, int y1) {
|
||||
double scale = Minecraft.getInstance().getWindow().getGuiScale();
|
||||
pushScissorRect((int) (scale * x0), (int) (scale * y0), (int) (scale * (x1 - x0)), (int) (scale * (y1 - y0)));
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
public void disableScissor() {
|
||||
popScissorRect();
|
||||
}
|
||||
}
|
30
src/main/java/ru/dbotthepony/mc/otm/mixin/ItemMixin.java
Normal file
30
src/main/java/ru/dbotthepony/mc/otm/mixin/ItemMixin.java
Normal file
@ -0,0 +1,30 @@
|
||||
package ru.dbotthepony.mc.otm.mixin;
|
||||
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
||||
import ru.dbotthepony.mc.otm.registry.MCreativeTabsKt;
|
||||
|
||||
@Mixin(Item.class)
|
||||
public abstract class ItemMixin {
|
||||
@Inject(
|
||||
at = @At("HEAD"),
|
||||
method = "getItemCategory()Lnet/minecraft/world/item/CreativeModeTab;",
|
||||
cancellable = true
|
||||
)
|
||||
public void getItemCategory$hook(CallbackInfoReturnable<CreativeModeTab> info) {
|
||||
try {
|
||||
if (MCreativeTabsKt.getMainTabContents().contains((Item) ((Object) this))) {
|
||||
info.setReturnValue(OverdriveThatMatters.INSTANCE.CREATIVE_TAB);
|
||||
} else if (MCreativeTabsKt.getDecorativeTabContents().contains((Item) ((Object) this))) {
|
||||
info.setReturnValue(OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE);
|
||||
}
|
||||
} catch(Throwable err) {
|
||||
info.setReturnValue(CreativeModeTab.TAB_MISC); // fuck you shapedrecipebuilder
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.mixin;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -29,7 +30,7 @@ public class MixinAbstractHurtingProjectile {
|
||||
AbstractHurtingProjectile proj = (AbstractHurtingProjectile)(Object)this;
|
||||
|
||||
if (cap.isAndroid() && proj.getOwner() != entity) {
|
||||
entity.level().playSound(entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + entity.level().random.nextFloat() * 0.1f);
|
||||
entity.level.playSound((Player) entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + entity.level.random.nextFloat() * 0.1f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.mixin;
|
||||
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -23,10 +24,10 @@ public class MixinGameRenderer {
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "reloadShaders(Lnet/minecraft/server/packs/resources/ResourceProvider;)V",
|
||||
method = "reloadShaders(Lnet/minecraft/server/packs/resources/ResourceManager;)V",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void reloadShaders(ResourceProvider p_250719_, CallbackInfo ci) {
|
||||
private void reloadShaders(ResourceManager p_250719_, CallbackInfo ci) {
|
||||
RenderHelperKt.reloadShaders(p_250719_);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ open class AndroidFeatureType<T : AndroidFeature> {
|
||||
}
|
||||
|
||||
open val displayContents: ComponentContents by lazy {
|
||||
TranslatableContents(displayId, null, arrayOf())
|
||||
TranslatableContents(displayId)
|
||||
}
|
||||
|
||||
open val displayName: Component by lazy {
|
||||
|
@ -3,31 +3,29 @@ package ru.dbotthepony.mc.otm.android
|
||||
import com.google.gson.JsonObject
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArraySet
|
||||
import net.minecraft.data.CachedOutput
|
||||
import net.minecraft.data.DataGenerator
|
||||
import net.minecraft.data.DataProvider
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
import ru.dbotthepony.mc.otm.core.toJson
|
||||
import ru.dbotthepony.mc.otm.core.toJsonStrict
|
||||
import ru.dbotthepony.mc.otm.core.util.WriteOnce
|
||||
import java.util.Collections
|
||||
import java.util.LinkedList
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Consumer
|
||||
|
||||
@Suppress("unused")
|
||||
open class AndroidResearchDataProvider() : DataProvider {
|
||||
var pathProvider: PackOutput.PathProvider by WriteOnce("You need to call bindPackOutput before registering this data provider")
|
||||
var pathProvider: DataGenerator.PathProvider by WriteOnce("You need to call bindPackOutput before registering this data provider")
|
||||
private set
|
||||
|
||||
constructor(output: PackOutput) : this() {
|
||||
constructor(output: DataGenerator) : this() {
|
||||
bindPackOutput(output)
|
||||
}
|
||||
|
||||
constructor(event: GatherDataEvent) : this(event.generator.packOutput)
|
||||
constructor(event: GatherDataEvent) : this(event.generator)
|
||||
|
||||
fun bindPackOutput(output: PackOutput) {
|
||||
pathProvider = output.createPathProvider(PackOutput.Target.DATA_PACK, AndroidResearchManager.DIRECTORY)
|
||||
fun bindPackOutput(output: DataGenerator) {
|
||||
pathProvider = output.createPathProvider(DataGenerator.Target.DATA_PACK, AndroidResearchManager.DIRECTORY)
|
||||
}
|
||||
|
||||
protected val callbacks = LinkedList<(Consumer<AndroidResearchType>) -> Unit>()
|
||||
@ -52,14 +50,13 @@ open class AndroidResearchDataProvider() : DataProvider {
|
||||
return this
|
||||
}
|
||||
|
||||
final override fun run(output: CachedOutput): CompletableFuture<*> {
|
||||
final override fun run(output: CachedOutput) {
|
||||
val set = ObjectArraySet<ResourceLocation>()
|
||||
val added = LinkedList<AndroidResearchType>()
|
||||
val futures = ArrayList<CompletableFuture<*>>()
|
||||
|
||||
addEverything {
|
||||
if (set.add(it.id)) {
|
||||
futures.add(DataProvider.saveStable(output, AndroidResearchType.CODEC.toJsonStrict(it).also { (it as JsonObject).remove("id") }, pathProvider.json(it.id)))
|
||||
DataProvider.saveStable(output, AndroidResearchType.CODEC.toJsonStrict(it).also { (it as JsonObject).remove("id") }, pathProvider.json(it.id))
|
||||
AndroidResearchManager.put(it)
|
||||
added.add(it)
|
||||
} else {
|
||||
@ -71,8 +68,6 @@ open class AndroidResearchDataProvider() : DataProvider {
|
||||
value.validate()
|
||||
generated.add(value)
|
||||
}
|
||||
|
||||
return CompletableFuture.allOf(*futures.toTypedArray())
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
|
@ -25,6 +25,7 @@ import ru.dbotthepony.mc.otm.core.collect.ListSet
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.isActuallyEmpty
|
||||
import ru.dbotthepony.mc.otm.data.ComponentCodec
|
||||
import ru.dbotthepony.mc.otm.data.IngredientCodec
|
||||
import ru.dbotthepony.mc.otm.data.JsonElementCodec
|
||||
import ru.dbotthepony.mc.otm.isClient
|
||||
import java.util.Optional
|
||||
@ -370,7 +371,7 @@ class AndroidResearchType(
|
||||
}
|
||||
|
||||
val displayContents: ComponentContents by lazy {
|
||||
TranslatableContents(displayId, null, arrayOf())
|
||||
TranslatableContents(displayId)
|
||||
}
|
||||
|
||||
val displayName: Component get() {
|
||||
@ -392,7 +393,7 @@ class AndroidResearchType(
|
||||
ListCodec(
|
||||
RecordCodecBuilder.create<Pair<Ingredient, Int>> {
|
||||
it.group(
|
||||
Ingredient.CODEC.fieldOf("item").forGetter { it.first },
|
||||
IngredientCodec.fieldOf("item").forGetter { it.first },
|
||||
Codec.intRange(1, Int.MAX_VALUE).optionalFieldOf("count", 1).forGetter { it.second }
|
||||
).apply(it, ::Pair)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ abstract class AndroidSwitchableFeature(type: AndroidFeatureType<*>, android: Ma
|
||||
val cooldownPercent: Float get() {
|
||||
if (maxCooldown <= 0) return 0.0f
|
||||
|
||||
if (ply.level() is ClientLevel) {
|
||||
if (ply.level is ClientLevel) {
|
||||
return ((cooldown.toFloat() - minecraft.partialTick) / maxCooldown.toFloat()).coerceIn(0.0f, 1.0f)
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,6 @@ import ru.dbotthepony.mc.otm.client.render.linesIgnoreZRenderType
|
||||
import ru.dbotthepony.mc.otm.client.render.sprites.sprite
|
||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||
import ru.dbotthepony.mc.otm.core.genericPositions
|
||||
import ru.dbotthepony.mc.otm.core.holder
|
||||
import ru.dbotthepony.mc.otm.core.isFall
|
||||
import ru.dbotthepony.mc.otm.core.math.Vector
|
||||
import ru.dbotthepony.mc.otm.core.math.asVector
|
||||
import ru.dbotthepony.mc.otm.core.math.component1
|
||||
@ -71,29 +69,29 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
}
|
||||
|
||||
private fun canSupportPlayer(blockPos: BlockPos): Boolean {
|
||||
val state = ply.level().getBlockState(blockPos)
|
||||
val state = ply.level.getBlockState(blockPos)
|
||||
|
||||
if (state.`is`(BlockTags.CLIMBABLE)) {
|
||||
return true // ladders can always support player
|
||||
}
|
||||
|
||||
val shape = state.getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||
val shape = state.getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
||||
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
||||
}
|
||||
|
||||
private fun isWall(blockPos: BlockPos): Boolean {
|
||||
val shape = ply.level().getBlockState(blockPos).getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||
val shape = ply.level.getBlockState(blockPos).getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
||||
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_NOT_FENCE, BooleanOp.AND)
|
||||
}
|
||||
|
||||
private fun isAirGap(blockPos: BlockPos): Boolean {
|
||||
val state = ply.level().getBlockState(blockPos)
|
||||
val state = ply.level.getBlockState(blockPos)
|
||||
|
||||
if (state.isAir) {
|
||||
return true
|
||||
}
|
||||
|
||||
val shape = state.getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||
val shape = state.getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
||||
return shape.isEmpty || !Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
||||
}
|
||||
|
||||
@ -140,7 +138,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
val headPosition = ply.eyePosition
|
||||
val aimVector = ply.getViewVector(1f)
|
||||
|
||||
val result = ply.level().clip(ClipContext(
|
||||
val result = ply.level.clip(ClipContext(
|
||||
headPosition,
|
||||
headPosition + aimVector * (AndroidConfig.EnderTeleporter.MAX_DISTANCE * 2.0),
|
||||
ClipContext.Block.COLLIDER,
|
||||
@ -199,14 +197,14 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
val searchDirection: IntProgression
|
||||
|
||||
if (ply.isShiftKeyDown) {
|
||||
searchDirection = -1 downTo ply.level().minBuildHeight - ply.level().maxBuildHeight
|
||||
searchDirection = -1 downTo ply.level.minBuildHeight - ply.level.maxBuildHeight
|
||||
} else {
|
||||
searchDirection = (if (ply.level().getBlockState(result.blockPos).`is`(BlockTags.CLIMBABLE)) -1 else 0) .. ply.level().maxBuildHeight - ply.level().minBuildHeight
|
||||
searchDirection = (if (ply.level.getBlockState(result.blockPos).`is`(BlockTags.CLIMBABLE)) -1 else 0) .. ply.level.maxBuildHeight - ply.level.minBuildHeight
|
||||
}
|
||||
|
||||
for (y in searchDirection) {
|
||||
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y + 1, result.blockPos.z)
|
||||
val state = ply.level().getBlockState(pos)
|
||||
val state = ply.level.getBlockState(pos)
|
||||
|
||||
if (state.`is`(Blocks.BEDROCK)) {
|
||||
// Can't phase through bedrock
|
||||
@ -258,9 +256,9 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
phasedBlocks = 0
|
||||
phasedBlocksList.clear()
|
||||
|
||||
for (y in 0 downTo ply.level().maxBuildHeight - ply.level().minBuildHeight) {
|
||||
for (y in 0 downTo ply.level.maxBuildHeight - ply.level.minBuildHeight) {
|
||||
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y, result.blockPos.z)
|
||||
val state = ply.level().getBlockState(pos)
|
||||
val state = ply.level.getBlockState(pos)
|
||||
|
||||
if (state.`is`(Blocks.BEDROCK)) {
|
||||
// Can't phase through bedrock
|
||||
@ -302,7 +300,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
val event = ForgeEventFactory.onEnderTeleport(ply, blockPos.x + 0.5, blockPos.y.toDouble(), blockPos.z + 0.5)
|
||||
|
||||
if (event.isCanceled) {
|
||||
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK.holder, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level().random.nextLong()))
|
||||
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level.random.nextLong()))
|
||||
return false
|
||||
}
|
||||
|
||||
@ -310,9 +308,9 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
lastTeleport = ply.server!!.tickCount
|
||||
android.androidEnergy.extractEnergy(AndroidConfig.EnderTeleporter.ENERGY_COST, false)
|
||||
|
||||
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level().random.nextFloat() * 0.4f)
|
||||
ply.level.playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level.random.nextFloat() * 0.4f)
|
||||
ply.teleportTo(event.targetX, event.targetY, event.targetZ)
|
||||
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level().random.nextFloat() * 0.4f)
|
||||
ply.level.playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level.random.nextFloat() * 0.4f)
|
||||
|
||||
ply.deltaMovement = Vector(0.0, 0.0, 0.0)
|
||||
ply.resetFallDistance()
|
||||
@ -352,8 +350,8 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
||||
val builder = source.getBuffer(linesIgnoreZRenderType)
|
||||
|
||||
for (blockPos in phasedBlocks) {
|
||||
val blockState = ply.level().getBlockState(blockPos)
|
||||
val shape = blockState.getShape(ply.level(), blockPos, collisionContext)
|
||||
val blockState = ply.level.getBlockState(blockPos)
|
||||
val shape = blockState.getShape(ply.level, blockPos, collisionContext)
|
||||
|
||||
LevelRenderer.renderShape(
|
||||
poseStack,
|
||||
|
@ -9,20 +9,20 @@ import java.util.*
|
||||
|
||||
class ExtendedReachFeature(android: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.EXTENDED_REACH, android) {
|
||||
override fun applyModifiers() {
|
||||
if (!ForgeMod.BLOCK_REACH.isPresent)
|
||||
if (!ForgeMod.REACH_DISTANCE.isPresent)
|
||||
return
|
||||
|
||||
val reach = ply.getAttribute(ForgeMod.BLOCK_REACH.get()) ?: return
|
||||
val reach = ply.getAttribute(ForgeMod.REACH_DISTANCE.get()) ?: return
|
||||
|
||||
reach.removePermanentModifier(MODIFIER_ID)
|
||||
reach.addPermanentModifier(AttributeModifier(MODIFIER_ID, type.displayName.toString(), level + 1.0, AttributeModifier.Operation.ADDITION))
|
||||
}
|
||||
|
||||
override fun removeModifiers() {
|
||||
if (!ForgeMod.BLOCK_REACH.isPresent)
|
||||
if (!ForgeMod.REACH_DISTANCE.isPresent)
|
||||
return
|
||||
|
||||
ply.getAttribute(ForgeMod.BLOCK_REACH.get())?.removePermanentModifier(MODIFIER_ID)
|
||||
ply.getAttribute(ForgeMod.REACH_DISTANCE.get())?.removePermanentModifier(MODIFIER_ID)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,20 +1,12 @@
|
||||
package ru.dbotthepony.mc.otm.android.feature
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
||||
import ru.dbotthepony.mc.otm.android.AndroidResearchManager
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.isFall
|
||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MNames
|
||||
import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
|
||||
|
||||
class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) {
|
||||
|
@ -45,7 +45,7 @@ class ItemEntityDataPacket(val itemUUID: Int, val owner: UUID? = null, val age:
|
||||
}
|
||||
|
||||
override fun play(context: MNetworkContext) {
|
||||
val level = minecraft.player?.level() as ClientLevel? ?: return
|
||||
val level = minecraft.player?.level as ClientLevel? ?: return
|
||||
val entity = level.getEntity(itemUUID) as ItemEntity? ?: return
|
||||
datatable[entity] = SharedItemEntityData(owner, age, lifespan, hasPickupDelay)
|
||||
}
|
||||
@ -61,7 +61,7 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable
|
||||
private data class ItemPos(var position: Vector, var ticksSinceActivity: Int)
|
||||
private val rememberPositions = WeakHashMap<ItemEntity, ItemPos>()
|
||||
|
||||
private val serverPredicate = Predicate<Entity> { it is ItemEntity && !it.hasPickUpDelay() && (it.owner == null || it.owner != ply || it.lifespan - it.age <= 200) }
|
||||
private val serverPredicate = Predicate<Entity> { it is ItemEntity && !it.hasPickUpDelay() && (it.owner == null || it.owner != ply.uuid || it.lifespan - it.age <= 200) }
|
||||
private val clientPredicate = Predicate<Entity> { it is ItemEntity && (datatable[it] ?: SharedItemEntityData.EMPTY).let { !it.hasPickupDelay && (it.owner == null || it.owner != ply.uuid || it.lifespan - it.age <= 200) } }
|
||||
|
||||
private fun doTick(server: Boolean) {
|
||||
@ -69,7 +69,7 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable
|
||||
return
|
||||
}
|
||||
|
||||
val entities = ply.level().getEntitiesInEllipsoid(
|
||||
val entities = ply.level.getEntitiesInEllipsoid(
|
||||
ply.position,
|
||||
Vector(AndroidConfig.Magnet.RADIUS_HORIZONTAL, AndroidConfig.Magnet.RADIUS_VERTICAL, AndroidConfig.Magnet.RADIUS_HORIZONTAL),
|
||||
if (server) Predicate<Entity> { it is ItemEntity } else clientPredicate
|
||||
@ -79,7 +79,7 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable
|
||||
ent as ItemEntity
|
||||
|
||||
if (server) {
|
||||
GenericNetworkChannel.send(ply, ItemEntityDataPacket(ent.id, ent.owner?.uuid, ent.age, ent.lifespan, ent.hasPickUpDelay()))
|
||||
GenericNetworkChannel.send(ply, ItemEntityDataPacket(ent.id, ent.owner, ent.age, ent.lifespan, ent.hasPickUpDelay()))
|
||||
|
||||
if (!serverPredicate.test(ent)) {
|
||||
continue
|
||||
|
@ -40,7 +40,7 @@ object TriggerJumpBoostPacket : MatteryPacket {
|
||||
if (feature.isActive && feature.cooldown <= 4 && mattery.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, false)) {
|
||||
feature.putOnCooldown()
|
||||
|
||||
context.sender.level().playSound(
|
||||
context.sender.level.playSound(
|
||||
context.sender, context.sender,
|
||||
MSoundEvents.ANDROID_JUMP_BOOST, SoundSource.PLAYERS,
|
||||
1f, 1f
|
||||
@ -75,20 +75,20 @@ class JumpBoostFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
}
|
||||
|
||||
val old = lastGround
|
||||
lastGround = ply.onGround()
|
||||
lastGround = ply.isOnGround
|
||||
|
||||
if (isActive && cooldown <= 0 && old != lastGround && !lastGround && isJumping && isShifting && ply.xRot <= ClientConfig.JUMP_BOOST_LOOK_ANGLE && android.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, true)) {
|
||||
ply.deltaMovement += Vector(0.0, AndroidConfig.JumpBoost.POWER * (level + 1) / 20.0, 0.0)
|
||||
putOnCooldown()
|
||||
MatteryPlayerNetworkChannel.sendToServer(TriggerJumpBoostPacket)
|
||||
|
||||
ply.level().playSound(
|
||||
ply.level.playSound(
|
||||
ply, ply,
|
||||
MSoundEvents.ANDROID_JUMP_BOOST, SoundSource.PLAYERS,
|
||||
1f, 1f
|
||||
)
|
||||
|
||||
SmokeParticlesPacket.makeSmoke(ply.x, ply.y, ply.z, ply.random, ply.level())
|
||||
SmokeParticlesPacket.makeSmoke(ply.x, ply.y, ply.z, ply.random, ply.level)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import ru.dbotthepony.kommons.util.setValue
|
||||
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact
|
||||
import ru.dbotthepony.mc.otm.core.isBypassArmor
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.StatNames
|
||||
|
@ -17,7 +17,7 @@ class NanobotsRegenerationFeature(android: MatteryPlayerCapability) : AndroidFea
|
||||
private var healTicks = 0
|
||||
|
||||
override fun tickServer() {
|
||||
if (ply.isHurt && ply.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
if (ply.isHurt && ply.level.gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
ticksPassed++
|
||||
|
||||
val waitTime = AndroidConfig.NanobotsRegeneration.COOLDOWN.getOrElse(healTicks) { AndroidConfig.NanobotsRegeneration.COOLDOWN.last() }
|
||||
|
@ -14,7 +14,6 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
|
||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||
import ru.dbotthepony.mc.otm.core.damageType
|
||||
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
|
||||
import ru.dbotthepony.mc.otm.core.getExplosionResistance
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
@ -33,7 +32,7 @@ import ru.dbotthepony.mc.otm.onceServer
|
||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.MSoundEvents
|
||||
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
|
||||
import ru.dbotthepony.mc.otm.registry.ShockwaveDamageSource
|
||||
import ru.dbotthepony.mc.otm.triggers.ShockwaveDamageMobTrigger
|
||||
import ru.dbotthepony.mc.otm.triggers.ShockwaveTrigger
|
||||
import kotlin.math.pow
|
||||
@ -93,7 +92,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
ShockwaveTrigger.trigger(ply as ServerPlayer)
|
||||
MatteryPlayerNetworkChannel.sendTrackingAndSelf(ply, ShockwaveEffectPacket(ply.position))
|
||||
|
||||
ply.level().playSound(
|
||||
ply.level.playSound(
|
||||
null,
|
||||
ply,
|
||||
MSoundEvents.ANDROID_SHOCKWAVE,
|
||||
@ -104,13 +103,13 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
}
|
||||
|
||||
// TODO: raycasting
|
||||
val entities = ply.level().getEntitiesInEllipsoid(
|
||||
val entities = ply.level.getEntitiesInEllipsoid(
|
||||
ply.position,
|
||||
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL, AndroidConfig.Shockwave.RADIUS_VERTICAL, AndroidConfig.Shockwave.RADIUS_HORIZONTAL),
|
||||
except = ply,
|
||||
) { (it !is LivingEntity || !it.isSpectator && it.isAlive) }
|
||||
|
||||
val wardens = ply.level().getEntitiesInEllipsoid(
|
||||
val wardens = ply.level.getEntitiesInEllipsoid(
|
||||
Warden::class.java,
|
||||
ply.position,
|
||||
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN, AndroidConfig.Shockwave.RADIUS_VERTICAL_WARDEN, AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN),
|
||||
@ -122,7 +121,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
seen.add(entity)
|
||||
val multiplier = (1.0 - distanceMultiplier).pow(0.5)
|
||||
|
||||
val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
||||
val source = ShockwaveDamageSource(ply)
|
||||
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat() * AndroidConfig.Shockwave.WARDEN_DAMAGE_MULT.toFloat()
|
||||
entity.hurt(source, damage)
|
||||
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
||||
@ -138,7 +137,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
|
||||
// don't hurt items, arrows, etc etc
|
||||
if (entity is LivingEntity) {
|
||||
val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
||||
val source = ShockwaveDamageSource(ply)
|
||||
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat()
|
||||
entity.hurt(source, damage)
|
||||
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
||||
@ -158,21 +157,21 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
for (blockPos in getEllipsoidBlockPositions(AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_VERTICAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt())) {
|
||||
val newBlockPos = blockPos + rounded
|
||||
|
||||
val blockState = ply.level().getBlockState(newBlockPos)
|
||||
val blockState = ply.level.getBlockState(newBlockPos)
|
||||
|
||||
if (!blockState.isAir && blockState.getExplosionResistance(ply.level(), newBlockPos) <= 0f && ply.level().getBlockEntity(newBlockPos) == null && blockState.block.defaultDestroyTime() >= 0f) {
|
||||
// Block.dropResources(blockState, ply.level(), newBlockPos)
|
||||
// blockState.block.destroy(ply.level(), newBlockPos, blockState)
|
||||
// ply.level().setBlock(newBlockPos, blockState.fluidState.createLegacyBlock(), Block.UPDATE_ALL)
|
||||
if (!blockState.isAir && blockState.getExplosionResistance(ply.level, newBlockPos) <= 0f && ply.level.getBlockEntity(newBlockPos) == null && blockState.block.defaultDestroyTime() >= 0f) {
|
||||
// Block.dropResources(blockState, ply.level, newBlockPos)
|
||||
// blockState.block.destroy(ply.level, newBlockPos, blockState)
|
||||
// ply.level.setBlock(newBlockPos, blockState.fluidState.createLegacyBlock(), Block.UPDATE_ALL)
|
||||
|
||||
ply.level().destroyBlock(newBlockPos, true)
|
||||
ply.level.destroyBlock(newBlockPos, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun ticker(isClient: Boolean) {
|
||||
if (!ply.onGround() || ply.isSpectator) {
|
||||
if (!ply.isOnGround || ply.isSpectator) {
|
||||
airTicks = (airTicks + 1).coerceAtMost(3)
|
||||
} else {
|
||||
airTicks = (airTicks - 1).coerceAtLeast(0)
|
||||
@ -192,7 +191,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
||||
creativeFlightTicks == 0
|
||||
) {
|
||||
val old = wasMidair
|
||||
wasMidair = !ply.onGround()
|
||||
wasMidair = !ply.isOnGround
|
||||
|
||||
if (wasMidair) {
|
||||
highestSpeed = (-ply.deltaMovement.y).coerceAtLeast(highestSpeed)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.block
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -10,7 +11,7 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -19,7 +20,7 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class BlackHoleBlock :
|
||||
Block(Properties.of().mapColor(MapColor.COLOR_BLACK).noCollission().pushReaction(PushReaction.BLOCK).sound(SoundType.STONE).strength(-1f, 7200000.0f)), EntityBlock {
|
||||
Block(Properties.of(Material.AIR, DyeColor.BLACK).noCollission().sound(SoundType.STONE).strength(-1f, 7200000.0f)), EntityBlock {
|
||||
override fun getShape(
|
||||
p_60555_: BlockState,
|
||||
p_60556_: BlockGetter,
|
||||
@ -29,6 +30,10 @@ class BlackHoleBlock :
|
||||
return SHAPE
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return BlackHoleBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.shapes.BooleanOp
|
||||
@ -27,7 +27,6 @@ import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatterCableBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.StorageCableBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.cable.EnergyCableBlockEntity
|
||||
import java.util.Collections
|
||||
import java.util.EnumMap
|
||||
|
||||
@ -44,6 +43,10 @@ abstract class CableBlock(properties: Properties) : MatteryBlock(properties) {
|
||||
|
||||
override fun hasDynamicShape() = true
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.DESTROY
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(
|
||||
CONNECTION_SOUTH,
|
||||
@ -114,7 +117,7 @@ abstract class CableBlock(properties: Properties) : MatteryBlock(properties) {
|
||||
}
|
||||
}
|
||||
|
||||
class MatterCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().pushReaction(PushReaction.DESTROY).sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
class MatterCableBlock : CableBlock(Properties.of(Material.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
private val shapes = generateShapes(0.15)
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@ -127,7 +130,7 @@ class MatterCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).req
|
||||
}
|
||||
}
|
||||
|
||||
class StorageCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().pushReaction(PushReaction.DESTROY).sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
class StorageCableBlock : CableBlock(Properties.of(Material.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
private val shapes = generateShapes(0.185)
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@ -140,7 +143,7 @@ class StorageCableBlock : CableBlock(Properties.of().mapColor(MapColor.METAL).re
|
||||
}
|
||||
}
|
||||
|
||||
class EnergyCableBlock(val factory: (blockPos: BlockPos, blockState: BlockState) -> BlockEntity) : CableBlock(Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.DESTROY).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
class EnergyCableBlock(val factory: (blockPos: BlockPos, blockState: BlockState) -> BlockEntity) : CableBlock(Properties.of(Material.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)), EntityBlock {
|
||||
private val shapes = generateShapes(0.185)
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
|
@ -9,16 +9,21 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
|
||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
|
||||
class BlockExplosionDebugger : Block(Properties.of().sound(SoundType.STONE).pushReaction(PushReaction.BLOCK)), EntityBlock {
|
||||
class BlockExplosionDebugger : Block(Properties.of(Material.METAL).sound(SoundType.STONE)), EntityBlock {
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return BlockEntityExplosionDebugger(p_153215_, p_153216_)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity?> getTicker(
|
||||
p_153212_: Level,
|
||||
p_153213_: BlockState,
|
||||
@ -32,7 +37,7 @@ class BlockExplosionDebugger : Block(Properties.of().sound(SoundType.STONE).push
|
||||
}
|
||||
}
|
||||
|
||||
class BlockSphereDebugger : Block(Properties.of()), EntityBlock {
|
||||
class BlockSphereDebugger : Block(Properties.of(Material.STONE)), EntityBlock {
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return BlockEntitySphereDebugger(p_153215_, p_153216_)
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.Property
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
|
||||
@ -267,8 +266,8 @@ open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(pro
|
||||
}
|
||||
|
||||
companion object {
|
||||
val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||
val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||
val DEFAULT_PROPERTIES: Properties = Properties.of(Material.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||
val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of(Material.HEAVY_METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -23,7 +24,7 @@ import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class CargoCrateBlock(val color: DyeColor?) : RotatableMatteryBlock(
|
||||
Properties.of().mapColor(color?.mapColor ?: MapColor.COLOR_BLUE).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.5f, 30.0f)
|
||||
Properties.of(Material.METAL, color ?: DyeColor.BLUE).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.5f, 30.0f)
|
||||
), EntityBlock {
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return CargoCrateBlockEntity(blockPos, blockState)
|
||||
@ -34,6 +35,10 @@ class CargoCrateBlock(val color: DyeColor?) : RotatableMatteryBlock(
|
||||
builder.add(IS_OPEN)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
return super.getStateForPlacement(context)?.setValue(IS_OPEN, false)
|
||||
}
|
||||
|
@ -4,12 +4,13 @@ import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity
|
||||
|
||||
class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f).pushReaction(PushReaction.BLOCK)), EntityBlock {
|
||||
class DevChestBlock : RotatableMatteryBlock(Properties.of(Material.METAL).destroyTime(-1f).explosionResistance(360000f)), EntityBlock {
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return DevChestBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -17,4 +18,8 @@ class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).exp
|
||||
init {
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.NORMAL
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,13 @@ package ru.dbotthepony.mc.otm.block.decorative
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.SoundType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -18,7 +19,7 @@ import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops().pushReaction(PushReaction.NORMAL)) {
|
||||
class EngineBlock : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) {
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
@ -29,6 +30,10 @@ class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLO
|
||||
components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY))
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.NORMAL
|
||||
}
|
||||
|
||||
override fun rotationFreedom(): BlockRotationFreedom {
|
||||
return BlockRotationFreedom.DIRECTIONAL
|
||||
}
|
||||
|
@ -10,14 +10,15 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.MaterialColor
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraftforge.fluids.FluidUtil
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.decorative.InfiniteWaterSourceBlockEntity
|
||||
|
||||
class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of().destroyTime(1.5f).explosionResistance(10f).pushReaction(PushReaction.NORMAL).requiresCorrectToolForDrops().mapColor(MapColor.WATER)), EntityBlock {
|
||||
class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of(Material.METAL, MaterialColor.WATER).destroyTime(1.5f).explosionResistance(10f).requiresCorrectToolForDrops()), EntityBlock {
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return InfiniteWaterSourceBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -31,6 +32,10 @@ class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of().destroyTi
|
||||
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.NORMAL
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity> getTicker(p_153212_: Level, p_153213_: BlockState, p_153214_: BlockEntityType<T>): BlockEntityTicker<T>? {
|
||||
if (p_153212_.isClientSide)
|
||||
return null
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.block.decorative
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
@ -13,7 +14,7 @@ import net.minecraft.world.level.block.*
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
@ -29,12 +30,16 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
|
||||
private val FACING_FULL = BlockRotationFreedom.DIRECTIONAL.property
|
||||
|
||||
class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().replaceable().pushReaction(PushReaction.DESTROY).lightLevel { 15 }) {
|
||||
class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 3600000.8F).noCollission().noLootTable().lightLevel { 15 }) {
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(FACING_FULL)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.DESTROY
|
||||
}
|
||||
|
||||
override fun hasDynamicShape(): Boolean {
|
||||
return true
|
||||
}
|
||||
@ -103,11 +108,15 @@ class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).no
|
||||
}
|
||||
}
|
||||
|
||||
class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops().pushReaction(PushReaction.BLOCK)) {
|
||||
class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of(Material.METAL, DyeColor.WHITE).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()) {
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.LIT, !invertRedstone))
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.NORMAL
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(FACING_FULL)
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.block.decorative
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.monster.Zombie
|
||||
import net.minecraft.world.item.DyeColor
|
||||
@ -11,21 +12,18 @@ import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.DoorBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
|
||||
class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
Properties.of()
|
||||
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||
Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE)
|
||||
.explosionResistance(80f)
|
||||
.noOcclusion()
|
||||
.destroyTime(3f)
|
||||
.pushReaction(PushReaction.DESTROY)
|
||||
.requiresCorrectToolForDrops(),
|
||||
BlockSetType.IRON
|
||||
.requiresCorrectToolForDrops()
|
||||
) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
@ -45,6 +43,10 @@ class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
tooltips.assemble(p_49816_, p_49818_)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_52814_: BlockState): PushReaction {
|
||||
return PushReaction.DESTROY
|
||||
}
|
||||
|
||||
override fun canEntityDestroy(
|
||||
state: BlockState,
|
||||
level: BlockGetter,
|
||||
|
@ -4,26 +4,29 @@ import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.sounds.SoundSource
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.block.BasePressurePlateBlock
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.SoundType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
|
||||
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of().mapColor(color ?: DyeColor.LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops().forceSolidOn().noCollission(), BlockSetType.IRON) {
|
||||
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops().noCollission()) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
level: BlockGetter?,
|
||||
@ -46,6 +49,14 @@ class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properti
|
||||
p_49915_.add(BlockStateProperties.POWERED)
|
||||
}
|
||||
|
||||
override fun playOnSound(level: LevelAccessor, pos: BlockPos) {
|
||||
level.playSound(null, pos, SoundEvents.METAL_PRESSURE_PLATE_CLICK_ON, SoundSource.BLOCKS, 0.3f, 0.9f)
|
||||
}
|
||||
|
||||
override fun playOffSound(level: LevelAccessor, pos: BlockPos) {
|
||||
level.playSound(null, pos, SoundEvents.METAL_PRESSURE_PLATE_CLICK_OFF, SoundSource.BLOCKS, 0.3f, 0.9f)
|
||||
}
|
||||
|
||||
override fun getSignalStrength(level: Level, pos: BlockPos): Int {
|
||||
if (level.getEntitiesOfClass(ServerPlayer::class.java, TOUCH_AABB.move(pos)).isNotEmpty()) {
|
||||
return 15
|
||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.block.decorative
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.sounds.SoundEvents
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.EntityType
|
||||
import net.minecraft.world.entity.monster.Zombie
|
||||
@ -12,19 +13,17 @@ import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.TrapDoorBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import net.minecraft.world.level.material.Material
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
|
||||
class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
Properties.of()
|
||||
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||
Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE)
|
||||
.explosionResistance(80f)
|
||||
.noOcclusion().destroyTime(3f)
|
||||
.requiresCorrectToolForDrops()
|
||||
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false },
|
||||
BlockSetType.IRON
|
||||
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false }
|
||||
) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ExperienceStorage(val maxExperience: DoubleSupplier = DoubleSupplier { Dou
|
||||
|
||||
if (whole > 0) {
|
||||
experience -= whole
|
||||
ExperienceOrb.award(player.level() as ServerLevel, player.position(), whole)
|
||||
ExperienceOrb.award(player.level as ServerLevel, player.position(), whole)
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class ExperienceStorage(val maxExperience: DoubleSupplier = DoubleSupplier { Dou
|
||||
check(experience >= 0.0) { "Invalid experience amount to store: $experience" }
|
||||
this.experience += experience
|
||||
|
||||
for (dir in Direction.entries) {
|
||||
for (dir in Direction.values()) {
|
||||
val tile = pointOfReference.level?.getBlockEntity(pointOfReference.blockPos + dir)
|
||||
|
||||
if (tile is EssenceStorageBlockEntity) {
|
||||
@ -75,7 +75,7 @@ class ExperienceStorage(val maxExperience: DoubleSupplier = DoubleSupplier { Dou
|
||||
|
||||
fun tryTransferExperience(pointOfReference: BlockEntity) {
|
||||
if (experience >= 1.0) {
|
||||
for (dir in Direction.entries) {
|
||||
for (dir in Direction.values()) {
|
||||
val tile = pointOfReference.level?.getBlockEntity(pointOfReference.blockPos + dir)
|
||||
|
||||
if (tile is EssenceStorageBlockEntity) {
|
||||
|
@ -594,14 +594,11 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
private fun recheckPlayer(player: ServerPlayer) {
|
||||
sometimeServer {
|
||||
if (player in players && !player.hasDisconnected()) {
|
||||
if (player.connection.chunkSender.isPending(chunkPos)) {
|
||||
recheckPlayer(player)
|
||||
} else {
|
||||
veto.remove(player)
|
||||
veto.remove(player)
|
||||
|
||||
blockEntities.forEach {
|
||||
it.synchers[player] = it.syncher.Remote()
|
||||
}
|
||||
blockEntities.forEach {
|
||||
it.synchers[player] =
|
||||
it.syncher.Remote()
|
||||
}
|
||||
} else if (player in players && player.hasDisconnected()) {
|
||||
unsubscribe(player)
|
||||
@ -731,7 +728,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
}
|
||||
|
||||
init {
|
||||
for (dir in Direction.entries) {
|
||||
for (dir in Direction.values()) {
|
||||
vec2Dir[vecKey(dir.normal)] = dir
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import net.minecraft.world.entity.EquipmentSlot
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.entity.item.ItemEntity
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.level.Explosion
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.Blocks
|
||||
@ -26,7 +27,6 @@ import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel
|
||||
import ru.dbotthepony.mc.otm.config.ServerConfig
|
||||
import ru.dbotthepony.mc.otm.core.damageType
|
||||
import ru.dbotthepony.mc.otm.core.getExplosionResistance
|
||||
import ru.dbotthepony.mc.otm.core.gracefulBlockBreak
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
@ -40,7 +40,6 @@ import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.core.util.decimal
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
|
||||
import ru.dbotthepony.mc.otm.triggers.BlackHoleTrigger
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToInt
|
||||
@ -122,14 +121,14 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mattery
|
||||
} else {
|
||||
level.explode(
|
||||
null,
|
||||
MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.HAWKING_RADIATION)),
|
||||
MDamageTypes.HAWKING_RADIATION,
|
||||
null,
|
||||
blockPos.x + 0.5,
|
||||
blockPos.y + 0.5,
|
||||
blockPos.z + 0.5,
|
||||
gravitationStrength.toFloat() * 60,
|
||||
false,
|
||||
Level.ExplosionInteraction.BLOCK // TODO: 1.19.3
|
||||
Explosion.BlockInteraction.DESTROY // TODO: 1.19.3
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -241,7 +240,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mattery
|
||||
}
|
||||
|
||||
if (distance < gravitationStrength + 1.0) {
|
||||
val source = MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.EVENT_HORIZON))
|
||||
val source = MDamageTypes.EVENT_HORIZON
|
||||
val damage = (gravitationStrength / distance).toFloat()
|
||||
|
||||
if (living is Player) {
|
||||
@ -259,7 +258,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mattery
|
||||
setDeltaMovement(item, center, distance)
|
||||
|
||||
if (distance < gravitationStrength + 1) {
|
||||
if (item.hurt(MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.EVENT_HORIZON)), (gravitationStrength / distance).toFloat()) && item.isRemoved) {
|
||||
if (item.hurt(MDamageTypes.EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) {
|
||||
if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) {
|
||||
collapse()
|
||||
} else {
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.nbt.DoubleTag
|
||||
import net.minecraft.nbt.ListTag
|
||||
import net.minecraft.nbt.Tag
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.util.datafix.DataFixTypes
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Explosion
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator
|
||||
@ -32,8 +31,6 @@ import ru.dbotthepony.mc.otm.core.math.rotateAroundAxis
|
||||
import ru.dbotthepony.mc.otm.core.math.up
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
@ -129,7 +126,7 @@ class ExplosionSphere(val hive: ExplosionSphereHive, var pos: Vec3, var stepVelo
|
||||
val block = level.getBlockState(finalPos)
|
||||
|
||||
if (!block.isAir && block.block !is BlockExplosionDebugger) {
|
||||
val explosion = Explosion(level, null, null, null, pos.x, pos.y, pos.z, force.toFloat(), false, Explosion.BlockInteraction.DESTROY_WITH_DECAY)
|
||||
val explosion = Explosion(level, null, null, null, pos.x, pos.y, pos.z, force.toFloat(), false, Explosion.BlockInteraction.DESTROY)
|
||||
val explosionResistance = block.getExplosionResistance(level, blockPos, explosion)
|
||||
|
||||
if (explosionResistance > force) {
|
||||
@ -269,7 +266,7 @@ class ExplosionRay(val hive: ExplosionRayHive, var pos: Vec3, var stepVelocity:
|
||||
val block = level.getBlockState(blockPos)
|
||||
|
||||
if (!block.isAir && block.block !is BlockExplosionDebugger) {
|
||||
val explosion = Explosion(level, null, null, null, pos.x, pos.y, pos.z, force.toFloat(), false, Explosion.BlockInteraction.DESTROY_WITH_DECAY)
|
||||
val explosion = Explosion(level, null, null, null, pos.x, pos.y, pos.z, force.toFloat(), false, Explosion.BlockInteraction.DESTROY)
|
||||
val explosionResistance = block.getExplosionResistance(level, blockPos, explosion)
|
||||
|
||||
if (explosionResistance > force) {
|
||||
@ -539,14 +536,14 @@ private data class QueuedExplosion(val x: Double, val y: Double, val z: Double,
|
||||
fun explode(level: Level) {
|
||||
level.explode(
|
||||
null,
|
||||
MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.HAWKING_RADIATION)),
|
||||
MDamageTypes.HAWKING_RADIATION,
|
||||
BlackHoleExplosionDamageCalculator,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
radius,
|
||||
false,
|
||||
Level.ExplosionInteraction.BLOCK // TODO: 1.19.3
|
||||
Explosion.BlockInteraction.DESTROY // TODO: 1.19.3
|
||||
)
|
||||
}
|
||||
|
||||
@ -668,11 +665,11 @@ class ExplosionQueue(private val level: ServerLevel) : SavedData() {
|
||||
@JvmStatic
|
||||
fun queueForLevel(level: ServerLevel): ExplosionQueue {
|
||||
return level.dataStorage.computeIfAbsent(
|
||||
Factory({ ExplosionQueue(level) }, {
|
||||
{
|
||||
val factory = ExplosionQueue(level)
|
||||
factory.load(it)
|
||||
factory
|
||||
}, DataFixTypes.LEVEL),
|
||||
}, { ExplosionQueue(level) },
|
||||
"otm_blackhole_explosion_queue"
|
||||
)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.gameevent.GameEvent
|
||||
import net.minecraft.world.level.storage.loot.LootParams
|
||||
import net.minecraft.world.level.storage.loot.LootContext
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||
import net.minecraft.world.phys.Vec3
|
||||
@ -105,7 +105,7 @@ class CargoCrateBlockEntity(
|
||||
val lootTableSeed = lootTableSeed ?: 0L
|
||||
val server = level?.server ?: return
|
||||
|
||||
val loot = server.lootData.getLootTable(lootTable)
|
||||
val loot = server.lootTables.get(lootTable)
|
||||
|
||||
if (ply is ServerPlayer) {
|
||||
CriteriaTriggers.GENERATE_LOOT.trigger(ply, lootTable)
|
||||
@ -114,15 +114,16 @@ class CargoCrateBlockEntity(
|
||||
this.lootTable = null
|
||||
this.lootTableSeed = null
|
||||
|
||||
val params = LootParams.Builder(level as ServerLevel)
|
||||
val params = LootContext.Builder(level as ServerLevel)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(this.worldPosition))
|
||||
|
||||
if (ply != null) {
|
||||
params.withLuck(ply.luck).withParameter(LootContextParams.THIS_ENTITY, ply)
|
||||
}
|
||||
|
||||
params.withOptionalRandomSeed(lootTableSeed)
|
||||
Containers.dropContents(level as ServerLevel, blockPos, container)
|
||||
loot.fill(container, params.create(LootContextParamSets.CHEST), lootTableSeed)
|
||||
loot.fill(container, params.create(LootContextParamSets.CHEST))
|
||||
}
|
||||
|
||||
override val defaultDisplayName: Component
|
||||
|
@ -9,6 +9,7 @@ import net.minecraftforge.items.IItemHandler
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.registries.IdMappingEvent
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.core.getID
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
|
||||
|
@ -21,6 +21,7 @@ import ru.dbotthepony.mc.otm.config.ItemsConfig
|
||||
import ru.dbotthepony.mc.otm.container.HandlerFilter
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.container.get
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.core.isNotEmpty
|
||||
import ru.dbotthepony.mc.otm.core.orNull
|
||||
import ru.dbotthepony.mc.otm.core.util.FluidStackValueCodec
|
||||
|
@ -122,7 +122,7 @@ class PainterBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDe
|
||||
}
|
||||
}
|
||||
|
||||
val dye = DyeColor.entries.firstOrNull { stack.`is`(it.tag) } ?: return false
|
||||
val dye = DyeColor.values().firstOrNull { stack.`is`(it.tag) } ?: return false
|
||||
return dyeStored(dye) + HUE_PER_ITEM <= MAX_STORAGE
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ class PainterBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDe
|
||||
if (!stack.equals(existing, false))
|
||||
return super.modifyInsertCount(slot, stack, existing, simulate)
|
||||
|
||||
val dye = DyeColor.entries.firstOrNull { stack.`is`(it.tag) } ?: return 0
|
||||
val dye = DyeColor.values().firstOrNull { stack.`is`(it.tag) } ?: return 0
|
||||
return stack.count.coerceAtMost((MAX_STORAGE - dyeStored(dye)) / HUE_PER_ITEM - existing.count)
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ class PainterBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDe
|
||||
if (k == "water")
|
||||
dyeStored[null] = it.getInt("water")
|
||||
else
|
||||
dyeStored[DyeColor.entries.firstOrNull { it.getName() == k } ?: continue] = it.getInt(k)
|
||||
dyeStored[DyeColor.values().firstOrNull { it.getName() == k } ?: continue] = it.getInt(k)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +187,7 @@ class PainterBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryDe
|
||||
}
|
||||
}
|
||||
|
||||
val dye = DyeColor.entries.firstOrNull { slot.item.`is`(it.tag) } ?: continue
|
||||
val dye = DyeColor.values().firstOrNull { slot.item.`is`(it.tag) } ?: continue
|
||||
val stored = dyeStored(dye)
|
||||
|
||||
if (stored + HUE_PER_ITEM <= MAX_STORAGE) {
|
||||
|
@ -29,6 +29,7 @@ import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.container.ShadowCraftingContainer
|
||||
import ru.dbotthepony.mc.otm.container.UpgradeContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.value
|
||||
import ru.dbotthepony.mc.otm.data.DecimalCodec
|
||||
import ru.dbotthepony.mc.otm.data.minRange
|
||||
import ru.dbotthepony.mc.otm.graph.matter.MatterNode
|
||||
@ -150,7 +151,7 @@ class MatterEntanglerBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
|
||||
.values
|
||||
.firstOrNull { it.value.matches(inputs, level!!) } ?: return JobContainer.noItem()
|
||||
|
||||
val result = recipe.value.assemble(inputs, level!!.registryAccess())
|
||||
val result = recipe.value.assemble(inputs)
|
||||
|
||||
inputs.forEach { it.shrink(1) }
|
||||
inputs.setChanged()
|
||||
|
@ -11,7 +11,6 @@ import net.minecraft.world.Container
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||
import net.minecraft.world.inventory.TransientCraftingContainer
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe
|
||||
import net.minecraft.world.item.crafting.RecipeType
|
||||
@ -28,11 +27,9 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.render.IGUIRenderable
|
||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.graph.storage.StorageNode
|
||||
import ru.dbotthepony.mc.otm.graph.storage.StorageGraph
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.container.set
|
||||
import ru.dbotthepony.mc.otm.core.nbt.mapString
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.menu.storage.ItemMonitorMenu
|
||||
@ -44,11 +41,15 @@ import kotlin.collections.HashMap
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets8
|
||||
import ru.dbotthepony.mc.otm.container.CombinedContainer
|
||||
import ru.dbotthepony.mc.otm.container.MatteryCraftingContainer
|
||||
import ru.dbotthepony.mc.otm.container.get
|
||||
import ru.dbotthepony.mc.otm.container.set
|
||||
import ru.dbotthepony.mc.otm.container.util.slotIterator
|
||||
import ru.dbotthepony.mc.otm.core.collect.map
|
||||
import ru.dbotthepony.mc.otm.core.collect.toList
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.core.isNotEmpty
|
||||
import ru.dbotthepony.mc.otm.core.util.ItemStorageStackSorter
|
||||
import ru.dbotthepony.mc.otm.core.value
|
||||
|
||||
interface IItemMonitorPlayerSettings {
|
||||
var ingredientPriority: ItemMonitorPlayerSettings.IngredientPriority
|
||||
@ -292,7 +293,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
|
||||
override fun getItem(slot: Int): ItemStack {
|
||||
require(slot == 0) { "Invalid slot: $slot" }
|
||||
return craftingRecipe?.getResultItem(level?.registryAccess() ?: return ItemStack.EMPTY)?.copy() ?: ItemStack.EMPTY
|
||||
return craftingRecipe?.resultItem?.copy() ?: ItemStack.EMPTY
|
||||
}
|
||||
|
||||
override fun removeItem(index: Int, amount: Int): ItemStack {
|
||||
@ -305,7 +306,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
try {
|
||||
ForgeHooks.setCraftingPlayer(craftingPlayer)
|
||||
|
||||
if (craftingRecipe.getResultItem(level.registryAccess()).count != amount) {
|
||||
if (craftingRecipe.resultItem.count != amount) {
|
||||
return ItemStack.EMPTY
|
||||
}
|
||||
} finally {
|
||||
@ -331,7 +332,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
|
||||
try {
|
||||
residue = craftingRecipe.getRemainingItems(craftingGrid)
|
||||
result = craftingRecipe.getResultItem(level.registryAccess())
|
||||
result = craftingRecipe.resultItem
|
||||
} finally {
|
||||
ForgeHooks.setCraftingPlayer(null)
|
||||
}
|
||||
@ -398,7 +399,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
}
|
||||
|
||||
override fun setItem(p_18944_: Int, p_18945_: ItemStack) {
|
||||
if ((craftingRecipe != null && !craftingRecipe!!.let { it.getResultItem(level?.registryAccess() ?: return@let ItemStack.EMPTY) }.isEmpty) || !p_18945_.isEmpty) {
|
||||
if ((craftingRecipe != null && !craftingRecipe!!.resultItem.isEmpty) || !p_18945_.isEmpty) {
|
||||
throw RuntimeException("BUG-DETECT: Tried to set crafting result slot item to something, and either we have crafting recipe which have valid result, or we are trying to set slot to non empty item: $p_18945_")
|
||||
}
|
||||
}
|
||||
@ -430,7 +431,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
||||
check(this.settings.put(UUID.fromString(key), ItemMonitorPlayerSettings().also { it.deserializeNBT(settings.getCompound(key)) }) == null)
|
||||
}
|
||||
|
||||
craftingGrid.deserializeNBT(nbt["crafting_grid"])
|
||||
craftingGrid.deserializeNBT(nbt["crafting_grid"] as? CompoundTag)
|
||||
}
|
||||
|
||||
fun getSettings(ply: ServerPlayer): ItemMonitorPlayerSettings {
|
||||
|
@ -35,7 +35,9 @@ import ru.dbotthepony.mc.otm.container.balance
|
||||
import ru.dbotthepony.mc.otm.core.collect.filter
|
||||
import ru.dbotthepony.mc.otm.core.collect.maybe
|
||||
import ru.dbotthepony.mc.otm.core.getValue
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.core.immutableList
|
||||
import ru.dbotthepony.mc.otm.core.value
|
||||
import ru.dbotthepony.mc.otm.core.util.item
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
||||
import ru.dbotthepony.mc.otm.recipe.MatteryCookingRecipe
|
||||
@ -145,7 +147,7 @@ sealed class AbstractPoweredFurnaceBlockEntity<P : AbstractCookingRecipe, S : Ma
|
||||
|
||||
return JobContainer.success(
|
||||
ItemJob(
|
||||
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
|
||||
recipe.getResultItem().copyWithCount(toProcess),
|
||||
recipe.workTime * config.workTimeMultiplier,
|
||||
config.energyConsumption * toProcess,
|
||||
experience = recipe.experience.sample(level.random) * toProcess))
|
||||
@ -153,7 +155,7 @@ sealed class AbstractPoweredFurnaceBlockEntity<P : AbstractCookingRecipe, S : Ma
|
||||
}
|
||||
|
||||
return level.recipeManager.getRecipeFor(recipeType, inputs[id], level).map {
|
||||
val output = it.value.assemble(inputs[id], level.registryAccess())
|
||||
val output = it.value.assemble(inputs[id])
|
||||
val inputItem = inputs[id][0].copyWithCount(1)
|
||||
val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1)
|
||||
inputs[id][0].shrink(toProcess)
|
||||
|
@ -17,6 +17,7 @@ import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
|
||||
import ru.dbotthepony.mc.otm.core.math.center
|
||||
import ru.dbotthepony.mc.otm.menu.tech.AndroidChargerMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
|
||||
|
@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.container.HandlerFilter
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.menu.tech.ChemicalGeneratorMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.enchantment.Enchantments
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import net.minecraftforge.fluids.FluidStack
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler
|
||||
import ru.dbotthepony.mc.otm.block.entity.ExperienceStorage.Companion.XP_TO_LIQUID_RATIO
|
||||
@ -170,7 +171,7 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
|
||||
|
||||
if (!servo.isEmpty && servo.item is EssenceServoItem && level is ServerLevel) {
|
||||
val entities = level!!.getEntitiesInEllipsoid(
|
||||
blockPos.center,
|
||||
Vec3.atCenterOf(blockPos),
|
||||
Vector(
|
||||
MachinesConfig.EssenceStorage.RADIUS_HORIZONTAL,
|
||||
MachinesConfig.EssenceStorage.RADIUS_VERTICAL,
|
||||
|
@ -22,6 +22,8 @@ import ru.dbotthepony.mc.otm.container.UpgradeContainer
|
||||
import ru.dbotthepony.mc.otm.container.balance
|
||||
import ru.dbotthepony.mc.otm.core.collect.filter
|
||||
import ru.dbotthepony.mc.otm.core.collect.maybe
|
||||
import ru.dbotthepony.mc.otm.core.copyWithCount
|
||||
import ru.dbotthepony.mc.otm.core.value
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.registry.MRecipes
|
||||
@ -88,7 +90,7 @@ class PlatePressBlockEntity(
|
||||
|
||||
return JobContainer.success(
|
||||
ItemJob(
|
||||
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
|
||||
recipe.getResultItem().copyWithCount(toProcess),
|
||||
recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier,
|
||||
MachinesConfig.PLATE_PRESS.energyConsumption * toProcess,
|
||||
experience = recipe.experience.sample(level.random) * toProcess))
|
||||
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -35,13 +36,12 @@ import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.oncePre
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class AndroidChargerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().destroyTime(2.5f).explosionResistance(40f).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops()), EntityBlock {
|
||||
class AndroidChargerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL).destroyTime(2.5f).explosionResistance(40f).requiresCorrectToolForDrops()), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
enum class Type : StringRepresentable {
|
||||
BASE,
|
||||
MIDDLE,
|
||||
@ -52,6 +52,10 @@ class AndroidChargerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(PART)
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.BlackHoleGeneratorBlockEntity
|
||||
@ -17,7 +17,7 @@ import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.core.math.times
|
||||
|
||||
class BlackHoleGeneratorBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(2.5f).explosionResistance(160.0f)), EntityBlock {
|
||||
class BlackHoleGeneratorBlock : RotatableMatteryBlock(Properties.of(Material.METAL).requiresCorrectToolForDrops().destroyTime(2.5f).explosionResistance(160.0f)), EntityBlock {
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return BlackHoleGeneratorBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||
return CobblerBlockEntity(pPos, pState)
|
||||
}
|
||||
@ -41,6 +41,10 @@ class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of()
|
||||
tooltips.painted(color)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.COBBLESTONE_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -10,7 +10,8 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
@ -21,16 +22,19 @@ import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class EnergyServoBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
class EnergyServoBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return EnergyServoBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity?> getTicker(
|
||||
p_153212_: Level,
|
||||
p_153213_: BlockState,
|
||||
|
@ -17,7 +17,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
@ -34,7 +34,7 @@ import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(60.0f)), EntityBlock {
|
||||
class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(60.0f)), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
|
||||
@ -50,7 +50,6 @@ class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
||||
|
||||
registerDefaultState(getStateDefinition().any().setValue(FILLED, false))
|
||||
}
|
||||
|
||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||
return EssenceStorageBlockEntity(pPos, pState)
|
||||
}
|
||||
@ -72,6 +71,10 @@ class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
||||
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(FILLED)
|
||||
|
@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.core.SectionPos
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
@ -19,7 +20,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -40,7 +41,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
import kotlin.math.PI
|
||||
|
||||
private val props = BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
||||
private val props = BlockBehaviour.Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
||||
|
||||
class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||
init {
|
||||
@ -54,6 +55,10 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||
return GravitationStabilizerBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity?> getTicker(
|
||||
p_153212_: Level,
|
||||
p_153213_: BlockState,
|
||||
|
@ -9,12 +9,12 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
|
||||
class HatchBlock(val factory: BlockEntityType.BlockEntitySupplier<out MatteryBlockEntity>, val needsTicking: Boolean = false) : RotatableMatteryBlock(Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(2.5f).explosionResistance(80.0f)), EntityBlock {
|
||||
class HatchBlock(val factory: BlockEntityType.BlockEntitySupplier<out MatteryBlockEntity>, val needsTicking: Boolean = false) : RotatableMatteryBlock(Properties.of(Material.METAL).requiresCorrectToolForDrops().destroyTime(2.5f).explosionResistance(80.0f)), EntityBlock {
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return factory.create(blockPos, blockState)
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.entity.MobSpawnType
|
||||
import net.minecraft.world.entity.SpawnGroupData
|
||||
import net.minecraft.world.entity.monster.Phantom
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
@ -20,11 +21,12 @@ import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.AABB
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import net.minecraftforge.common.ForgeHooks
|
||||
import net.minecraftforge.event.ForgeEventFactory
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
@ -36,12 +38,11 @@ import ru.dbotthepony.mc.otm.once
|
||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).destroyTime(3f).explosionResistance(12f).randomTicks()) {
|
||||
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).destroyTime(3f).explosionResistance(12f).randomTicks()) {
|
||||
init {
|
||||
addSimpleDescription()
|
||||
tooltips.needsNoPower()
|
||||
}
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
override fun randomTick(
|
||||
blockState: BlockState,
|
||||
@ -68,13 +69,22 @@ class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(Map
|
||||
) {
|
||||
val phantom = EntityType.PHANTOM.create(level) ?: continue
|
||||
phantom.moveTo(spawnPos, 0.0f, 0.0f)
|
||||
groupData = ForgeEventFactory.onFinalizeSpawn(phantom, level, level.getCurrentDifficultyAt(spawnPos), MobSpawnType.SPAWNER, groupData, null)
|
||||
|
||||
if (ForgeHooks.canEntitySpawn(phantom, level, spawnPos.x.toDouble(), spawnPos.y.toDouble(), spawnPos.z.toDouble(), null, MobSpawnType.SPAWNER) == -1) {
|
||||
continue
|
||||
}
|
||||
|
||||
groupData = phantom.finalizeSpawn(level, level.getCurrentDifficultyAt(spawnPos), MobSpawnType.SPAWNER, groupData, null)
|
||||
level.addFreshEntityWithPassengers(phantom)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
|
@ -11,7 +11,7 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
if (isTwin) tooltips.doubleProcessing()
|
||||
@ -49,6 +49,10 @@ class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : Rotat
|
||||
builder.add(WorkerState.WORKER_STATE)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { (if (isTwin) BlockShapes.TWIN_PLATE_PRESS_IDLE else BlockShapes.PLATE_PRESS_IDLE).rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.capability
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.math.Vector4f
|
||||
import it.unimi.dsi.fastutil.ints.IntAVLTreeSet
|
||||
import it.unimi.dsi.fastutil.ints.IntSet
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
||||
@ -61,7 +62,6 @@ import net.minecraftforge.network.PacketDistributor
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.server.command.EnumArgument
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import org.joml.Vector4f
|
||||
import ru.dbotthepony.kommons.collect.ListenableMap
|
||||
import ru.dbotthepony.kommons.collect.ListenableSet
|
||||
import ru.dbotthepony.kommons.io.DelegateSyncher
|
||||
@ -121,7 +121,6 @@ import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
|
||||
import ru.dbotthepony.mc.otm.triggers.AndroidResearchTrigger
|
||||
import ru.dbotthepony.mc.otm.triggers.AndroidTravelUnderwater
|
||||
import ru.dbotthepony.mc.otm.triggers.BecomeAndroidDeathTrigger
|
||||
@ -156,7 +155,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
@Cancelable
|
||||
data class PreTick(val capability: MatteryPlayerCapability) : Event() {
|
||||
val player get() = capability.ply
|
||||
val level: Level get() = capability.ply.level()
|
||||
val level: Level get() = capability.ply.level
|
||||
|
||||
override fun isCancelable(): Boolean {
|
||||
return true
|
||||
@ -168,7 +167,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
*/
|
||||
data class PostTick(val capability: MatteryPlayerCapability) : Event() {
|
||||
val player get() = capability.ply
|
||||
val level: Level get() = capability.ply.level()
|
||||
val level: Level get() = capability.ply.level
|
||||
|
||||
override fun isCancelable(): Boolean {
|
||||
return false
|
||||
@ -181,7 +180,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
*/
|
||||
data class ItemStackLeftoverEvent(val stack: ItemStack, val capability: MatteryPlayerCapability) : Event() {
|
||||
val player get() = capability.ply
|
||||
val level: Level get() = capability.ply.level()
|
||||
val level: Level get() = capability.ply.level
|
||||
|
||||
override fun isCancelable(): Boolean {
|
||||
return false
|
||||
@ -538,14 +537,14 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
|
||||
override fun computeNextJob(): JobContainer<ItemJob> {
|
||||
if (!exopackEnergy.batteryLevel.isPositive) return JobContainer.noEnergy()
|
||||
val level = ply.level() as? ServerLevel ?: return JobContainer.failure()
|
||||
val level = ply.level as? ServerLevel ?: return JobContainer.failure()
|
||||
val recipe = cache.getRecipeFor(input, level)
|
||||
|
||||
if (recipe.isEmpty) {
|
||||
return JobContainer.noItem()
|
||||
} else {
|
||||
val actual = recipe.get()
|
||||
val item = actual.value.assemble(input, level.registryAccess())
|
||||
val item = actual.value.assemble(input)
|
||||
input[0].shrink(1)
|
||||
input.setChanged(0)
|
||||
return JobContainer.success(ItemJob(item, actual.value.cookingTime.toDouble(), ExopackConfig.FURNACE_POWER_CONSUMPTION, actual.value.experience))
|
||||
@ -555,8 +554,8 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
override fun onJobTick(status: JobStatus<ItemJob>) {
|
||||
super.onJobTick(status)
|
||||
|
||||
if (isExopackVisible && ply.level().random.nextFloat() <= 0.05f) {
|
||||
MatteryPlayerNetworkChannel.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(ply as ServerPlayer), ExopackSmokePacket(ply.uuid))
|
||||
if (isExopackVisible && ply.level.random.nextFloat() <= 0.05f) {
|
||||
MatteryPlayerNetworkChannel.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with { ply as ServerPlayer }, ExopackSmokePacket(ply.uuid))
|
||||
}
|
||||
}
|
||||
|
||||
@ -699,7 +698,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
becomeAndroid()
|
||||
|
||||
if (!ply.abilities.invulnerable)
|
||||
ply.hurt(MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.BECOME_ANDROID)), ply.maxHealth * 2)
|
||||
ply.hurt(MDamageTypes.BECOME_ANDROID, ply.maxHealth * 2)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -761,7 +760,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
becomeHumane()
|
||||
|
||||
if (!ply.abilities.invulnerable)
|
||||
ply.hurt(MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.BECOME_HUMANE)), ply.maxHealth * 2)
|
||||
ply.hurt(MDamageTypes.BECOME_HUMANE, ply.maxHealth * 2)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -822,7 +821,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
if (featureMap.containsKey(feature.type)) return false
|
||||
featureMap[feature.type] = feature
|
||||
|
||||
if (!ply.level().isClientSide) {
|
||||
if (!ply.level.isClientSide) {
|
||||
queuedTicks.add(feature::applyModifiers)
|
||||
}
|
||||
|
||||
@ -850,7 +849,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
|
||||
featureMap[feature] = factory
|
||||
|
||||
if (!ply.level().isClientSide && isAndroid) {
|
||||
if (!ply.level.isClientSide && isAndroid) {
|
||||
queuedTicks.add(factory::applyModifiers)
|
||||
}
|
||||
|
||||
@ -875,7 +874,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
val removed = featureMap.remove(feature)
|
||||
|
||||
if (removed != null) {
|
||||
if (!ply.level().isClientSide && isAndroid) {
|
||||
if (!ply.level.isClientSide && isAndroid) {
|
||||
queuedTicks.add(removed::removeModifiers)
|
||||
}
|
||||
|
||||
@ -1048,7 +1047,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
instance.deserializeNBT(featureTag)
|
||||
addFeature(instance)
|
||||
|
||||
if (!ply.level().isClientSide) {
|
||||
if (!ply.level.isClientSide) {
|
||||
queuedTicks.add(instance::applyModifiers)
|
||||
}
|
||||
}
|
||||
@ -1102,7 +1101,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
if (hasExopack) {
|
||||
for ((i, stack) in exopackContainer.withIndex()) {
|
||||
if (!stack.isEmpty) {
|
||||
stack.inventoryTick(ply.level(), ply, i + 41, false)
|
||||
stack.inventoryTick(ply.level, ply, i + 41, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1211,8 +1210,8 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
ply.isSwimming = false
|
||||
|
||||
if (ply is ServerPlayer) {
|
||||
if (ply.level().dimension().location() != lastDimension) {
|
||||
lastDimension = ply.level().dimension().location()
|
||||
if (ply.level.dimension().location() != lastDimension) {
|
||||
lastDimension = ply.level.dimension().location()
|
||||
wasInLiquid = false
|
||||
lastLiquidPosition = ply.position
|
||||
liquidDistanceTravelled = 0.0
|
||||
@ -1264,7 +1263,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
while (stats.foodLevel > 18 && androidEnergy.receiveEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT / 2, false)) {
|
||||
stats.foodLevel--
|
||||
}
|
||||
} else if (ply.level().difficulty != Difficulty.PEACEFUL) {
|
||||
} else if (ply.level.difficulty != Difficulty.PEACEFUL) {
|
||||
stats.foodLevel = stats.foodLevel.coerceAtMost(18)
|
||||
}
|
||||
|
||||
@ -1276,7 +1275,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
stats.setSaturation(stats.saturationLevel + (extracted / AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat())
|
||||
}
|
||||
|
||||
if (androidEnergy.batteryLevel <= Decimal.TEN && !ply.isCreative && ply.level().difficulty != Difficulty.PEACEFUL) {
|
||||
if (androidEnergy.batteryLevel <= Decimal.TEN && !ply.isCreative && ply.level.difficulty != Difficulty.PEACEFUL) {
|
||||
if (stats.saturationLevel > 1f) {
|
||||
if (androidEnergy.receiveEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) {
|
||||
stats.setSaturation(stats.saturationLevel - 1f)
|
||||
@ -1293,7 +1292,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
}
|
||||
|
||||
if (androidEnergy.batteryLevel <= Decimal.TEN) {
|
||||
if (--nextDischargeHurt <= 0 && ply.hurt(DamageSource(ply.level().registryAccess().damageType(MDamageTypes.ANDROID_DISCHARGE)), 1f)) {
|
||||
if (--nextDischargeHurt <= 0 && ply.hurt(MDamageTypes.ANDROID_DISCHARGE, 1f)) {
|
||||
nextDischargeHurt = 20
|
||||
}
|
||||
|
||||
@ -1306,13 +1305,13 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
} else {
|
||||
nextDischargeHurt = 20
|
||||
|
||||
if (ply.isHurt && ply.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
if (ply.isHurt && ply.level.gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
if (--nextHealTick <= 0) {
|
||||
nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION
|
||||
nextHealTick = if (ply.level.difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION
|
||||
ply.heal(1f)
|
||||
}
|
||||
} else {
|
||||
nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION
|
||||
nextHealTick = if (ply.level.difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1439,9 +1438,9 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
val pos = Vector4f(model.body.x / 16f, model.body.y / 16f, model.body.z / 16f, 1f)
|
||||
val cam = minecraft.gameRenderer.mainCamera.position
|
||||
|
||||
pos.mul(RenderSystem.getProjectionMatrix())
|
||||
pos.mul(poseStack.last().pose())
|
||||
makeSmoke(cam.x + pos.x, cam.y + pos.y, cam.z + pos.z, ply.level().random, ply.level())
|
||||
pos.transform(RenderSystem.getProjectionMatrix())
|
||||
pos.transform(poseStack.last().pose())
|
||||
makeSmoke(cam.x + pos.x(), cam.y + pos.y(), cam.z + pos.z(), ply.level.random, ply.level)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1536,13 +1535,13 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
val ent = event.player
|
||||
|
||||
if (event.phase == TickEvent.Phase.START) {
|
||||
if (!ent.level().isClientSide) {
|
||||
if (!ent.level.isClientSide) {
|
||||
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
||||
it.preTick()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ent.level().isClientSide) {
|
||||
if (ent.level.isClientSide) {
|
||||
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
||||
it.tickClient()
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.ticks.ContainerSingleItem
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||
import net.minecraftforge.common.util.INBTSerializable
|
||||
import ru.dbotthepony.kommons.io.DelegateSyncher
|
||||
@ -13,6 +12,7 @@ import ru.dbotthepony.kommons.util.setValue
|
||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.capability.extractEnergy
|
||||
import ru.dbotthepony.mc.otm.capability.receiveEnergy
|
||||
import ru.dbotthepony.mc.otm.container.IContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.math.getDecimal
|
||||
import ru.dbotthepony.mc.otm.core.nbt.getItemStack
|
||||
@ -31,7 +31,7 @@ class BatteryBackedEnergyStorage(
|
||||
maxCharge: Decimal,
|
||||
val isAndroid: Boolean,
|
||||
val onChange: Runnable? = null
|
||||
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, ContainerSingleItem {
|
||||
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, IContainer {
|
||||
override val energyFlow: FlowDirection
|
||||
get() = FlowDirection.INPUT
|
||||
|
||||
@ -65,6 +65,22 @@ class BatteryBackedEnergyStorage(
|
||||
item = stack
|
||||
}
|
||||
|
||||
override fun clearContent() {
|
||||
item = ItemStack.EMPTY
|
||||
}
|
||||
|
||||
override fun getContainerSize(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
return item.isEmpty
|
||||
}
|
||||
|
||||
override fun removeItemNoUpdate(slot: Int): ItemStack {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun setChanged() {
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl
|
||||
|
||||
val x = minecraft.window.guiScaledWidth.toFloat() * .5f + iconSize / 2f
|
||||
val y = minecraft.window.guiScaledHeight.toFloat() * .5f - iconSize / 2f
|
||||
val wrap = MGUIGraphics(event.guiGraphics)
|
||||
val wrap = MGUIGraphics(event.poseStack)
|
||||
|
||||
feature.renderIcon(wrap, x, y, iconSize, iconSize)
|
||||
|
||||
|
@ -155,7 +155,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
RenderSystem.setShaderColor(0f, 0f, 0f, 0.6f)
|
||||
|
||||
val size = minecraft.window.guiScaledHeight.coerceAtMost(minecraft.window.guiScaledWidth).toFloat() * 0.35f
|
||||
val wrap = MGUIGraphics(event.guiGraphics)
|
||||
val wrap = MGUIGraphics(event.poseStack)
|
||||
|
||||
wrap.drawArc(
|
||||
minecraft.window.guiScaledWidth / 2f,
|
||||
@ -241,7 +241,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
|
||||
val iconSize = size * 0.25f
|
||||
|
||||
val poseStack = event.guiGraphics.pose()
|
||||
val poseStack = event.poseStack
|
||||
poseStack.pushPose()
|
||||
poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
||||
|
||||
@ -294,7 +294,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
|
||||
val y = minecraft.window.guiScaledHeight * 0.2f
|
||||
var x = minecraft.window.guiScaledWidth * 0.5f - (features.size.toFloat() * COOLDOWN_ICON_SIZE / 2f + (features.size - 1).toFloat() * (COOLDOWN_ICON_MARGIN / 2f))
|
||||
val wrap = MGUIGraphics(event.guiGraphics)
|
||||
val wrap = MGUIGraphics(event.poseStack)
|
||||
|
||||
for (feature in features) {
|
||||
feature.renderIcon(wrap, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE)
|
||||
|
@ -60,7 +60,7 @@ fun onMovementInputUpdate(event: MovementInputUpdateEvent) {
|
||||
cap.lastJumpTicks = 14
|
||||
} else {
|
||||
if (ply.isInWater) {
|
||||
if (ply.onGround()) {
|
||||
if (ply.isOnGround) {
|
||||
cap.lastJumpTicks = 14
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ fun onMouseScrolled(event: MouseScrolled.Pre) {
|
||||
|
||||
for (widget in screen.renderables) {
|
||||
if (widget is Panel2Widget<*, *>) {
|
||||
if (widget.panel.mouseScrolledChecked(event.mouseX, event.mouseY, event.deltaX)) {
|
||||
if (widget.panel.mouseScrolledChecked(event.mouseX, event.mouseY, event.scrollDelta)) {
|
||||
event.isCanceled = true
|
||||
return
|
||||
}
|
||||
@ -233,7 +233,7 @@ fun onMouseScrolled(event: MouseScrolled.Pre) {
|
||||
val slot = screen.slotUnderMouse
|
||||
|
||||
if (slot != null && (slot.container == minecraft.player?.inventory && slot.containerSlot in 9 .. 35 || slot.container == minecraft.player?.matteryPlayer?.exopackContainer)) {
|
||||
widget.panel.mouseScrolledInner(event.mouseX, event.mouseY, event.deltaX)
|
||||
widget.panel.mouseScrolledInner(event.mouseX, event.mouseY, event.scrollDelta)
|
||||
event.isCanceled = true
|
||||
return
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.client
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import net.minecraft.client.gui.Font
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
|
||||
import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.gui.screens.DeathScreen
|
||||
import net.minecraft.client.gui.screens.InBedChatScreen
|
||||
@ -141,7 +142,7 @@ object MatteryGUI {
|
||||
return
|
||||
}
|
||||
|
||||
val guiGraphics = MGUIGraphics(event.guiGraphics)
|
||||
val guiGraphics = MGUIGraphics(event.poseStack)
|
||||
val stack = guiGraphics.pose
|
||||
val window = event.window
|
||||
|
||||
@ -253,7 +254,7 @@ object MatteryGUI {
|
||||
|
||||
val leftPadding = ceil(level * 80f - 0.5f)
|
||||
|
||||
val guiGraphics = MGUIGraphics(event.guiGraphics)
|
||||
val guiGraphics = MGUIGraphics(event.poseStack)
|
||||
|
||||
if (ply.hasEffect(MobEffects.HUNGER)) {
|
||||
CHARGE_HUNGER_BG.render(guiGraphics, left.toFloat(), top.toFloat())
|
||||
@ -323,7 +324,7 @@ object MatteryGUI {
|
||||
val top: Int = height - gui.leftHeight
|
||||
gui.leftHeight += 10
|
||||
|
||||
val guiGraphics = MGUIGraphics(event.guiGraphics)
|
||||
val guiGraphics = MGUIGraphics(event.poseStack)
|
||||
|
||||
HEALTH_BG.render(guiGraphics, left.toFloat(), top.toFloat())
|
||||
|
||||
@ -360,7 +361,7 @@ object MatteryGUI {
|
||||
}
|
||||
}
|
||||
|
||||
fun renderShieldCooldownOverlay(graphics: GuiGraphics, font: Font, stack: ItemStack, x: Int, y: Int): Boolean {
|
||||
fun renderShieldCooldownOverlay(pose: PoseStack, font: Font, stack: ItemStack, x: Int, y: Int): Boolean {
|
||||
if (!stack.isEmpty && stack.item is ShieldItem) {
|
||||
if (!stack.canPerformAction(ToolActions.SHIELD_BLOCK)) return false
|
||||
|
||||
@ -369,7 +370,7 @@ object MatteryGUI {
|
||||
|
||||
val percent = ((stack.item.getUseDuration(stack) - ply.useItemRemainingTicks + minecraft.partialTick) / 5f).coerceIn(0f, 1f)
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
||||
drawArc(graphics.pose(), x + 8f, y + 8f, 8f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * percent, alignAtCenter = true)
|
||||
drawArc(pose, x + 8f, y + 8f, 8f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * percent, alignAtCenter = true)
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||
|
||||
return true
|
||||
|
@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.client.render
|
||||
import com.google.common.collect.ImmutableList
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import com.mojang.blaze3d.vertex.VertexSorting
|
||||
import it.unimi.dsi.fastutil.ints.IntArrays
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
@ -63,7 +63,8 @@ private fun equals(existing: ImmutableList<RenderType>?, types: ImmutableList<Re
|
||||
*
|
||||
* Allows to batch OTM's geometry
|
||||
*/
|
||||
class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInitialBufferSize: Int = Int.MAX_VALUE, val vertexSorting: VertexSorting = VertexSorting.DISTANCE_TO_ORIGIN) : MultiBufferSource {
|
||||
// 1.19.4 and earlier: there is no actual quad sorting
|
||||
class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInitialBufferSize: Int = Int.MAX_VALUE, val sortX: Int = 0, val sortY: Int = 0, val sortZ: Int = 0) : MultiBufferSource {
|
||||
init {
|
||||
require(minimalInitialBufferSize >= 0) { "Invalid minimal buffer size $minimalInitialBufferSize" }
|
||||
require(maximalInitialBufferSize >= minimalInitialBufferSize) { "Maximal buffer size $maximalInitialBufferSize must be greater or equal to minimal buffer size $minimalInitialBufferSize" }
|
||||
@ -350,7 +351,7 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
for (state in bufferList) {
|
||||
if (state.dirty) {
|
||||
state.dirty = false
|
||||
state.type.end(state.builder, vertexSorting)
|
||||
state.type.end(state.builder, sortX, sortY, sortZ)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -360,7 +361,7 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
|
||||
if (state.dirty) {
|
||||
state.dirty = false
|
||||
type.end(state.builder, vertexSorting)
|
||||
type.end(state.builder, sortX, sortY, sortZ)
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,7 +370,7 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
|
||||
if (state.dirty) {
|
||||
state.dirty = false
|
||||
type.end(state.builder, vertexSorting)
|
||||
type.end(state.builder, sortX, sortY, sortZ)
|
||||
}
|
||||
|
||||
for (ustate in state.dependants) {
|
||||
@ -380,7 +381,7 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
private fun endBatchChain(state: State) {
|
||||
if (state.dirty) {
|
||||
state.dirty = false
|
||||
state.type.end(state.builder, vertexSorting)
|
||||
state.type.end(state.builder, sortX, sortY, sortZ)
|
||||
}
|
||||
|
||||
for (ustate in state.dependants) {
|
||||
@ -390,7 +391,7 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val GUI = DynamicBufferSource(maximalInitialBufferSize = 2 shl 8, vertexSorting = VertexSorting.ORTHOGRAPHIC_Z)
|
||||
val GUI = DynamicBufferSource(maximalInitialBufferSize = 2 shl 8)
|
||||
@JvmField
|
||||
val WORLD = DynamicBufferSource(minimalInitialBufferSize = 2 shl 12)
|
||||
|
||||
|
@ -1,25 +1,23 @@
|
||||
package ru.dbotthepony.mc.otm.client.render
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.VertexSorting
|
||||
import com.mojang.math.Matrix4f
|
||||
import net.minecraft.client.gui.Font
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.util.FormattedCharSequence
|
||||
import org.joml.Matrix4f
|
||||
import ru.dbotthepony.mc.otm.core.FloatSupplier
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.core.math.component1
|
||||
import ru.dbotthepony.mc.otm.core.math.component2
|
||||
import ru.dbotthepony.mc.otm.core.math.component3
|
||||
|
||||
private val buffer = DynamicBufferSource(vertexSorting = VertexSorting.ORTHOGRAPHIC_Z)
|
||||
private val buffer = DynamicBufferSource()
|
||||
private fun buffer() = buffer
|
||||
|
||||
private fun Font.drawInBatch(
|
||||
text: Any, x: Float, y: Float, color: Int, drawShadow: Boolean,
|
||||
matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Font.DisplayMode,
|
||||
matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Boolean,
|
||||
effectColor: Int, packedLightCoords: Int, gravity: RenderGravity,
|
||||
rounding: GravityRounding, width: FloatSupplier
|
||||
): Int {
|
||||
@ -122,7 +120,7 @@ private fun Font.drawInternal(
|
||||
scale: Float,
|
||||
color: RGBAColor,
|
||||
drawShadow: Boolean,
|
||||
displayMode: Font.DisplayMode,
|
||||
displayMode: Boolean,
|
||||
packedLightCoords: Int,
|
||||
effectColor: Int,
|
||||
shadowColor: RGBAColor,
|
||||
@ -241,7 +239,7 @@ fun Font.draw(
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
@ -289,7 +287,7 @@ fun Font.draw(
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
@ -337,7 +335,7 @@ fun Font.draw(
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
|
@ -5,12 +5,12 @@ import com.mojang.blaze3d.platform.GlConst
|
||||
import com.mojang.blaze3d.platform.GlStateManager
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.*
|
||||
import com.mojang.math.Matrix4f
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.FogRenderer
|
||||
import net.minecraft.client.renderer.GameRenderer
|
||||
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
|
||||
import net.minecraft.world.level.material.FogType
|
||||
import org.joml.Matrix4f
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
@ -148,7 +148,7 @@ object GlitchRenderer {
|
||||
|
||||
val glitchBuffer = glitchBuffer
|
||||
val projection = RenderSystem.getProjectionMatrix()
|
||||
RenderSystem.setProjectionMatrix(Matrix4f(), VertexSorting.ORTHOGRAPHIC_Z)
|
||||
RenderSystem.setProjectionMatrix(Matrix4f())
|
||||
|
||||
RenderSystem.getModelViewStack().also {
|
||||
it.pushPose()
|
||||
@ -244,7 +244,7 @@ object GlitchRenderer {
|
||||
RenderSystem.setShaderTexture(0, glitchBuffer.colorTextureId)
|
||||
draw(0.0, 0.0)
|
||||
|
||||
RenderSystem.setProjectionMatrix(projection, VertexSorting.DISTANCE_TO_ORIGIN)
|
||||
RenderSystem.setProjectionMatrix(projection)
|
||||
RenderSystem.getModelViewStack().popPose()
|
||||
RenderSystem.applyModelViewMatrix()
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ data class ItemStackIcon(private val itemStack: ItemStack, override val width: F
|
||||
pose.scale(width / 16f, height / 16f, 1f)
|
||||
|
||||
guiGraphics.setColor(color.red, color.green, color.blue, color.alpha)
|
||||
guiGraphics.renderFakeItem(itemStack, 0, 0)
|
||||
guiGraphics.renderFakeItem(pose, itemStack, 0, 0)
|
||||
pose.popPose()
|
||||
|
||||
clearDepth(pose, x, y, width, height)
|
||||
|
@ -1,33 +1,47 @@
|
||||
package ru.dbotthepony.mc.otm.client.render
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.BufferUploader
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.Tesselator
|
||||
import com.mojang.blaze3d.vertex.VertexFormat
|
||||
import net.minecraft.client.gui.Font
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiComponent
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent
|
||||
import net.minecraft.client.renderer.GameRenderer
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.util.FormattedCharSequence
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.client.ForgeHooksClient
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
// polyfill class for 1.19.4 and older
|
||||
class MGUIGraphics(val parent: GuiGraphics) {
|
||||
val pose: PoseStack get() = parent.pose()
|
||||
val bufferSource: MultiBufferSource.BufferSource get() = parent.bufferSource()
|
||||
val width get() = parent.guiWidth()
|
||||
val height get() = parent.guiHeight()
|
||||
class MGUIGraphics(val pose: PoseStack) {
|
||||
val bufferSource: MultiBufferSource.BufferSource get() = minecraft.renderBuffers().crumblingBufferSource()
|
||||
val width get() = minecraft.window.guiScaledWidth
|
||||
val height get() = minecraft.window.guiScaledHeight
|
||||
val font: Font get() = minecraft.font
|
||||
|
||||
fun setColor(red: Float, green: Float, blue: Float, alpha: Float) {
|
||||
parent.setColor(red, green, blue, alpha)
|
||||
RenderSystem.setShaderColor(red, green, blue, alpha)
|
||||
}
|
||||
|
||||
fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) {
|
||||
parent.renderFakeItem(itemStack, x, y)
|
||||
fun renderFakeItem(poseStack: PoseStack, itemStack: ItemStack, x: Int, y: Int) {
|
||||
val global = RenderSystem.getModelViewStack()
|
||||
global.pushPose()
|
||||
global.last().pose().multiply(poseStack.last().pose())
|
||||
global.last().normal().mul(poseStack.last().normal())
|
||||
RenderSystem.applyModelViewMatrix()
|
||||
minecraft.itemRenderer.renderGuiItem(itemStack, x, y)
|
||||
global.popPose()
|
||||
RenderSystem.applyModelViewMatrix()
|
||||
}
|
||||
|
||||
fun drawLine(
|
||||
@ -79,11 +93,91 @@ class MGUIGraphics(val parent: GuiGraphics) {
|
||||
}
|
||||
|
||||
fun renderComponentTooltip(font: Font, lines: MutableList<Component>, x: Int, y: Int, itemStack: ItemStack = ItemStack.EMPTY) {
|
||||
parent.renderComponentTooltip(font, lines, x, y, itemStack)
|
||||
if (lines.isNotEmpty()) {
|
||||
val mapped = lines.map { ClientTooltipComponent.create(it.visualOrderText) }
|
||||
val preEvent = ForgeHooksClient.onRenderTooltipPre(itemStack, pose, x, y, width, height, mapped, font, font)
|
||||
|
||||
if (preEvent.isCanceled) return
|
||||
var totalWidth = 0
|
||||
var totalHeight = if (lines.size == 1) -2 else 0
|
||||
|
||||
for (line in mapped) {
|
||||
val k = line.getWidth(preEvent.font)
|
||||
if (k > totalWidth) totalWidth = k
|
||||
totalHeight += line.height
|
||||
}
|
||||
|
||||
@Suppress("NAME_SHADOWING")
|
||||
var x = x + 12
|
||||
@Suppress("NAME_SHADOWING")
|
||||
var y = y - 12
|
||||
|
||||
if (x + totalWidth >= minecraft.window.guiScaledWidth)
|
||||
x = (x - 24 - totalWidth).coerceAtLeast(4)
|
||||
|
||||
if (y + totalHeight + 3 >= minecraft.window.guiScaledHeight)
|
||||
y = minecraft.window.guiScaledHeight - totalHeight - 3
|
||||
|
||||
pose.pushPose()
|
||||
val tesselator = Tesselator.getInstance()
|
||||
val bufferbuilder = tesselator.builder
|
||||
RenderSystem.setShader { GameRenderer.getPositionColorShader() }
|
||||
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR)
|
||||
val matrix4f = pose.last().pose()
|
||||
|
||||
run {
|
||||
val j2 = x
|
||||
val k2 = y
|
||||
val j = totalHeight
|
||||
val i = totalWidth
|
||||
|
||||
val colorEvent = ForgeHooksClient.onRenderTooltipColor(itemStack, pose, j2, k2, preEvent.font, mapped)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, colorEvent.backgroundStart, colorEvent.backgroundStart)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, colorEvent.backgroundEnd, colorEvent.backgroundEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, colorEvent.backgroundStart, colorEvent.backgroundEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, colorEvent.borderStart, colorEvent.borderEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, colorEvent.borderStart, colorEvent.borderEnd)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, colorEvent.borderStart, colorEvent.borderStart)
|
||||
GuiComponent.fillGradient(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, colorEvent.borderEnd, colorEvent.borderEnd)
|
||||
}
|
||||
|
||||
RenderSystem.enableDepthTest()
|
||||
RenderSystem.disableTexture()
|
||||
RenderSystem.enableBlend()
|
||||
RenderSystem.defaultBlendFunc()
|
||||
BufferUploader.drawWithShader(bufferbuilder.end())
|
||||
RenderSystem.disableBlend()
|
||||
RenderSystem.enableTexture()
|
||||
|
||||
pose.translate(0.0f, 0.0f, 400.0f)
|
||||
var yCurrent = y
|
||||
|
||||
for (i in mapped.indices) {
|
||||
val line = mapped[i]
|
||||
line.renderText(preEvent.font, x, yCurrent, matrix4f, bufferSource)
|
||||
yCurrent += line.height + if (i == 0) 2 else 0
|
||||
}
|
||||
|
||||
bufferSource.endBatch()
|
||||
|
||||
yCurrent = y
|
||||
|
||||
for (i in mapped.indices) {
|
||||
val line = mapped[i]
|
||||
line.renderImage(preEvent.font, x, yCurrent, pose, minecraft.itemRenderer, 0 /* blit offset, i love you, go commit self-murder */)
|
||||
/* because your existence servers ZERO FUCKING PURPOSE */
|
||||
/* Z-BUFFER IN MY GUI PIECE OF SHIT */
|
||||
yCurrent += line.height + if (i == 0) 2 else 0
|
||||
}
|
||||
|
||||
pose.popPose()
|
||||
}
|
||||
}
|
||||
|
||||
fun flush() {
|
||||
parent.flush()
|
||||
bufferSource.endBatch()
|
||||
}
|
||||
|
||||
fun draw(
|
||||
@ -94,7 +188,7 @@ class MGUIGraphics(val parent: GuiGraphics) {
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
@ -144,7 +238,7 @@ class MGUIGraphics(val parent: GuiGraphics) {
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
@ -194,7 +288,7 @@ class MGUIGraphics(val parent: GuiGraphics) {
|
||||
scale: Float = 1f,
|
||||
color: RGBAColor = RGBAColor.WHITE,
|
||||
drawShadow: Boolean = false,
|
||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
||||
displayMode: Boolean = false,
|
||||
packedLightCoords: Int = 15728880,
|
||||
effectColor: Int = 0,
|
||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||
@ -238,14 +332,14 @@ class MGUIGraphics(val parent: GuiGraphics) {
|
||||
|
||||
fun renderSprite(
|
||||
sprite: TextureAtlasSprite, x: Float, y: Float,
|
||||
width: Float = sprite.contents().width().toFloat(),
|
||||
height: Float = sprite.contents().height().toFloat(),
|
||||
width: Float = sprite.width.toFloat(),
|
||||
height: Float = sprite.height.toFloat(),
|
||||
color: RGBAColor = RGBAColor.WHITE
|
||||
) {
|
||||
renderTexturedRect(
|
||||
x, y, width, height,
|
||||
uv = UVCoords(sprite.u0, sprite.v0, sprite.u1, sprite.v1),
|
||||
texture = sprite.atlasLocation(),
|
||||
texture = sprite.atlas().location(),
|
||||
color = color
|
||||
)
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package ru.dbotthepony.mc.otm.client.render
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.Tesselator
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import com.mojang.math.Matrix4f
|
||||
import com.mojang.math.Vector3f
|
||||
import net.minecraft.core.Vec3i
|
||||
import org.joml.Matrix4f
|
||||
import org.joml.Vector3f
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.core.math.IAngle
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.core.math.Vector
|
||||
import ru.dbotthepony.mc.otm.core.math.rotateAroundPoint
|
||||
import ru.dbotthepony.mc.otm.core.math.rotateAroundThis
|
||||
@ -24,6 +24,8 @@ fun VertexConsumer.color(color: RGBAColor?): VertexConsumer {
|
||||
return this
|
||||
}
|
||||
|
||||
fun PoseStack.translate(x: Float, y: Float, z: Float) = translate(x.toDouble(), y.toDouble(), z.toDouble())
|
||||
|
||||
fun PoseStack.translate(vector: Vector) = translate(vector.x, vector.y, vector.z)
|
||||
fun PoseStack.translate(vector: Vec3i) = translate(vector.x.toDouble(), vector.y.toDouble(), vector.z.toDouble())
|
||||
fun PoseStack.translate(vector: Vector3f) = translate(vector.x(), vector.y(), vector.z())
|
||||
@ -31,7 +33,7 @@ fun PoseStack.translate(vector: Vector3f) = translate(vector.x(), vector.y(), ve
|
||||
fun PoseStack.rotateAroundPoint(point: Vector, axis: Vector, rotation: Float, isDegrees: Boolean = false) {
|
||||
val last = last()
|
||||
last.pose().rotateAroundPoint(point, axis, rotation, isDegrees)
|
||||
last.normal().rotate(axis.rotateAroundThis(rotation, isDegrees))
|
||||
last.normal().mul(axis.rotateAroundThis(rotation, isDegrees))
|
||||
}
|
||||
|
||||
fun PoseStack.rotateAroundPoint(point: Vector, rotation: IAngle) {
|
||||
@ -43,7 +45,7 @@ fun PoseStack.rotateAroundPoint(point: Vector, rotation: IAngle) {
|
||||
fun PoseStack.rotateAroundPoint(point: Vector3f, axis: Vector, rotation: Float, isDegrees: Boolean = false) {
|
||||
val last = last()
|
||||
last.pose().rotateAroundPoint(point, axis, rotation, isDegrees)
|
||||
last.normal().rotate(axis.rotateAroundThis(rotation, isDegrees))
|
||||
last.normal().mul(axis.rotateAroundThis(rotation, isDegrees))
|
||||
}
|
||||
|
||||
fun PoseStack.rotateAroundPoint(point: Vector3f, rotation: IAngle) {
|
||||
@ -52,6 +54,13 @@ fun PoseStack.rotateAroundPoint(point: Vector3f, rotation: IAngle) {
|
||||
// last.normal().mul(rotation.forward().rotateAroundThis(rotation))
|
||||
}
|
||||
|
||||
fun PoseStack.rotateAround(axis: Vector3f, radians: Float) {
|
||||
val q = axis.rotation(radians)
|
||||
val pose = last
|
||||
pose.pose.multiply(q)
|
||||
pose.normal().mul(q)
|
||||
}
|
||||
|
||||
fun PoseStack.translation(): Vector3f {
|
||||
return last().pose().translation
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user