Move registry to kotlin

This commit is contained in:
DBotThePony 2022-02-24 22:02:50 +07:00
parent db5775c90b
commit d49c679253
Signed by: DBot
GPG Key ID: DCC23B5715498507
57 changed files with 1516 additions and 1633 deletions

View File

@ -4,8 +4,6 @@ import net.minecraft.core.Direction
import net.minecraft.data.recipes.ShapedRecipeBuilder import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.Tag
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.IronBarsBlock import net.minecraft.world.level.block.IronBarsBlock
@ -16,7 +14,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent
import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.Mod
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.block.DriveViewerBlock import ru.dbotthepony.mc.otm.block.DriveViewerBlock
@ -50,17 +47,22 @@ object DataGen {
private fun decorativeCubeAll(vararg blocks: Block) { private fun decorativeCubeAll(vararg blocks: Block) {
blockModelProvider.decorativeCubeAll(*blocks) blockModelProvider.decorativeCubeAll(*blocks)
blockStateProvider.block(*blocks) blockStateProvider.simpleBlockM(*blocks)
}
private fun decorativeCubeAll(blocks: List<Block>) {
blockModelProvider.decorativeCubeAll(blocks)
blockStateProvider.simpleBlockM(blocks)
} }
private fun resourceCubeAll(vararg blocks: Block) { private fun resourceCubeAll(vararg blocks: Block) {
blockModelProvider.resourceCubeAll(*blocks) blockModelProvider.resourceCubeAll(*blocks)
blockStateProvider.block(*blocks) blockStateProvider.simpleBlockM(*blocks)
} }
private fun decorativeColumn(block: Block, side: String, end: String) { private fun decorativeColumn(block: Block, side: String, end: String) {
blockModelProvider.decorativeColumn(block, side, end) blockModelProvider.decorativeColumn(block, side, end)
blockStateProvider.block(block) blockStateProvider.simpleBlockM(block)
} }
private fun pane(block: Block, textureSide: ResourceLocation, textureRailing: ResourceLocation) { private fun pane(block: Block, textureSide: ResourceLocation, textureRailing: ResourceLocation) {
@ -126,12 +128,12 @@ object DataGen {
event.generator.addProvider(lootTableProvider) event.generator.addProvider(lootTableProvider)
event.generator.addProvider(lootModifier) event.generator.addProvider(lootModifier)
decorativeCubeAll(*MBlocks.CRATES) decorativeCubeAll(MBlocks.CRATE_LIST)
decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK) decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK)
decorativeCubeAll(MBlocks.TRITANIUM_BLOCK) decorativeCubeAll(MBlocks.TRITANIUM_BLOCK)
for (glass in Registry.INDUSTRIAL_GLASS_LIST) { for (glass in MBlocks.INDUSTRIAL_GLASS_LIST) {
decorativeCubeAll(glass.block) decorativeCubeAll(glass)
} }
blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_ORE) blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_ORE)
@ -140,11 +142,11 @@ object DataGen {
decorativeColumn(MBlocks.TRITANIUM_STRIPED_BLOCK, "tritanium_striped_block", "tritanium_block") decorativeColumn(MBlocks.TRITANIUM_STRIPED_BLOCK, "tritanium_striped_block", "tritanium_block")
for (glass in Registry.INDUSTRIAL_GLASS_LIST) { for ((i, glass) in MBlocks.INDUSTRIAL_GLASS_PANE_LIST.withIndex()) {
val name = glass.block.registryName?.path ?: throw IllegalStateException("Invalid state of glass block ${glass.block}") val name = MBlocks.INDUSTRIAL_GLASS_LIST[i].registryName!!.path
val textureSide = ResourceLocation(MOD_ID, "block/decorative/$name") val textureSide = ResourceLocation(MOD_ID, "block/decorative/$name")
val textureRailing = textureSide val textureRailing = textureSide
pane(glass.pane, textureSide, textureRailing) pane(glass, textureSide, textureRailing)
} }
with(blockModelProvider) { with(blockModelProvider) {
@ -207,14 +209,17 @@ object DataGen {
block(MItems.ITEM_MONITOR) block(MItems.ITEM_MONITOR)
block(MItems.TRITANIUM_BLOCK) block(MItems.TRITANIUM_BLOCK)
for (glass in Registry.INDUSTRIAL_GLASS_LIST) { for (glass in MItems.INDUSTRIAL_GLASS_LIST) {
block(glass.item) block(glass)
generated(glass.paneItem, ResourceLocation(MOD_ID, "block/decorative/${glass.item.registryName!!.path}"))
} }
blocks(*MItems.CRATES) for ((i, glass) in MItems.INDUSTRIAL_GLASS_PANE_LIST.withIndex()) {
generated(glass, ResourceLocation(MOD_ID, "block/decorative/${MItems.INDUSTRIAL_GLASS_LIST[i].registryName!!.path}"))
}
components(*MItems.DATAGEN_COMPONENTS) blocks(MItems.CRATE_LIST)
components(MItems.DATAGEN_COMPONENTS)
generated(MItems.PILL_ANDROID) generated(MItems.PILL_ANDROID)
generated(MItems.PILL_HUMANE) generated(MItems.PILL_HUMANE)
@ -224,8 +229,8 @@ object DataGen {
component(MItems.TRITANIUM_INGOT) component(MItems.TRITANIUM_INGOT)
resource(MItems.TRITANIUM_ORE_CLUMP) resource(MItems.TRITANIUM_ORE_CLUMP)
handheld(*MItems.TRITANIUM_TOOLS) handheld(MItems.TRITANIUM_TOOLS)
generated(*MItems.TRITANIUM_ARMOR) generated(MItems.TRITANIUM_ARMOR)
generatedTiered(MItems.BATTERIES, "battery_tier") generatedTiered(MItems.BATTERIES, "battery_tier")
generated(MItems.BATTERY_CREATIVE) generated(MItems.BATTERY_CREATIVE)
@ -339,7 +344,7 @@ object DataGen {
) )
with(lootTableProvider) { with(lootTableProvider) {
simpleBlocks(*MBlocks.CRATES) simpleBlocks(MBlocks.CRATE_LIST)
simpleBlock(MBlocks.CARGO_CRATE) simpleBlock(MBlocks.CARGO_CRATE)
simpleBlock(MBlocks.CARBON_FIBRE_BLOCK) simpleBlock(MBlocks.CARBON_FIBRE_BLOCK)
simpleBlock(MBlocks.TRITANIUM_RAW_BLOCK) simpleBlock(MBlocks.TRITANIUM_RAW_BLOCK)
@ -385,56 +390,59 @@ object DataGen {
} }
lambda { _, consumer -> lambda { _, consumer ->
ShapelessRecipeBuilder(Registry.INDUSTRIAL_GLASS.item, 8) ShapelessRecipeBuilder(MItems.INDUSTRIAL_GLASS, 8)
.requires(net.minecraft.world.item.Items.GLASS, 8) .requires(net.minecraft.world.item.Items.GLASS, 8)
.requires(MTags.Items.PLATE_TRITANIUM) .requires(MTags.Items.PLATE_TRITANIUM)
.unlockedBy("has_plate", has(MTags.Items.PLATE_TRITANIUM)) .unlockedBy("has_plate", has(MTags.Items.PLATE_TRITANIUM))
.unlockedBy("has_glass", has(net.minecraft.world.item.Items.GLASS)) .unlockedBy("has_glass", has(net.minecraft.world.item.Items.GLASS))
.save(consumer) .save(consumer)
ShapedRecipeBuilder(Registry.INDUSTRIAL_GLASS.paneItem, 16) ShapedRecipeBuilder(MItems.INDUSTRIAL_GLASS_PANE, 16)
.define('#', Registry.INDUSTRIAL_GLASS.item) .define('#', MItems.INDUSTRIAL_GLASS)
.pattern("###").pattern("###") .pattern("###").pattern("###")
.unlockedBy("has_tritanium_glass", has(Registry.INDUSTRIAL_GLASS.item)) .unlockedBy("has_tritanium_glass", has(MItems.INDUSTRIAL_GLASS))
.save(consumer) .save(consumer)
val mapping = mapOf<Registry.IndustrialGlassProps, Tag<Item>>( val mapping = listOf(
Registry.INDUSTRIAL_GLASS_BLACK to Tags.Items.DYES_BLACK, Tags.Items.DYES_WHITE,
Registry.INDUSTRIAL_GLASS_RED to Tags.Items.DYES_RED, Tags.Items.DYES_ORANGE,
Registry.INDUSTRIAL_GLASS_GREEN to Tags.Items.DYES_GREEN, Tags.Items.DYES_MAGENTA,
Registry.INDUSTRIAL_GLASS_BROWN to Tags.Items.DYES_BROWN, Tags.Items.DYES_LIGHT_BLUE,
Registry.INDUSTRIAL_GLASS_BLUE to Tags.Items.DYES_BLUE, Tags.Items.DYES_YELLOW,
Registry.INDUSTRIAL_GLASS_PURPLE to Tags.Items.DYES_PURPLE, Tags.Items.DYES_LIME,
Registry.INDUSTRIAL_GLASS_CYAN to Tags.Items.DYES_CYAN, Tags.Items.DYES_PINK,
Registry.INDUSTRIAL_GLASS_LIGHT_GRAY to Tags.Items.DYES_LIGHT_GRAY, Tags.Items.DYES_GRAY,
Registry.INDUSTRIAL_GLASS_GRAY to Tags.Items.DYES_GRAY, Tags.Items.DYES_LIGHT_GRAY,
Registry.INDUSTRIAL_GLASS_PINK to Tags.Items.DYES_PINK, Tags.Items.DYES_CYAN,
Registry.INDUSTRIAL_GLASS_LIME to Tags.Items.DYES_LIME, Tags.Items.DYES_PURPLE,
Registry.INDUSTRIAL_GLASS_YELLOW to Tags.Items.DYES_YELLOW, Tags.Items.DYES_BLUE,
Registry.INDUSTRIAL_GLASS_LIGHT_BLUE to Tags.Items.DYES_LIGHT_BLUE, Tags.Items.DYES_BROWN,
Registry.INDUSTRIAL_GLASS_MAGENTA to Tags.Items.DYES_MAGENTA, Tags.Items.DYES_GREEN,
Registry.INDUSTRIAL_GLASS_ORANGE to Tags.Items.DYES_ORANGE, Tags.Items.DYES_RED,
Registry.INDUSTRIAL_GLASS_WHITE to Tags.Items.DYES_WHITE, Tags.Items.DYES_BLACK,
) )
for ((item, tag) in mapping) { for ((i, tag) in mapping.withIndex()) {
ShapelessRecipeBuilder(item.item, 8) val item = MItems.INDUSTRIAL_GLASS_LIST[i + 1]
.requires(Registry.INDUSTRIAL_GLASS.item, 8) val paneItem = MItems.INDUSTRIAL_GLASS_PANE_LIST[i + 1]
ShapelessRecipeBuilder(item, 8)
.requires(MItems.INDUSTRIAL_GLASS, 8)
.requires(tag) .requires(tag)
.unlockedBy("has_tritanium_glass", has(Registry.INDUSTRIAL_GLASS.item)) .unlockedBy("has_tritanium_glass", has(MItems.INDUSTRIAL_GLASS))
.save(consumer) .save(consumer)
ShapelessRecipeBuilder(item.paneItem, 8) ShapelessRecipeBuilder(paneItem, 8)
.requires(Registry.INDUSTRIAL_GLASS.paneItem, 8) .requires(MItems.INDUSTRIAL_GLASS_PANE, 8)
.requires(tag) .requires(tag)
.unlockedBy("has_tritanium_glass_pane", has(Registry.INDUSTRIAL_GLASS.paneItem)) .unlockedBy("has_tritanium_glass_pane", has(MItems.INDUSTRIAL_GLASS_PANE))
.save(consumer) .save(consumer)
ShapedRecipeBuilder(item.paneItem, 16) ShapedRecipeBuilder(paneItem, 16)
.define('#', item.item) .define('#', item)
.pattern("###").pattern("###") .pattern("###").pattern("###")
.unlockedBy("has_colored_tritanium_glass", has(item.paneItem)) .unlockedBy("has_colored_tritanium_glass", has(paneItem))
.save(consumer, ResourceLocation(MOD_ID, "${item.namePane.path}_alt")) .save(consumer, ResourceLocation(MOD_ID, "${paneItem.registryName!!.path}_alt"))
} }
} }
} }

View File

@ -15,10 +15,10 @@ import ru.dbotthepony.mc.otm.datagen.toXRotBlockstate
import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate
typealias AdvancedBlockStateFunction = (BlockState, ConfiguredModel.Builder<*>, String) -> String? typealias AdvancedBlockStateFunction = (BlockState, ConfiguredModel.Builder<*>, String) -> String?
private data class AdvancedBlockStateEntry(val block: BlockMattery, val func: AdvancedBlockStateFunction) private data class AdvancedBlockStateEntry(val block: Block, val func: AdvancedBlockStateFunction)
private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String { private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String {
var modelPath = modelPath @Suppress("NAME_SHADOWING") var modelPath = modelPath
it.getValueNullable(BlockMatteryRotatable.FACING)?.let { it.getValueNullable(BlockMatteryRotatable.FACING)?.let {
builder.rotationY(it.toYRotBlockstate()) builder.rotationY(it.toYRotBlockstate())
@ -45,14 +45,24 @@ private typealias Lambda = (MatteryBlockStateProvider) -> Unit
class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) { class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
private val blocks = ArrayList<AdvancedBlockStateEntry>() private val blocks = ArrayList<AdvancedBlockStateEntry>()
fun block(block: BlockMattery) = blocks.add(AdvancedBlockStateEntry(block) { _, _, _ -> null }) fun block(vararg block: Block) = block.forEach { blocks.add(AdvancedBlockStateEntry(it) { _, _, _ -> null }) }
fun block(block: BlockMattery, func: AdvancedBlockStateFunction) = blocks.add(AdvancedBlockStateEntry(block, func)) fun block(block: Block, func: AdvancedBlockStateFunction) = blocks.add(AdvancedBlockStateEntry(block, func))
fun block(blocks: List<Block>) {
for (block in blocks) {
this.blocks.add(AdvancedBlockStateEntry(block) { _, _, _ -> null })
}
}
private val simpleBlocks = ArrayList<Block>() private val simpleBlocks = ArrayList<Block>()
private val ores = ArrayList<Block>() private val ores = ArrayList<Block>()
private val lambdas = ArrayList<Lambda>() private val lambdas = ArrayList<Lambda>()
fun block(vararg blocks: Block) { fun simpleBlockM(vararg blocks: Block) {
this.simpleBlocks.addAll(blocks)
}
fun simpleBlockM(blocks: List<Block>) {
this.simpleBlocks.addAll(blocks) this.simpleBlocks.addAll(blocks)
} }

View File

@ -30,6 +30,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
fun block(item: Item) = delegates.add(SimpleItemModel(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/${item.registryName!!.path}"))) fun block(item: Item) = delegates.add(SimpleItemModel(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/${item.registryName!!.path}")))
fun block(item: Item, path: String) = delegates.add(SimpleItemModel(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/$path"))) fun block(item: Item, path: String) = delegates.add(SimpleItemModel(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/$path")))
fun blocks(vararg items: Item) = items.forEach(this::block) fun blocks(vararg items: Item) = items.forEach(this::block)
fun blocks(items: List<Item>) = items.forEach(this::block)
fun generated(item: Item, texture: ResourceLocation) { fun generated(item: Item, texture: ResourceLocation) {
generated.add(SimpleItemModel(item.registryName!!.path, texture)) generated.add(SimpleItemModel(item.registryName!!.path, texture))
@ -40,15 +41,18 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
} }
fun generated(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun generated(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) }
fun generated(items: List<Item>) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) }
fun generatedBlock(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/${it.registryName!!.path}")) } fun generatedBlock(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/${it.registryName!!.path}")) }
fun generatedBlockDecorative(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/decorative/${it.registryName!!.path}")) } fun generatedBlockDecorative(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/decorative/${it.registryName!!.path}")) }
fun handheld(vararg items: Item) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun handheld(vararg items: Item) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) }
fun handheld(items: List<Item>) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) }
fun generated(item: Item, prefix: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}")) fun generated(item: Item, prefix: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}"))
fun handheld(item: Item, prefix: String) = handheld(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}")) fun handheld(item: Item, prefix: String) = handheld(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}"))
fun component(item: Item) = generated(item, "component/") fun component(item: Item) = generated(item, "component/")
fun components(vararg items: Item) = items.forEach(this::component) fun components(vararg items: Item) = items.forEach(this::component)
fun components(items: List<Item>) = items.forEach(this::component)
fun resource(item: Item) = generated(item, "resources/") fun resource(item: Item) = generated(item, "resources/")
fun resources(vararg items: Item) = items.forEach(this::resource) fun resources(vararg items: Item) = items.forEach(this::resource)
@ -61,6 +65,15 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
} }
} }
fun generatedTiered(items: List<Item>, prefix: String) {
var i = 0
for (item in items) {
generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i"))
i++
}
}
companion object { companion object {
private val GENERATED = ResourceLocation("minecraft", "item/generated") private val GENERATED = ResourceLocation("minecraft", "item/generated")
private val HANDHELD = ResourceLocation("minecraft", "item/handheld") private val HANDHELD = ResourceLocation("minecraft", "item/handheld")

View File

@ -54,6 +54,10 @@ class LootTables(generator: DataGenerator) : LootTableProvider(generator) {
blocks.forEach(this::simpleBlock) blocks.forEach(this::simpleBlock)
} }
fun simpleBlocks(blocks: List<Block>) {
blocks.forEach(this::simpleBlock)
}
fun tile(block: Block, f: (CopyNbtFunction.Builder) -> Unit = {}) { fun tile(block: Block, f: (CopyNbtFunction.Builder) -> Unit = {}) {
block { block {
it.accept(block.lootTable, singleLootPool { it.accept(block.lootTable, singleLootPool {

View File

@ -80,6 +80,12 @@ class BlockMatteryModelProvider(event: GatherDataEvent) : MatteryModelProvider(e
} }
} }
fun decorativeCubeAll(blocks: List<Block>) {
for (it in blocks) {
cubeAll.add(CubeAllEntry(it.registryName!!.path, ResourceLocation("overdrive_that_matters:block/decorative/${it.registryName!!.path}")))
}
}
fun column(it: Block, end: String, side: String) { fun column(it: Block, end: String, side: String) {
cubeColumn.add(CubeColumnEntry(it.registryName!!.path, ResourceLocation(DataGen.MOD_ID, end), ResourceLocation(DataGen.MOD_ID, side))) cubeColumn.add(CubeColumnEntry(it.registryName!!.path, ResourceLocation(DataGen.MOD_ID, end), ResourceLocation(DataGen.MOD_ID, side)))
} }

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm; package ru.dbotthepony.mc.otm;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -44,10 +45,14 @@ public final class OverdriveThatMatters {
public AndroidGui ANDROID_GUI; public AndroidGui ANDROID_GUI;
public StorageObjectTuple<ItemStackWrapper> ITEM_STORAGE; public StorageObjectTuple<ItemStackWrapper> ITEM_STORAGE;
public static ResourceLocation loc(String path) {
return new ResourceLocation(MOD_ID, path);
}
public final CreativeModeTab CREATIVE_TAB = new CreativeModeTab("otm") { public final CreativeModeTab CREATIVE_TAB = new CreativeModeTab("otm") {
@Override @Override
public ItemStack makeIcon() { public ItemStack makeIcon() {
return new ItemStack(MItems.BATTERY_CREATIVE, 1); return new ItemStack(MItems.INSTANCE.getBATTERY_CREATIVE(), 1);
} }
}; };
@ -58,7 +63,8 @@ public final class OverdriveThatMatters {
INSTANCE = this; INSTANCE = this;
// Register the setup method for modloading MRegistry.INSTANCE.initialize(FMLJavaModLoadingContext.get());
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setupClient); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setupClient);
@ -73,23 +79,12 @@ public final class OverdriveThatMatters {
FMLJavaModLoadingContext.get().getModEventBus().register(MatteryCapability.class); FMLJavaModLoadingContext.get().getModEventBus().register(MatteryCapability.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MItems.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MBlocks.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MBlockEntities.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MMenus.class);
FMLJavaModLoadingContext.get().getModEventBus().register(AndroidFeatures.class);
FMLJavaModLoadingContext.get().getModEventBus().register(AndroidResearch.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MStats.class);
FMLJavaModLoadingContext.get().getModEventBus().register(MRecipes.class); FMLJavaModLoadingContext.get().getModEventBus().register(MRecipes.class);
FMLJavaModLoadingContext.get().getModEventBus().register(LootModifiers.INSTANCE);
MinecraftForge.EVENT_BUS.register(DrivePool.INSTANCE); MinecraftForge.EVENT_BUS.register(DrivePool.INSTANCE);
MinecraftForge.EVENT_BUS.register(PortableCondensationDriveItem.Companion); MinecraftForge.EVENT_BUS.register(PortableCondensationDriveItem.Companion);
FMLJavaModLoadingContext.get().getModEventBus().addListener(AndroidCapability::registerEffects); FMLJavaModLoadingContext.get().getModEventBus().addListener(AndroidCapability::registerEffects);
// force Registry static initializer to be called
Registry.dummy();
} }
private void setup(final FMLCommonSetupEvent event) { private void setup(final FMLCommonSetupEvent event) {

View File

@ -8,8 +8,8 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraftforge.registries.RegistryManager; import net.minecraftforge.registries.RegistryManager;
import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.client.render.SkinElement; import ru.dbotthepony.mc.otm.client.render.SkinElement;
import ru.dbotthepony.mc.otm.registry.MRegistry;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@ -181,7 +181,7 @@ public class AndroidResearchBuilder {
var list = new ArrayList<AndroidResearchType<?>>(); var list = new ArrayList<AndroidResearchType<?>>();
for (var entry : prerequisites) { for (var entry : prerequisites) {
var get = Registry.ANDROID_RESEARCH.getValue(entry); var get = MRegistry.INSTANCE.getANDROID_RESEARCH().getValue(entry);
if (get != null) { if (get != null) {
list.add(get); list.add(get);
@ -193,7 +193,7 @@ public class AndroidResearchBuilder {
resolved_preq = List.copyOf(list); resolved_preq = List.copyOf(list);
for (var entry : feature_results) { for (var entry : feature_results) {
var get = Registry.ANDROID_FEATURES.getValue(entry.id); var get = MRegistry.INSTANCE.getANDROID_FEATURES().getValue(entry.id);
if (get != null) { if (get != null) {
resolved_features.add(new ResolvedFeature(get, entry.level, entry.callback)); resolved_features.add(new ResolvedFeature(get, entry.level, entry.callback));

View File

@ -3,8 +3,8 @@ package ru.dbotthepony.mc.otm.android;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
import net.minecraftforge.registries.ForgeRegistryEntry; import net.minecraftforge.registries.ForgeRegistryEntry;
import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer;
import ru.dbotthepony.mc.otm.registry.MRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -27,7 +27,7 @@ public class AndroidResearchType<T extends AndroidResearch> extends ForgeRegistr
if (blocking == null) { if (blocking == null) {
var list = new ArrayList<AndroidResearchType<?>>(); var list = new ArrayList<AndroidResearchType<?>>();
for (var type : Registry.ANDROID_RESEARCH) { for (var type : MRegistry.INSTANCE.getANDROID_RESEARCH()) {
if (type.getBlockedBy().contains(this)) { if (type.getBlockedBy().contains(this)) {
list.add(type); list.add(type);
} }
@ -46,7 +46,7 @@ public class AndroidResearchType<T extends AndroidResearch> extends ForgeRegistr
if (unlocks == null) { if (unlocks == null) {
var list = new ArrayList<AndroidResearchType<?>>(); var list = new ArrayList<AndroidResearchType<?>>();
for (var type : Registry.ANDROID_RESEARCH) { for (var type : MRegistry.INSTANCE.getANDROID_RESEARCH()) {
if (type.getPrerequisites().contains(this)) { if (type.getPrerequisites().contains(this)) {
list.add(type); list.add(type);
} }

View File

@ -12,7 +12,7 @@ public class AndroidExtendedReach extends AndroidFeature {
public static final UUID MODIFIER_ID = UUID.fromString("4a3fae46-47a8-a03f-857d-f5c2b2c8f2f2"); public static final UUID MODIFIER_ID = UUID.fromString("4a3fae46-47a8-a03f-857d-f5c2b2c8f2f2");
public AndroidExtendedReach(IAndroidCapability capability) { public AndroidExtendedReach(IAndroidCapability capability) {
super(AndroidFeatures.EXTENDED_REACH, capability); super(AndroidFeatures.INSTANCE.getEXTENDED_REACH(), capability);
} }
@Override @Override

View File

@ -12,7 +12,7 @@ public class AndroidLimbOverclocking extends AndroidFeature {
public static final UUID MODIFIER_ID = UUID.fromString("4a3fae46-e57b-4e20-857d-f5c2b2c8f2f2"); public static final UUID MODIFIER_ID = UUID.fromString("4a3fae46-e57b-4e20-857d-f5c2b2c8f2f2");
public AndroidLimbOverclocking(IAndroidCapability capability) { public AndroidLimbOverclocking(IAndroidCapability capability) {
super(AndroidFeatures.LIMB_OVERCLOCKING, capability); super(AndroidFeatures.INSTANCE.getLIMB_OVERCLOCKING(), capability);
} }
@Override @Override

View File

@ -8,10 +8,11 @@ import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.core.ImpreciseFraction; import ru.dbotthepony.mc.otm.core.ImpreciseFraction;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures; import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import ru.dbotthepony.mc.otm.registry.MNames; import ru.dbotthepony.mc.otm.registry.MNames;
import ru.dbotthepony.mc.otm.registry.StatNames;
public class AndroidNanobotsArmor extends AndroidFeature { public class AndroidNanobotsArmor extends AndroidFeature {
public AndroidNanobotsArmor(IAndroidCapability capability) { public AndroidNanobotsArmor(IAndroidCapability capability) {
super(AndroidFeatures.NANOBOTS_ARMOR, capability); super(AndroidFeatures.INSTANCE.getNANOBOTS_ARMOR(), capability);
} }
public int getStrength() { public int getStrength() {
@ -81,7 +82,7 @@ public class AndroidNanobotsArmor extends AndroidFeature {
event.setAmount(event.getAmount() - real_absorbed); event.setAmount(event.getAmount() - real_absorbed);
if (capability.getEntity() instanceof ServerPlayer ply) { if (capability.getEntity() instanceof ServerPlayer ply) {
ply.awardStat(MNames.DAMAGE_ABSORBED, Math.round(real_absorbed * 10f)); ply.awardStat(StatNames.INSTANCE.getDAMAGE_ABSORBED(), Math.round(real_absorbed * 10f));
} }
layers--; layers--;

View File

@ -8,10 +8,11 @@ import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.core.ImpreciseFraction; import ru.dbotthepony.mc.otm.core.ImpreciseFraction;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures; import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import ru.dbotthepony.mc.otm.registry.MNames; import ru.dbotthepony.mc.otm.registry.MNames;
import ru.dbotthepony.mc.otm.registry.StatNames;
public class AndroidNanobotsRegeneration extends AndroidFeature { public class AndroidNanobotsRegeneration extends AndroidFeature {
public AndroidNanobotsRegeneration(IAndroidCapability capability) { public AndroidNanobotsRegeneration(IAndroidCapability capability) {
super(AndroidFeatures.NANOBOTS_REGENERATION, capability); super(AndroidFeatures.INSTANCE.getNANOBOTS_REGENERATION(), capability);
} }
protected int ticks_passed = 0; protected int ticks_passed = 0;
@ -45,7 +46,7 @@ public class AndroidNanobotsRegeneration extends AndroidFeature {
ent.heal(heal); ent.heal(heal);
if (capability.getEntity() instanceof ServerPlayer ply) { if (capability.getEntity() instanceof ServerPlayer ply) {
ply.awardStat(MNames.HEALTH_REGENERATED, Math.round(heal * 10f)); ply.awardStat(StatNames.INSTANCE.getHEALTH_REGENERATED(), Math.round(heal * 10f));
} }
ticks_passed = 0; ticks_passed = 0;

View File

@ -16,7 +16,7 @@ public class EventHandler {
if (!(_cap instanceof AndroidCapabilityPlayer cap)) if (!(_cap instanceof AndroidCapabilityPlayer cap))
return; return;
if (cap.hasFeature(AndroidFeatures.AIR_BAGS)) if (cap.hasFeature(AndroidFeatures.INSTANCE.getAIR_BAGS()))
return; return;
if (ply.getAbilities().mayfly) { if (ply.getAbilities().mayfly) {

View File

@ -5,10 +5,11 @@ import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*; import net.minecraft.client.model.geom.builders.*;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.registry.MNames; import ru.dbotthepony.mc.otm.registry.MNames;
public class GravitationStabilizerModel { public class GravitationStabilizerModel {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(MNames.PORTABLE_GRAVITATION_STABILIZER, "main"); public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(OverdriveThatMatters.loc(MNames.PORTABLE_GRAVITATION_STABILIZER), "main");
private static HumanoidModel<?> model; private static HumanoidModel<?> model;
private static LayerDefinition def; private static LayerDefinition def;

View File

@ -5,11 +5,11 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer;
import ru.dbotthepony.mc.otm.android.AndroidFeature; import ru.dbotthepony.mc.otm.android.AndroidFeature;
import ru.dbotthepony.mc.otm.android.AndroidFeatureType; import ru.dbotthepony.mc.otm.android.AndroidFeatureType;
import ru.dbotthepony.mc.otm.registry.MRegistry;
import java.util.Objects; import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -26,7 +26,7 @@ public record AndroidFeaturePacket(boolean is_added, AndroidFeatureType<?> featu
public void write(FriendlyByteBuf buffer) { public void write(FriendlyByteBuf buffer) {
buffer.writeBoolean(is_added); buffer.writeBoolean(is_added);
buffer.writeInt(Registry.ANDROID_FEATURES.getID(feature)); buffer.writeInt(MRegistry.INSTANCE.getANDROID_FEATURES().getID(feature));
} }
public void play(Supplier<NetworkEvent.Context> context) { public void play(Supplier<NetworkEvent.Context> context) {
@ -50,7 +50,7 @@ public record AndroidFeaturePacket(boolean is_added, AndroidFeatureType<?> featu
public static AndroidFeaturePacket read(FriendlyByteBuf buffer) { public static AndroidFeaturePacket read(FriendlyByteBuf buffer) {
var is_added = buffer.readBoolean(); var is_added = buffer.readBoolean();
var feature = Objects.requireNonNull(Registry.ANDROID_FEATURES.getValue(buffer.readInt())); var feature = Objects.requireNonNull(MRegistry.INSTANCE.getANDROID_FEATURES().getValue(buffer.readInt()));
return new AndroidFeaturePacket(is_added, feature); return new AndroidFeaturePacket(is_added, feature);
} }

View File

@ -6,11 +6,11 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.android.AndroidResearch; import ru.dbotthepony.mc.otm.android.AndroidResearch;
import ru.dbotthepony.mc.otm.android.AndroidResearchType; import ru.dbotthepony.mc.otm.android.AndroidResearchType;
import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.registry.MRegistry;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -20,12 +20,12 @@ public record AndroidResearchPacket(AndroidResearchType<?> type, CompoundTag pay
} }
public void write(FriendlyByteBuf buffer) { public void write(FriendlyByteBuf buffer) {
buffer.writeInt(Registry.ANDROID_RESEARCH.getID(type)); buffer.writeInt(MRegistry.INSTANCE.getANDROID_RESEARCH().getID(type));
buffer.writeNbt(payload); buffer.writeNbt(payload);
} }
public static AndroidResearchPacket read(FriendlyByteBuf buffer) { public static AndroidResearchPacket read(FriendlyByteBuf buffer) {
return new AndroidResearchPacket(Registry.ANDROID_RESEARCH.getValue(buffer.readInt()), buffer.readNbt()); return new AndroidResearchPacket(MRegistry.INSTANCE.getANDROID_RESEARCH().getValue(buffer.readInt()), buffer.readNbt());
} }
public void play(Supplier<NetworkEvent.Context> context) { public void play(Supplier<NetworkEvent.Context> context) {

View File

@ -3,12 +3,12 @@ package ru.dbotthepony.mc.otm.network.android;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.android.AndroidResearch; import ru.dbotthepony.mc.otm.android.AndroidResearch;
import ru.dbotthepony.mc.otm.android.AndroidResearchType; import ru.dbotthepony.mc.otm.android.AndroidResearchType;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer;
import ru.dbotthepony.mc.otm.menu.AndroidStationMenu; import ru.dbotthepony.mc.otm.menu.AndroidStationMenu;
import ru.dbotthepony.mc.otm.registry.MRegistry;
import java.util.Objects; import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -23,7 +23,7 @@ public record AndroidResearchRequestPacket(AndroidResearchType<?> research) {
} }
public void write(FriendlyByteBuf buffer) { public void write(FriendlyByteBuf buffer) {
buffer.writeInt(Registry.ANDROID_RESEARCH.getID(research)); buffer.writeInt(MRegistry.INSTANCE.getANDROID_RESEARCH().getID(research));
} }
public void play(Supplier<NetworkEvent.Context> context) { public void play(Supplier<NetworkEvent.Context> context) {
@ -40,6 +40,6 @@ public record AndroidResearchRequestPacket(AndroidResearchType<?> research) {
} }
public static AndroidResearchRequestPacket read(FriendlyByteBuf buffer) { public static AndroidResearchRequestPacket read(FriendlyByteBuf buffer) {
return new AndroidResearchRequestPacket(Objects.requireNonNull(Registry.ANDROID_RESEARCH.getValue(buffer.readInt()))); return new AndroidResearchRequestPacket(Objects.requireNonNull(MRegistry.INSTANCE.getANDROID_RESEARCH().getValue(buffer.readInt())));
} }
} }

View File

@ -1,36 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import ru.dbotthepony.mc.otm.android.AndroidFeature;
import ru.dbotthepony.mc.otm.android.AndroidFeatureType;
import ru.dbotthepony.mc.otm.android.feature.AndroidExtendedReach;
import ru.dbotthepony.mc.otm.android.feature.AndroidLimbOverclocking;
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor;
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsRegeneration;
public class AndroidFeatures {
public static final AndroidFeatureType<AndroidFeature> AIR_BAGS = new AndroidFeatureType<>(AndroidFeature::new);
public static final AndroidFeatureType<AndroidLimbOverclocking> LIMB_OVERCLOCKING = new AndroidFeatureType<>(AndroidLimbOverclocking::new);
public static final AndroidFeatureType<AndroidNanobotsRegeneration> NANOBOTS_REGENERATION = new AndroidFeatureType<>(AndroidNanobotsRegeneration::new);
public static final AndroidFeatureType<AndroidNanobotsArmor> NANOBOTS_ARMOR = new AndroidFeatureType<>(AndroidNanobotsArmor::new);
public static final AndroidFeatureType<AndroidExtendedReach> EXTENDED_REACH = new AndroidFeatureType<>(AndroidExtendedReach::new);
static {
AIR_BAGS.setRegistryName(MNames.AIR_BAGS);
LIMB_OVERCLOCKING.setRegistryName(MNames.LIMB_OVERCLOCKING);
NANOBOTS_REGENERATION.setRegistryName(MNames.NANOBOTS_REGENERATION);
NANOBOTS_ARMOR.setRegistryName(MNames.NANOBOTS_ARMOR);
EXTENDED_REACH.setRegistryName(MNames.EXTENDED_REACH);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<AndroidFeatureType<?>> event) {
event.getRegistry().register(AIR_BAGS);
event.getRegistry().register(LIMB_OVERCLOCKING);
event.getRegistry().register(NANOBOTS_REGENERATION);
event.getRegistry().register(NANOBOTS_ARMOR);
event.getRegistry().register(EXTENDED_REACH);
}
}

View File

@ -1,247 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.android.AndroidResearchBuilder;
import ru.dbotthepony.mc.otm.android.AndroidResearchType;
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor;
import ru.dbotthepony.mc.otm.client.render.SkinElement;
public class AndroidResearch {
public static final ResourceLocation ICONS = new ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png");
public static final SkinElement ICON_TRANSFER;
public static final SkinElement ICON_ATTACK_BOOST;
public static final SkinElement ICON_PLASMA_SHIELD_BOOST;
public static final SkinElement ICON_CLOAK;
public static final SkinElement ICON_GRAVITATIONAL_STABILIZER;
public static final SkinElement ICON_AIR_BAGS;
public static final SkinElement ICON_JUMP_BOOST;
public static final SkinElement ICON_FEATHER_FALLING;
public static final SkinElement ICON_ARC;
public static final SkinElement ICON_ARROW;
public static final SkinElement ICON_ARMOR;
public static final SkinElement ICON_NANOBOTS;
public static final SkinElement ICON_NIGHT_VISION;
public static final SkinElement ICON_OXYGEN_SUPPLY;
public static final SkinElement ICON_PLASMA_SHIELD;
public static final SkinElement ICON_SHOCKWAVE;
public static final SkinElement ICON_LIMB_OVERCLOCKING;
public static final SkinElement ICON_STEP_ASSIST;
public static final SkinElement ICON_ENDER_TELEPORT;
public static final SkinElement ICON_WIRELESS_CHARGING;
public static final SkinElement ICON_UNKNOWN;
public static final SkinElement ICON_EXTENDED_REACH;
static {
int x = 0;
int y = 0;
ICON_TRANSFER = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_ATTACK_BOOST = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_PLASMA_SHIELD_BOOST = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_CLOAK = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_GRAVITATIONAL_STABILIZER = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_AIR_BAGS = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_JUMP_BOOST = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
y += 18;
x = 0;
ICON_FEATHER_FALLING = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_ARC = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_ARROW = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_ARMOR = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_NANOBOTS = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_NIGHT_VISION = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_OXYGEN_SUPPLY = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
y += 18;
x = 0;
ICON_PLASMA_SHIELD = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_SHOCKWAVE = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_LIMB_OVERCLOCKING = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_STEP_ASSIST = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_ENDER_TELEPORT = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_WIRELESS_CHARGING = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
ICON_UNKNOWN = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
y += 18;
x = 0;
ICON_EXTENDED_REACH = new SkinElement(ICONS, x, y, 18, 18, 126, 126);
x += 18;
}
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch> AIR_BAGS =
new AndroidResearchBuilder()
.setExperienceCost(18)
.addFeatureResult(AndroidFeatures.AIR_BAGS)
.withDescription()
.withIcon(ICON_AIR_BAGS)
.build();
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch> EXTENDED_REACH =
new AndroidResearchBuilder()
.setExperienceCost(40)
.addFeatureResult(AndroidFeatures.EXTENDED_REACH)
.withDescription()
.withIcon(ICON_EXTENDED_REACH)
.build();
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] LIMB_OVERCLOCKING = new AndroidResearchType[4];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] NANOBOTS_REGENERATION = new AndroidResearchType[4];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] NANOBOTS_ARMOR_STRENGTH = new AndroidResearchType[3];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] NANOBOTS_ARMOR_SPEED = new AndroidResearchType[3];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch> NANOBOTS =
new AndroidResearchBuilder()
.setExperienceCost(15)
.withDescription()
.withIcon(ICON_NANOBOTS)
.build();
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch> NANOBOTS_ARMOR =
new AndroidResearchBuilder()
.setExperienceCost(25)
.withDescription()
.addPrerequisite(MNames.NANOBOTS)
.addFeatureResult(MNames.NANOBOTS_ARMOR)
.withIcon(ICON_ARMOR)
.build();
static {
AIR_BAGS.setRegistryName(MNames.AIR_BAGS);
NANOBOTS.setRegistryName(MNames.NANOBOTS);
NANOBOTS_ARMOR.setRegistryName(MNames.NANOBOTS_ARMOR);
EXTENDED_REACH.setRegistryName(MNames.EXTENDED_REACH);
for (int i = 0; i < 4; i++) {
var limbs = new AndroidResearchBuilder()
.setExperienceCost(18 + i * 8)
.withIconText(new TextComponent(String.valueOf(i + 1)))
.withIcon(ICON_LIMB_OVERCLOCKING)
.withName(new TranslatableComponent("android_research.overdrive_that_matters.limb_overclocking", i + 1))
.withDescription(new TranslatableComponent("android_research.overdrive_that_matters.limb_overclocking.description", (i + 1) * 8, (i + 1) * 6))
.addFeatureResult(MNames.LIMB_OVERCLOCKING, i);
var regeneration = new AndroidResearchBuilder()
.setExperienceCost(20 + i * 6)
.withIconText(new TextComponent(String.valueOf(i + 1)))
.withIcon(ICON_NANOBOTS)
.withName(new TranslatableComponent("android_research.overdrive_that_matters.nanobots_regeneration", i + 1))
.withDescription(
i > 0 ? new TranslatableComponent("android_research.overdrive_that_matters.nanobots_regeneration.description_improve") : new TranslatableComponent("android_research.overdrive_that_matters.nanobots_regeneration.description"))
.addFeatureResult(MNames.NANOBOTS_REGENERATION, i);
if (i > 0) {
limbs.addPrerequisite(MNames.LIMB_OVERCLOCKING_LIST[i - 1]);
regeneration.addPrerequisite(MNames.NANOBOTS_REGENERATION_LIST[i - 1]);
} else {
regeneration.addPrerequisite(MNames.NANOBOTS);
}
LIMB_OVERCLOCKING[i] = limbs.build();
NANOBOTS_REGENERATION[i] = regeneration.build();
}
for (int i = 0; i < 3; i++) {
final int level = i + 1;
NANOBOTS_ARMOR_STRENGTH[i] = new AndroidResearchBuilder()
.setExperienceCost(20 + i * 8)
.withIconText(new TextComponent(String.valueOf(i + 1)))
.withIcon(ICON_ARMOR)
.addPrerequisite(i > 0 ? MNames.NANOBOTS_ARMOR_STRENGTH_LIST[i - 1] : MNames.NANOBOTS_ARMOR)
.withName(new TranslatableComponent("android_research.overdrive_that_matters.nanobots_armor_strength", i + 1))
.withDescription(new TranslatableComponent("android_research.overdrive_that_matters.nanobots_armor_strength.description", (i + 1) * 8, (i + 1) * 6))
.addFeatureResult(MNames.NANOBOTS_ARMOR, 0, (feature) -> {
if (((AndroidNanobotsArmor) feature).getStrength() < level)
((AndroidNanobotsArmor) feature).setStrength(level);
})
.build();
NANOBOTS_ARMOR_SPEED[i] = new AndroidResearchBuilder()
.setExperienceCost(20 + i * 8)
.withIconText(new TextComponent(String.valueOf(i + 1)))
.withIcon(ICON_ARMOR)
.addPrerequisite(i > 0 ? MNames.NANOBOTS_ARMOR_SPEED_LIST[i - 1] : MNames.NANOBOTS_ARMOR)
.withName(new TranslatableComponent("android_research.overdrive_that_matters.nanobots_armor_speed", i + 1))
.withDescription(new TranslatableComponent("android_research.overdrive_that_matters.nanobots_armor_speed.description", (i + 1) * 8, (i + 1) * 6))
.addFeatureResult(MNames.NANOBOTS_ARMOR, 0, (feature) -> {
if (((AndroidNanobotsArmor) feature).getSpeed() < level)
((AndroidNanobotsArmor) feature).setSpeed(level);
})
.build();
}
LIMB_OVERCLOCKING[0].setRegistryName(MNames.LIMB_OVERCLOCKING_1);
LIMB_OVERCLOCKING[1].setRegistryName(MNames.LIMB_OVERCLOCKING_2);
LIMB_OVERCLOCKING[2].setRegistryName(MNames.LIMB_OVERCLOCKING_3);
LIMB_OVERCLOCKING[3].setRegistryName(MNames.LIMB_OVERCLOCKING_4);
NANOBOTS_ARMOR_SPEED[0].setRegistryName(MNames.NANOBOTS_ARMOR_SPEED_1);
NANOBOTS_ARMOR_SPEED[1].setRegistryName(MNames.NANOBOTS_ARMOR_SPEED_2);
NANOBOTS_ARMOR_SPEED[2].setRegistryName(MNames.NANOBOTS_ARMOR_SPEED_3);
NANOBOTS_ARMOR_STRENGTH[0].setRegistryName(MNames.NANOBOTS_ARMOR_STRENGTH_1);
NANOBOTS_ARMOR_STRENGTH[1].setRegistryName(MNames.NANOBOTS_ARMOR_STRENGTH_2);
NANOBOTS_ARMOR_STRENGTH[2].setRegistryName(MNames.NANOBOTS_ARMOR_STRENGTH_3);
NANOBOTS_REGENERATION[0].setRegistryName(MNames.NANOBOTS_REGENERATION_1);
NANOBOTS_REGENERATION[1].setRegistryName(MNames.NANOBOTS_REGENERATION_2);
NANOBOTS_REGENERATION[2].setRegistryName(MNames.NANOBOTS_REGENERATION_3);
NANOBOTS_REGENERATION[3].setRegistryName(MNames.NANOBOTS_REGENERATION_4);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<AndroidResearchType<?>> event) {
event.getRegistry().register(AIR_BAGS);
event.getRegistry().register(NANOBOTS);
event.getRegistry().register(NANOBOTS_ARMOR);
event.getRegistry().register(EXTENDED_REACH);
event.getRegistry().register(LIMB_OVERCLOCKING[0]);
event.getRegistry().register(LIMB_OVERCLOCKING[1]);
event.getRegistry().register(LIMB_OVERCLOCKING[2]);
event.getRegistry().register(LIMB_OVERCLOCKING[3]);
event.getRegistry().register(NANOBOTS_ARMOR_SPEED[0]);
event.getRegistry().register(NANOBOTS_ARMOR_SPEED[1]);
event.getRegistry().register(NANOBOTS_ARMOR_SPEED[2]);
event.getRegistry().register(NANOBOTS_ARMOR_STRENGTH[0]);
event.getRegistry().register(NANOBOTS_ARMOR_STRENGTH[1]);
event.getRegistry().register(NANOBOTS_ARMOR_STRENGTH[2]);
event.getRegistry().register(NANOBOTS_REGENERATION[0]);
event.getRegistry().register(NANOBOTS_REGENERATION[1]);
event.getRegistry().register(NANOBOTS_REGENERATION[2]);
event.getRegistry().register(NANOBOTS_REGENERATION[3]);
}
}

View File

@ -1,105 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import ru.dbotthepony.mc.otm.block.entity.*;
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity;
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger;
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger;
import ru.dbotthepony.mc.otm.client.render.BlackHoleRenderer;
import ru.dbotthepony.mc.otm.client.render.EnergyCounterRenderer;
import ru.dbotthepony.mc.otm.client.render.GravitationStabilizerRenderer;
public class MBlockEntities {
public static final BlockEntityType<AndroidStationBlockEntity> ANDROID_STATION = BlockEntityType.Builder.of(AndroidStationBlockEntity::new, MBlocks.ANDROID_STATION).build(null);
public static final BlockEntityType<BatteryBankBlockEntity> BATTERY_BANK = BlockEntityType.Builder.of(BatteryBankBlockEntity::new, MBlocks.BATTERY_BANK).build(null);
public static final BlockEntityType<MatterDecomposerBlockEntity> MATTER_DECOMPOSER = BlockEntityType.Builder.of(MatterDecomposerBlockEntity::new, MBlocks.MATTER_DECOMPOSER).build(null);
public static final BlockEntityType<MatterCapacitorBankBlockEntity> MATTER_CAPACITOR_BANK = BlockEntityType.Builder.of(MatterCapacitorBankBlockEntity::new, MBlocks.MATTER_CAPACITOR_BANK).build(null);
public static final BlockEntityType<MatterCableBlockEntity> MATTER_CABLE = BlockEntityType.Builder.of(MatterCableBlockEntity::new, MBlocks.MATTER_CABLE).build(null);
public static final BlockEntityType<PatternStorageBlockEntity> PATTERN_STORAGE = BlockEntityType.Builder.of(PatternStorageBlockEntity::new, MBlocks.PATTERN_STORAGE).build(null);
public static final BlockEntityType<MatterScannerBlockEntity> MATTER_SCANNER = BlockEntityType.Builder.of(MatterScannerBlockEntity::new, MBlocks.MATTER_SCANNER).build(null);
public static final BlockEntityType<MatterPanelBlockEntity> MATTER_PANEL = BlockEntityType.Builder.of(MatterPanelBlockEntity::new, MBlocks.MATTER_PANEL).build(null);
public static final BlockEntityType<MatterReplicatorBlockEntity> MATTER_REPLICATOR = BlockEntityType.Builder.of(MatterReplicatorBlockEntity::new, MBlocks.MATTER_REPLICATOR).build(null);
public static final BlockEntityType<MatterBottlerBlockEntity> MATTER_BOTTLER = BlockEntityType.Builder.of(MatterBottlerBlockEntity::new, MBlocks.MATTER_BOTTLER).build(null);
public static final BlockEntityType<DriveViewerBlockEntity> DRIVE_VIEWER = BlockEntityType.Builder.of(DriveViewerBlockEntity::new, MBlocks.DRIVE_VIEWER).build(null);
public static final BlockEntityType<BlackHoleBlockEntity> BLACK_HOLE = BlockEntityType.Builder.of(BlackHoleBlockEntity::new, MBlocks.BLACK_HOLE).build(null);
public static final BlockEntityType<CargoCrateBlockEntity> CARGO_CRATE = BlockEntityType.Builder.of(CargoCrateBlockEntity::new, MBlocks.CARGO_CRATE).build(null);
public static final BlockEntityType<DriveRackBlockEntity> DRIVE_RACK = BlockEntityType.Builder.of(DriveRackBlockEntity::new, MBlocks.DRIVE_RACK).build(null);
public static final BlockEntityType<ItemMonitorBlockEntity> ITEM_MONITOR = BlockEntityType.Builder.of(ItemMonitorBlockEntity::new, MBlocks.ITEM_MONITOR).build(null);
public static final BlockEntityType<BlockEntityEnergyCounter> ENERGY_COUNTER = BlockEntityType.Builder.of(BlockEntityEnergyCounter::new, MBlocks.ENERGY_COUNTER).build(null);
public static final BlockEntityType<ChemicalGeneratorBlockEntity> CHEMICAL_GENERATOR = BlockEntityType.Builder.of(ChemicalGeneratorBlockEntity::new, MBlocks.CHEMICAL_GENERATOR).build(null);
public static final BlockEntityType<PlatePressBlockEntity> PLATE_PRESS = BlockEntityType.Builder.of(PlatePressBlockEntity::new, MBlocks.PLATE_PRESS).build(null);
public static final BlockEntityType<GravitationStabilizerBlockEntity> GRAVITATION_STABILIZER = BlockEntityType.Builder.of(GravitationStabilizerBlockEntity::new, MBlocks.GRAVITATION_STABILIZER).build(null);
public static final BlockEntityType<MatterRecyclerBlockEntity> MATTER_RECYCLER = BlockEntityType.Builder.of(MatterRecyclerBlockEntity::new, MBlocks.MATTER_RECYCLER).build(null);
public static final BlockEntityType<BlockEntityExplosionDebugger> DEBUG_EXPLOSION_SMALL = BlockEntityType.Builder.of(BlockEntityExplosionDebugger::new, MBlocks.DEBUG_EXPLOSION_SMALL).build(null);
public static final BlockEntityType<BlockEntitySphereDebugger> DEBUG_SPHERE_POINTS = BlockEntityType.Builder.of(BlockEntitySphereDebugger::new, MBlocks.DEBUG_SPHERE_POINTS).build(null);
static {
ANDROID_STATION.setRegistryName(MNames.ANDROID_STATION);
BATTERY_BANK.setRegistryName(MNames.BATTERY_BANK);
MATTER_DECOMPOSER.setRegistryName(MNames.MATTER_DECOMPOSER);
MATTER_CAPACITOR_BANK.setRegistryName(MNames.MATTER_CAPACITOR_BANK);
MATTER_CABLE.setRegistryName(MNames.MATTER_CABLE);
PATTERN_STORAGE.setRegistryName(MNames.PATTERN_STORAGE);
MATTER_SCANNER.setRegistryName(MNames.MATTER_SCANNER);
MATTER_PANEL.setRegistryName(MNames.MATTER_PANEL);
MATTER_REPLICATOR.setRegistryName(MNames.MATTER_REPLICATOR);
MATTER_BOTTLER.setRegistryName(MNames.MATTER_BOTTLER);
DRIVE_VIEWER.setRegistryName(MNames.DRIVE_VIEWER);
BLACK_HOLE.setRegistryName(MNames.BLACK_HOLE);
CARGO_CRATE.setRegistryName(MNames.CARGO_CRATE);
DRIVE_RACK.setRegistryName(MNames.DRIVE_RACK);
ITEM_MONITOR.setRegistryName(MNames.ITEM_MONITOR);
ENERGY_COUNTER.setRegistryName(MNames.ENERGY_COUNTER);
CHEMICAL_GENERATOR.setRegistryName(MNames.CHEMICAL_GENERATOR);
PLATE_PRESS.setRegistryName(MNames.PLATE_PRESS);
GRAVITATION_STABILIZER.setRegistryName(MNames.GRAVITATION_STABILIZER);
MATTER_RECYCLER.setRegistryName(MNames.MATTER_RECYCLER);
DEBUG_EXPLOSION_SMALL.setRegistryName(MNames.DEBUG_EXPLOSION_SMALL);
DEBUG_SPHERE_POINTS.setRegistryName(MNames.DEBUG_SPHERE_POINTS);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<BlockEntityType<?>> event) {
event.getRegistry().register(ANDROID_STATION);
event.getRegistry().register(BATTERY_BANK);
event.getRegistry().register(MATTER_DECOMPOSER);
event.getRegistry().register(MATTER_CAPACITOR_BANK);
event.getRegistry().register(MATTER_CABLE);
event.getRegistry().register(PATTERN_STORAGE);
event.getRegistry().register(MATTER_SCANNER);
event.getRegistry().register(MATTER_PANEL);
event.getRegistry().register(MATTER_REPLICATOR);
event.getRegistry().register(MATTER_BOTTLER);
event.getRegistry().register(DRIVE_VIEWER);
event.getRegistry().register(BLACK_HOLE);
event.getRegistry().register(CARGO_CRATE);
event.getRegistry().register(DRIVE_RACK);
event.getRegistry().register(ITEM_MONITOR);
event.getRegistry().register(ENERGY_COUNTER);
event.getRegistry().register(CHEMICAL_GENERATOR);
event.getRegistry().register(PLATE_PRESS);
event.getRegistry().register(GRAVITATION_STABILIZER);
event.getRegistry().register(MATTER_RECYCLER);
event.getRegistry().register(DEBUG_EXPLOSION_SMALL);
event.getRegistry().register(DEBUG_SPHERE_POINTS);
// OverdriveThatMatters.LOGGER.info("Registered block entities");
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void registerRenderers(final FMLClientSetupEvent event) {
BlockEntityRenderers.register(BLACK_HOLE, BlackHoleRenderer::new);
BlockEntityRenderers.register(GRAVITATION_STABILIZER, GravitationStabilizerRenderer::new);
BlockEntityRenderers.register(ENERGY_COUNTER, EnergyCounterRenderer::new);
}
}

View File

@ -1,190 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.OreBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import ru.dbotthepony.mc.otm.block.*;
public class MBlocks {
public static final AndroidStationBlock ANDROID_STATION = new AndroidStationBlock();
public static final BatteryBankBlock BATTERY_BANK = new BatteryBankBlock();
public static final MatterDecomposerBlock MATTER_DECOMPOSER = new MatterDecomposerBlock();
public static final MatterCapacitorBankBlock MATTER_CAPACITOR_BANK = new MatterCapacitorBankBlock();
public static final BlockMatterCable MATTER_CABLE = new BlockMatterCable();
public static final PatternStorageBlock PATTERN_STORAGE = new PatternStorageBlock();
public static final MatterScannerBlock MATTER_SCANNER = new MatterScannerBlock();
public static final MatterPanelBlock MATTER_PANEL = new MatterPanelBlock();
public static final MatterReplicatorBlock MATTER_REPLICATOR = new MatterReplicatorBlock();
public static final MatterBottlerBlock MATTER_BOTTLER = new MatterBottlerBlock();
public static final DriveViewerBlock DRIVE_VIEWER = new DriveViewerBlock();
public static final CargoCrateBlock CARGO_CRATE = new CargoCrateBlock();
public static final DriveRackBlock DRIVE_RACK = new DriveRackBlock();
public static final ItemMonitorBlock ITEM_MONITOR = new ItemMonitorBlock();
public static final EnergyCounterBlock ENERGY_COUNTER = new EnergyCounterBlock();
public static final ChemicalGeneratorBlock CHEMICAL_GENERATOR = new ChemicalGeneratorBlock();
public static final PlatePressBlock PLATE_PRESS = new PlatePressBlock();
public static final MatterRecyclerBlock MATTER_RECYCLER = new MatterRecyclerBlock();
public static final BlockExplosionDebugger DEBUG_EXPLOSION_SMALL = new BlockExplosionDebugger();
public static final BlockSphereDebugger DEBUG_SPHERE_POINTS = new BlockSphereDebugger();
public static final BlackHoleBlock BLACK_HOLE = new BlackHoleBlock();
public static final BlockGravitationStabilizer GRAVITATION_STABILIZER = new BlockGravitationStabilizer();
public static final BlockGravitationStabilizerLens GRAVITATION_STABILIZER_LENS = new BlockGravitationStabilizerLens();
public static final Block TRITANIUM_ORE = new OreBlock(
BlockBehaviour.Properties.of(Material.STONE)
.strength(3.25F, 6.0F)
.requiresCorrectToolForDrops(),
UniformInt.of(0, 3)
);
public static final Block DEEPSLATE_TRITANIUM_ORE = new OreBlock(
BlockBehaviour.Properties.of(Material.STONE)
.strength(4.75F, 6.5F)
.requiresCorrectToolForDrops(),
UniformInt.of(0, 3)
);
public static final Block TRITANIUM_RAW_BLOCK = new Block(
BlockBehaviour.Properties.of(Material.STONE)
.strength(8.0F, 10F)
.requiresCorrectToolForDrops()
);
public static final Block[] CRATES = new Block[Registry.CRATES.length];
public static final Block TRITANIUM_BLOCK = new Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80)
.strength(4)
);
public static final Block TRITANIUM_STRIPED_BLOCK = new Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80)
.strength(4)
);
public static final Block CARBON_FIBRE_BLOCK = new Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(40)
.strength(3)
);
static {
for (int i = 0; i < Registry.CRATES.length; i++) {
CRATES[i] = new Block(BlockBehaviour.Properties.of(Material.METAL, Registry.CRATES[i].color())
.sound(SoundType.METAL)
.requiresCorrectToolForDrops()
.strength(5.0F, 6.0F));
CRATES[i].setRegistryName(Registry.CRATES[i].name());
}
TRITANIUM_ORE.setRegistryName(MNames.TRITANIUM_ORE);
DEEPSLATE_TRITANIUM_ORE.setRegistryName(MNames.DEEPSLATE_TRITANIUM_ORE);
TRITANIUM_RAW_BLOCK.setRegistryName(MNames.TRITANIUM_RAW_BLOCK);
ANDROID_STATION.setRegistryName(MNames.ANDROID_STATION);
BATTERY_BANK.setRegistryName(MNames.BATTERY_BANK);
MATTER_DECOMPOSER.setRegistryName(MNames.MATTER_DECOMPOSER);
MATTER_CAPACITOR_BANK.setRegistryName(MNames.MATTER_CAPACITOR_BANK);
MATTER_CABLE.setRegistryName(MNames.MATTER_CABLE);
PATTERN_STORAGE.setRegistryName(MNames.PATTERN_STORAGE);
MATTER_SCANNER.setRegistryName(MNames.MATTER_SCANNER);
MATTER_PANEL.setRegistryName(MNames.MATTER_PANEL);
MATTER_REPLICATOR.setRegistryName(MNames.MATTER_REPLICATOR);
MATTER_BOTTLER.setRegistryName(MNames.MATTER_BOTTLER);
DRIVE_VIEWER.setRegistryName(MNames.DRIVE_VIEWER);
BLACK_HOLE.setRegistryName(MNames.BLACK_HOLE);
CARGO_CRATE.setRegistryName(MNames.CARGO_CRATE);
DRIVE_RACK.setRegistryName(MNames.DRIVE_RACK);
ITEM_MONITOR.setRegistryName(MNames.ITEM_MONITOR);
ENERGY_COUNTER.setRegistryName(MNames.ENERGY_COUNTER);
CHEMICAL_GENERATOR.setRegistryName(MNames.CHEMICAL_GENERATOR);
PLATE_PRESS.setRegistryName(MNames.PLATE_PRESS);
MATTER_RECYCLER.setRegistryName(MNames.MATTER_RECYCLER);
GRAVITATION_STABILIZER.setRegistryName(MNames.GRAVITATION_STABILIZER);
GRAVITATION_STABILIZER_LENS.setRegistryName(MNames.GRAVITATION_STABILIZER_LENS);
DEBUG_EXPLOSION_SMALL.setRegistryName(MNames.DEBUG_EXPLOSION_SMALL);
DEBUG_SPHERE_POINTS.setRegistryName(MNames.DEBUG_SPHERE_POINTS);
TRITANIUM_BLOCK.setRegistryName(MNames.TRITANIUM_BLOCK);
TRITANIUM_STRIPED_BLOCK.setRegistryName(MNames.TRITANIUM_STRIPED_BLOCK);
CARBON_FIBRE_BLOCK.setRegistryName(MNames.CARBON_FIBRE_BLOCK);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<Block> event) {
event.getRegistry().register(ANDROID_STATION);
event.getRegistry().register(BATTERY_BANK);
event.getRegistry().register(MATTER_DECOMPOSER);
event.getRegistry().register(MATTER_CAPACITOR_BANK);
event.getRegistry().register(MATTER_CABLE);
event.getRegistry().register(PATTERN_STORAGE);
event.getRegistry().register(MATTER_SCANNER);
event.getRegistry().register(MATTER_PANEL);
event.getRegistry().register(MATTER_REPLICATOR);
event.getRegistry().register(MATTER_BOTTLER);
event.getRegistry().register(DRIVE_VIEWER);
event.getRegistry().register(TRITANIUM_BLOCK);
event.getRegistry().register(TRITANIUM_STRIPED_BLOCK);
event.getRegistry().register(CARBON_FIBRE_BLOCK);
event.getRegistry().register(BLACK_HOLE);
event.getRegistry().register(CARGO_CRATE);
event.getRegistry().register(TRITANIUM_ORE);
event.getRegistry().register(DEEPSLATE_TRITANIUM_ORE);
event.getRegistry().register(TRITANIUM_RAW_BLOCK);
event.getRegistry().register(DRIVE_RACK);
event.getRegistry().register(ITEM_MONITOR);
event.getRegistry().register(ENERGY_COUNTER);
event.getRegistry().register(CHEMICAL_GENERATOR);
event.getRegistry().register(PLATE_PRESS);
event.getRegistry().register(GRAVITATION_STABILIZER);
event.getRegistry().register(GRAVITATION_STABILIZER_LENS);
event.getRegistry().register(MATTER_RECYCLER);
event.getRegistry().register(DEBUG_EXPLOSION_SMALL);
event.getRegistry().register(DEBUG_SPHERE_POINTS);
for (var crate : CRATES) {
event.getRegistry().register(crate);
}
for (var glass : Registry.INDUSTRIAL_GLASS_LIST) {
event.getRegistry().register(glass.block());
event.getRegistry().register(glass.pane());
}
// OverdriveThatMatters.LOGGER.info("Registered blocks");
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void registerClient(final FMLClientSetupEvent event) {
final var translucent = RenderType.translucent();
for (var glass : Registry.INDUSTRIAL_GLASS_LIST) {
ItemBlockRenderTypes.setRenderLayer(glass.block(), translucent);
ItemBlockRenderTypes.setRenderLayer(glass.pane(), translucent);
}
}
}

View File

@ -1,413 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.ForgeTier;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.jetbrains.annotations.Nullable;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.core.ImpreciseFraction;
import ru.dbotthepony.mc.otm.item.*;
import javax.annotation.Nonnull;
import java.util.ConcurrentModificationException;
import java.util.List;
public class MItems {
static {
if (OverdriveThatMatters.INSTANCE == null) {
throw new ConcurrentModificationException("Accessing Registry before OverdriveThatMatters class is initialized. This is not supported! If no other mods are installed this is a bug.");
}
}
private static final Item.Properties DEFAULT_PROPERTIES = new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB);
public static final BlockItem ANDROID_STATION = new BlockItem(MBlocks.ANDROID_STATION, DEFAULT_PROPERTIES);
public static final BlockItem BATTERY_BANK = new BlockItem(MBlocks.BATTERY_BANK, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_DECOMPOSER = new BlockItem(MBlocks.MATTER_DECOMPOSER, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_CAPACITOR_BANK = new BlockItem(MBlocks.MATTER_CAPACITOR_BANK, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_CABLE = new BlockItem(MBlocks.MATTER_CABLE, DEFAULT_PROPERTIES);
public static final BlockItem PATTERN_STORAGE = new BlockItem(MBlocks.PATTERN_STORAGE, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_SCANNER = new BlockItem(MBlocks.MATTER_SCANNER, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_PANEL = new BlockItem(MBlocks.MATTER_PANEL, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_REPLICATOR = new BlockItem(MBlocks.MATTER_REPLICATOR, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_BOTTLER = new BlockItem(MBlocks.MATTER_BOTTLER, DEFAULT_PROPERTIES);
public static final BlockItem DRIVE_VIEWER = new BlockItem(MBlocks.DRIVE_VIEWER, DEFAULT_PROPERTIES);
public static final BlockItem CARGO_CRATE = new BlockItem(MBlocks.CARGO_CRATE, DEFAULT_PROPERTIES);
public static final BlockItem TRITANIUM_ORE = new BlockItem(MBlocks.TRITANIUM_ORE, DEFAULT_PROPERTIES);
public static final BlockItem DEEPSLATE_TRITANIUM_ORE = new BlockItem(MBlocks.DEEPSLATE_TRITANIUM_ORE, DEFAULT_PROPERTIES);
public static final BlockItem TRITANIUM_RAW_BLOCK = new BlockItem(MBlocks.TRITANIUM_RAW_BLOCK, DEFAULT_PROPERTIES);
public static final BlockItem DRIVE_RACK = new BlockItem(MBlocks.DRIVE_RACK, DEFAULT_PROPERTIES);
public static final BlockItem ITEM_MONITOR = new BlockItem(MBlocks.ITEM_MONITOR, DEFAULT_PROPERTIES);
public static final BlockItem ENERGY_COUNTER = new BlockItem(MBlocks.ENERGY_COUNTER, DEFAULT_PROPERTIES);
public static final BlockItem CHEMICAL_GENERATOR = new BlockItem(MBlocks.CHEMICAL_GENERATOR, DEFAULT_PROPERTIES);
public static final BlockItem PLATE_PRESS = new BlockItem(MBlocks.PLATE_PRESS, DEFAULT_PROPERTIES);
public static final BlockItem MATTER_RECYCLER = new BlockItem(MBlocks.MATTER_RECYCLER, DEFAULT_PROPERTIES);
public static final BlockItem GRAVITATION_STABILIZER = new BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) {
@Override
public void appendHoverText(@Nonnull ItemStack p_40572_, @Nullable Level p_40573_, @Nonnull List<Component> p_40574_, @Nonnull TooltipFlag p_40575_) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_);
p_40574_.add(new TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc").withStyle(ChatFormatting.GRAY));
p_40574_.add(new TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc2").withStyle(ChatFormatting.DARK_GRAY));
p_40574_.add(new TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc3").withStyle(ChatFormatting.DARK_GRAY));
p_40574_.add(new TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc4").withStyle(ChatFormatting.DARK_GRAY));
}
};
public static final BlockItem DEBUG_EXPLOSION_SMALL = new BlockItem(MBlocks.DEBUG_EXPLOSION_SMALL, DEFAULT_PROPERTIES);
public static final BlockItem DEBUG_SPHERE_POINTS = new BlockItem(MBlocks.DEBUG_SPHERE_POINTS, DEFAULT_PROPERTIES);
public static final MatterDustItem MATTER_DUST = new MatterDustItem();
public static final Item TRITANIUM_ORE_CLUMP = new Item(DEFAULT_PROPERTIES);
public static final Item TRITANIUM_INGOT = new Item(DEFAULT_PROPERTIES);
public static final ForgeTier TRITANIUM_COMPONENT;
static {
final var component = Ingredient.of(TRITANIUM_INGOT);
TRITANIUM_COMPONENT = new ForgeTier(
Tiers.IRON.getLevel(),
3072,
Tiers.IRON.getSpeed() * 1.1f,
3.5f,
16,
BlockTags.NEEDS_IRON_TOOL,
() -> component
);
}
private static final Item.Properties TOOLS_PROPRTIES = new Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB);
public static final SwordItem TRITANIUM_SWORD = new SwordItem(TRITANIUM_COMPONENT, 4, -2.7f, TOOLS_PROPRTIES);
public static final ShovelItem TRITANIUM_SHOVEL = new ShovelItem(TRITANIUM_COMPONENT, 1.5f, -2.4f, TOOLS_PROPRTIES);
public static final AxeItem TRITANIUM_AXE = new AxeItem(TRITANIUM_COMPONENT, 8.5f, -3.4f, TOOLS_PROPRTIES);
public static final PickaxeItem TRITANIUM_PICKAXE = new PickaxeItem(TRITANIUM_COMPONENT, 2, -2.8f, TOOLS_PROPRTIES);
public static final HoeItem TRITANIUM_HOE = new HoeItem(TRITANIUM_COMPONENT, 0, -3.4f, TOOLS_PROPRTIES);
public static final Item[] TRITANIUM_TOOLS = new Item[]{
TRITANIUM_SWORD,
TRITANIUM_SHOVEL,
TRITANIUM_AXE,
TRITANIUM_PICKAXE,
TRITANIUM_HOE
};
public static final EnergySwordItem ENERGY_SWORD = new EnergySwordItem();
public static final ItemTritaniumArmor TRITANIUM_HELMET = new ItemTritaniumArmor(EquipmentSlot.HEAD);
public static final ItemTritaniumArmor TRITANIUM_CHESTPLATE = new ItemTritaniumArmor(EquipmentSlot.CHEST);
public static final ItemTritaniumArmor TRITANIUM_PANTS = new ItemTritaniumArmor(EquipmentSlot.LEGS);
public static final ItemTritaniumArmor TRITANIUM_BOOTS = new ItemTritaniumArmor(EquipmentSlot.FEET);
public static final Item[] TRITANIUM_ARMOR = new Item[]{
TRITANIUM_HELMET,
TRITANIUM_CHESTPLATE,
TRITANIUM_PANTS,
TRITANIUM_BOOTS
};
public static final Item MATTER_IO_PORT = new Item(DEFAULT_PROPERTIES);
public static final Item MATTER_TRANSFORM_MATRIX = new Item(DEFAULT_PROPERTIES);
public static final Item ENERGY_BUS = new Item(DEFAULT_PROPERTIES);
public static final Item ELECTRIC_PARTS = new Item(DEFAULT_PROPERTIES);
public static final Item MACHINE_FRAME = new Item(DEFAULT_PROPERTIES);
public static final Item TRITANIUM_PLATE = new Item(DEFAULT_PROPERTIES);
public static final Item IRON_PLATE = new Item(DEFAULT_PROPERTIES);
public static final Item COPPER_WIRING = new Item(DEFAULT_PROPERTIES);
public static final Item GOLD_WIRING = new Item(DEFAULT_PROPERTIES);
public static final Item PORTABLE_CONDENSATION_DRIVE_CASING = new Item(DEFAULT_PROPERTIES);
public static final Item PORTABLE_DENSE_CONDENSATION_DRIVE_CASING = new Item(DEFAULT_PROPERTIES);
public static final Item CIRCUIT_PLATING = new Item(DEFAULT_PROPERTIES);
public static final Item BASIC_CONTROL_CIRCUIT = new Item(DEFAULT_PROPERTIES);
public static final Item ADVANCED_CONTROL_CIRCUIT = new Item(DEFAULT_PROPERTIES);
public static final Item BLACK_HOLE_SCANNER = new Item(DEFAULT_PROPERTIES) {
@Override
public void appendHoverText(@Nonnull ItemStack p_40572_, @Nullable Level p_40573_, @Nonnull List<Component> p_40574_, @Nonnull TooltipFlag p_40575_) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_);
p_40574_.add(new TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc").withStyle(ChatFormatting.GRAY));
p_40574_.add(new TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc2").withStyle(ChatFormatting.DARK_GRAY));
}
};
public static final Item GRAVITATION_FIELD_LIMITER = new Item(DEFAULT_PROPERTIES);
public static final Item GRAVITATION_FIELD_SENSOR = new Item(DEFAULT_PROPERTIES);
public static final ItemPortableGravitationStabilizer PORTABLE_GRAVITATION_STABILIZER = new ItemPortableGravitationStabilizer();
public static final BlockItem BLACK_HOLE = new BlockItem(MBlocks.BLACK_HOLE, DEFAULT_PROPERTIES);
public static final GravitationalDisruptorItem GRAVITATIONAL_DISRUPTOR = new GravitationalDisruptorItem();
public static final PillItem PILL_ANDROID = new PillItem(PillType.BECOME_ANDROID);
public static final PillItem PILL_HUMANE = new PillItem(PillType.BECOME_HUMANE);
public static final PillItem PILL_OBLIVION = new PillItem(PillType.OBLIVION);
public static final HealPillItem PILL_HEAL = new HealPillItem();
public static final BatteryItem BATTERY_CRUDE = new BatteryItem(new ImpreciseFraction(30_000), new ImpreciseFraction(150), new ImpreciseFraction(150));
public static final BatteryItem BATTERY_BASIC = new BatteryItem(new ImpreciseFraction(60_000), new ImpreciseFraction(300), new ImpreciseFraction(300));
public static final BatteryItem BATTERY_NORMAL = new BatteryItem(new ImpreciseFraction(250_000), new ImpreciseFraction(1000), new ImpreciseFraction(1000));
public static final BatteryItem BATTERY_DENSE = new BatteryItem(new ImpreciseFraction(1_000_000), new ImpreciseFraction(2000), new ImpreciseFraction(2000));
public static final BatteryItem BATTERY_CAPACITOR = new BatteryItem(new ImpreciseFraction(150_000), new ImpreciseFraction(15000), new ImpreciseFraction(15000));
public static final BatteryItem BATTERY_CREATIVE = new BatteryItem();
public static final BatteryItem[] BATTERIES = {
BATTERY_CRUDE,
BATTERY_BASIC,
BATTERY_NORMAL,
BATTERY_DENSE,
BATTERY_CAPACITOR,
};
public static final Item MATTER_CAPACITOR_PARTS = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB));
public static final Item[] DATAGEN_COMPONENTS = {
ENERGY_BUS,
ELECTRIC_PARTS,
TRITANIUM_PLATE,
IRON_PLATE,
COPPER_WIRING,
GOLD_WIRING,
CIRCUIT_PLATING,
BASIC_CONTROL_CIRCUIT,
ADVANCED_CONTROL_CIRCUIT,
MATTER_CAPACITOR_PARTS,
MATTER_IO_PORT,
MATTER_TRANSFORM_MATRIX,
};
public static final MatterCapacitorItem MATTER_CAPACITOR_BASIC = new MatterCapacitorItem(new ImpreciseFraction("4"));
public static final MatterCapacitorItem MATTER_CAPACITOR_NORMAL = new MatterCapacitorItem(new ImpreciseFraction("10"));
public static final MatterCapacitorItem MATTER_CAPACITOR_DENSE = new MatterCapacitorItem(new ImpreciseFraction("40"));
public static final MatterCapacitorItem MATTER_CAPACITOR_CREATIVE = new MatterCapacitorItem();
public static final PatternStorageItem PATTERN_DRIVE_NORMAL = new PatternStorageItem(4);
public static final PatternStorageItem PATTERN_DRIVE_CREATIVE = new PatternStorageItem();
public static final PortableCondensationDriveItem PORTABLE_CONDENSATION_DRIVE = new PortableCondensationDriveItem(4000);
public static final PortableCondensationDriveItem PORTABLE_DENSE_CONDENSATION_DRIVE = new PortableCondensationDriveItem(25000);
public static final Item NUTRIENT_PASTE = new Item(new Item.Properties().stacksTo(64).food(new FoodProperties.Builder().meat().nutrition(8).saturationMod(0.9F).build()).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB));
public static final Item[] CRATES = new Item[Registry.CRATES.length];
public static final Item TRITANIUM_BLOCK = new BlockItem(MBlocks.TRITANIUM_BLOCK, DEFAULT_PROPERTIES);
public static final Item TRITANIUM_STRIPED_BLOCK = new BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES);
public static final Item CARBON_FIBRE_BLOCK = new BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES);
static {
for (int i = 0; i < Registry.CRATES.length; i++) {
CRATES[i] = new BlockItem(MBlocks.CRATES[i], new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB));
CRATES[i].setRegistryName(Registry.CRATES[i].name());
}
ANDROID_STATION.setRegistryName(MNames.ANDROID_STATION);
BATTERY_BANK.setRegistryName(MNames.BATTERY_BANK);
MATTER_DECOMPOSER.setRegistryName(MNames.MATTER_DECOMPOSER);
MATTER_CAPACITOR_BANK.setRegistryName(MNames.MATTER_CAPACITOR_BANK);
MATTER_CABLE.setRegistryName(MNames.MATTER_CABLE);
PATTERN_STORAGE.setRegistryName(MNames.PATTERN_STORAGE);
MATTER_SCANNER.setRegistryName(MNames.MATTER_SCANNER);
MATTER_PANEL.setRegistryName(MNames.MATTER_PANEL);
MATTER_REPLICATOR.setRegistryName(MNames.MATTER_REPLICATOR);
MATTER_BOTTLER.setRegistryName(MNames.MATTER_BOTTLER);
DRIVE_VIEWER.setRegistryName(MNames.DRIVE_VIEWER);
BLACK_HOLE.setRegistryName(MNames.BLACK_HOLE);
CARGO_CRATE.setRegistryName(MNames.CARGO_CRATE);
DRIVE_RACK.setRegistryName(MNames.DRIVE_RACK);
ITEM_MONITOR.setRegistryName(MNames.ITEM_MONITOR);
ENERGY_COUNTER.setRegistryName(MNames.ENERGY_COUNTER);
CHEMICAL_GENERATOR.setRegistryName(MNames.CHEMICAL_GENERATOR);
PLATE_PRESS.setRegistryName(MNames.PLATE_PRESS);
GRAVITATION_STABILIZER.setRegistryName(MNames.GRAVITATION_STABILIZER);
MATTER_RECYCLER.setRegistryName(MNames.MATTER_RECYCLER);
MATTER_DUST.setRegistryName(MNames.MATTER_DUST);
DEBUG_EXPLOSION_SMALL.setRegistryName(MNames.DEBUG_EXPLOSION_SMALL);
DEBUG_SPHERE_POINTS.setRegistryName(MNames.DEBUG_SPHERE_POINTS);
TRITANIUM_ORE.setRegistryName(MNames.TRITANIUM_ORE);
DEEPSLATE_TRITANIUM_ORE.setRegistryName(MNames.DEEPSLATE_TRITANIUM_ORE);
TRITANIUM_RAW_BLOCK.setRegistryName(MNames.TRITANIUM_RAW_BLOCK);
TRITANIUM_ORE_CLUMP.setRegistryName(MNames.TRITANIUM_ORE_CLUMP);
TRITANIUM_INGOT.setRegistryName(MNames.TRITANIUM_INGOT);
MATTER_IO_PORT.setRegistryName(MNames.MATTER_IO_PORT);
MATTER_TRANSFORM_MATRIX.setRegistryName(MNames.MATTER_TRANSFORM_MATRIX);
ENERGY_BUS.setRegistryName(MNames.ENERGY_BUS);
ELECTRIC_PARTS.setRegistryName(MNames.ELECTRIC_PARTS);
MACHINE_FRAME.setRegistryName(MNames.MACHINE_FRAME);
TRITANIUM_PLATE.setRegistryName(MNames.TRITANIUM_PLATE);
IRON_PLATE.setRegistryName(MNames.IRON_PLATE);
COPPER_WIRING.setRegistryName(MNames.COPPER_WIRING);
GOLD_WIRING.setRegistryName(MNames.GOLD_WIRING);
PORTABLE_CONDENSATION_DRIVE_CASING.setRegistryName(MNames.PORTABLE_CONDENSATION_DRIVE_CASING);
PORTABLE_DENSE_CONDENSATION_DRIVE_CASING.setRegistryName(MNames.PORTABLE_DENSE_CONDENSATION_DRIVE_CASING);
CIRCUIT_PLATING.setRegistryName(MNames.CIRCUIT_PLATING);
BASIC_CONTROL_CIRCUIT.setRegistryName(MNames.BASIC_CONTROL_CIRCUIT);
ADVANCED_CONTROL_CIRCUIT.setRegistryName(MNames.ADVANCED_CONTROL_CIRCUIT);
BLACK_HOLE_SCANNER.setRegistryName(MNames.BLACK_HOLE_SCANNER);
GRAVITATION_FIELD_LIMITER.setRegistryName(MNames.GRAVITATION_FIELD_LIMITER);
GRAVITATION_FIELD_SENSOR.setRegistryName(MNames.GRAVITATION_FIELD_SENSOR);
PORTABLE_GRAVITATION_STABILIZER.setRegistryName(MNames.PORTABLE_GRAVITATION_STABILIZER);
GRAVITATIONAL_DISRUPTOR.setRegistryName(MNames.GRAVITATIONAL_DISRUPTOR);
PILL_ANDROID.setRegistryName(MNames.PILL_ANDROID);
PILL_HUMANE.setRegistryName(MNames.PILL_HUMANE);
PILL_OBLIVION.setRegistryName(MNames.PILL_OBLIVION);
PILL_HEAL.setRegistryName(MNames.PILL_HEAL);
BATTERY_CRUDE.setRegistryName(MNames.BATTERY_CRUDE);
BATTERY_BASIC.setRegistryName(MNames.BATTERY_BASIC);
BATTERY_NORMAL.setRegistryName(MNames.BATTERY_NORMAL);
BATTERY_DENSE.setRegistryName(MNames.BATTERY_DENSE);
BATTERY_CAPACITOR.setRegistryName(MNames.BATTERY_CAPACITOR);
BATTERY_CREATIVE.setRegistryName(MNames.BATTERY_CREATIVE);
MATTER_CAPACITOR_PARTS.setRegistryName(MNames.MATTER_CAPACITOR_PARTS);
MATTER_CAPACITOR_BASIC.setRegistryName(MNames.MATTER_CAPACITOR_BASIC);
MATTER_CAPACITOR_NORMAL.setRegistryName(MNames.MATTER_CAPACITOR_NORMAL);
MATTER_CAPACITOR_DENSE.setRegistryName(MNames.MATTER_CAPACITOR_DENSE);
MATTER_CAPACITOR_CREATIVE.setRegistryName(MNames.MATTER_CAPACITOR_CREATIVE);
PATTERN_DRIVE_NORMAL.setRegistryName(MNames.PATTERN_DRIVE_NORMAL);
PATTERN_DRIVE_CREATIVE.setRegistryName(MNames.PATTERN_DRIVE_CREATIVE);
PORTABLE_CONDENSATION_DRIVE.setRegistryName(MNames.PORTABLE_CONDENSATION_DRIVE);
PORTABLE_DENSE_CONDENSATION_DRIVE.setRegistryName(MNames.PORTABLE_DENSE_CONDENSATION_DRIVE);
NUTRIENT_PASTE.setRegistryName(MNames.NUTRIENT_PASTE);
TRITANIUM_BLOCK.setRegistryName(MNames.TRITANIUM_BLOCK);
TRITANIUM_STRIPED_BLOCK.setRegistryName(MNames.TRITANIUM_STRIPED_BLOCK);
CARBON_FIBRE_BLOCK.setRegistryName(MNames.CARBON_FIBRE_BLOCK);
TRITANIUM_SWORD.setRegistryName(MNames.TRITANIUM_SWORD);
TRITANIUM_PICKAXE.setRegistryName(MNames.TRITANIUM_PICKAXE);
TRITANIUM_SHOVEL.setRegistryName(MNames.TRITANIUM_SHOVEL);
TRITANIUM_AXE.setRegistryName(MNames.TRITANIUM_AXE);
TRITANIUM_HOE.setRegistryName(MNames.TRITANIUM_HOE);
TRITANIUM_HELMET.setRegistryName(MNames.TRITANIUM_HELMET);
TRITANIUM_CHESTPLATE.setRegistryName(MNames.TRITANIUM_CHESTPLATE);
TRITANIUM_PANTS.setRegistryName(MNames.TRITANIUM_PANTS);
TRITANIUM_BOOTS.setRegistryName(MNames.TRITANIUM_BOOTS);
ENERGY_SWORD.setRegistryName(MNames.ENERGY_SWORD);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<Item> event) {
event.getRegistry().register(ANDROID_STATION);
event.getRegistry().register(BATTERY_BANK);
event.getRegistry().register(MATTER_DECOMPOSER);
event.getRegistry().register(MATTER_CAPACITOR_BANK);
event.getRegistry().register(MATTER_CABLE);
event.getRegistry().register(PATTERN_STORAGE);
event.getRegistry().register(MATTER_SCANNER);
event.getRegistry().register(MATTER_PANEL);
event.getRegistry().register(MATTER_REPLICATOR);
event.getRegistry().register(MATTER_BOTTLER);
event.getRegistry().register(DRIVE_VIEWER);
event.getRegistry().register(BLACK_HOLE);
event.getRegistry().register(CARGO_CRATE);
event.getRegistry().register(DRIVE_RACK);
event.getRegistry().register(ITEM_MONITOR);
event.getRegistry().register(ENERGY_COUNTER);
event.getRegistry().register(CHEMICAL_GENERATOR);
event.getRegistry().register(PLATE_PRESS);
event.getRegistry().register(GRAVITATION_STABILIZER);
event.getRegistry().register(MATTER_DUST);
event.getRegistry().register(MATTER_RECYCLER);
event.getRegistry().register(DEBUG_EXPLOSION_SMALL);
event.getRegistry().register(DEBUG_SPHERE_POINTS);
event.getRegistry().register(TRITANIUM_ORE);
event.getRegistry().register(DEEPSLATE_TRITANIUM_ORE);
event.getRegistry().register(TRITANIUM_RAW_BLOCK);
event.getRegistry().register(TRITANIUM_ORE_CLUMP);
event.getRegistry().register(TRITANIUM_INGOT);
event.getRegistry().register(MATTER_IO_PORT);
event.getRegistry().register(MATTER_TRANSFORM_MATRIX);
event.getRegistry().register(ENERGY_BUS);
event.getRegistry().register(ELECTRIC_PARTS);
event.getRegistry().register(MACHINE_FRAME);
event.getRegistry().register(TRITANIUM_PLATE);
event.getRegistry().register(IRON_PLATE);
event.getRegistry().register(COPPER_WIRING);
event.getRegistry().register(GOLD_WIRING);
event.getRegistry().register(PORTABLE_CONDENSATION_DRIVE_CASING);
event.getRegistry().register(PORTABLE_DENSE_CONDENSATION_DRIVE_CASING);
event.getRegistry().register(CIRCUIT_PLATING);
event.getRegistry().register(BASIC_CONTROL_CIRCUIT);
event.getRegistry().register(ADVANCED_CONTROL_CIRCUIT);
event.getRegistry().register(BLACK_HOLE_SCANNER);
event.getRegistry().register(GRAVITATION_FIELD_LIMITER);
event.getRegistry().register(GRAVITATION_FIELD_SENSOR);
event.getRegistry().register(PORTABLE_GRAVITATION_STABILIZER);
event.getRegistry().register(GRAVITATIONAL_DISRUPTOR);
event.getRegistry().register(PILL_ANDROID);
event.getRegistry().register(PILL_HUMANE);
event.getRegistry().register(PILL_OBLIVION);
event.getRegistry().register(PILL_HEAL);
event.getRegistry().register(BATTERY_CRUDE);
event.getRegistry().register(BATTERY_BASIC);
event.getRegistry().register(BATTERY_NORMAL);
event.getRegistry().register(BATTERY_DENSE);
event.getRegistry().register(BATTERY_CAPACITOR);
event.getRegistry().register(BATTERY_CREATIVE);
event.getRegistry().register(MATTER_CAPACITOR_PARTS);
event.getRegistry().register(MATTER_CAPACITOR_BASIC);
event.getRegistry().register(MATTER_CAPACITOR_NORMAL);
event.getRegistry().register(MATTER_CAPACITOR_DENSE);
event.getRegistry().register(MATTER_CAPACITOR_CREATIVE);
event.getRegistry().register(PATTERN_DRIVE_NORMAL);
event.getRegistry().register(PATTERN_DRIVE_CREATIVE);
event.getRegistry().register(PORTABLE_CONDENSATION_DRIVE);
event.getRegistry().register(PORTABLE_DENSE_CONDENSATION_DRIVE);
event.getRegistry().register(NUTRIENT_PASTE);
event.getRegistry().register(TRITANIUM_BLOCK);
event.getRegistry().register(TRITANIUM_STRIPED_BLOCK);
event.getRegistry().register(CARBON_FIBRE_BLOCK);
for (var crate : CRATES) {
event.getRegistry().register(crate);
}
for (var glass : Registry.INDUSTRIAL_GLASS_LIST) {
event.getRegistry().register(glass.item());
event.getRegistry().register(glass.paneItem());
}
event.getRegistry().register(TRITANIUM_SWORD);
event.getRegistry().register(TRITANIUM_SHOVEL);
event.getRegistry().register(TRITANIUM_AXE);
event.getRegistry().register(TRITANIUM_PICKAXE);
event.getRegistry().register(TRITANIUM_HOE);
event.getRegistry().register(TRITANIUM_HELMET);
event.getRegistry().register(TRITANIUM_CHESTPLATE);
event.getRegistry().register(TRITANIUM_PANTS);
event.getRegistry().register(TRITANIUM_BOOTS);
event.getRegistry().register(ENERGY_SWORD);
// OverdriveThatMatters.LOGGER.info("Registered items");
}
}

View File

@ -1,97 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.world.inventory.MenuType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import ru.dbotthepony.mc.otm.client.screen.*;
import ru.dbotthepony.mc.otm.menu.*;
public class MMenus {
public static final MenuType<AndroidStationMenu> ANDROID_STATION = new MenuType<>(AndroidStationMenu::new);
public static final MenuType<BatteryBankMenu> BATTERY_BANK = new MenuType<>(BatteryBankMenu::new);
public static final MenuType<MatterDecomposerMenu> MATTER_DECOMPOSER = new MenuType<>(MatterDecomposerMenu::new);
public static final MenuType<MatterCapacitorMenu> MATTER_CAPACITOR_BANK = new MenuType<>(MatterCapacitorMenu::new);
public static final MenuType<PatternStorageMenu> PATTERN_STORAGE = new MenuType<>(PatternStorageMenu::new);
public static final MenuType<MatterScannerMenu> MATTER_SCANNER = new MenuType<>(MatterScannerMenu::new);
public static final MenuType<MatterPanelMenu> MATTER_PANEL = new MenuType<>(MatterPanelMenu::new);
public static final MenuType<MatterReplicatorMenu> MATTER_REPLICATOR = new MenuType<>(MatterReplicatorMenu::new);
public static final MenuType<MatterBottlerMenu> MATTER_BOTTLER = new MenuType<>(MatterBottlerMenu::new);
public static final MenuType<DriveViewerMenu> DRIVE_VIEWER = new MenuType<>(DriveViewerMenu::new);
public static final MenuType<CargoCrateMenu> CARGO_CRATE = new MenuType<>(CargoCrateMenu::new);
public static final MenuType<DriveRackMenu> DRIVE_RACK = new MenuType<>(DriveRackMenu::new);
public static final MenuType<ItemMonitorMenu> ITEM_MONITOR = new MenuType<>(ItemMonitorMenu::new);
public static final MenuType<EnergyCounterMenu> ENERGY_COUNTER = new MenuType<>(EnergyCounterMenu::new);
public static final MenuType<ChemicalGeneratorMenu> CHEMICAL_GENERATOR = new MenuType<>(ChemicalGeneratorMenu::new);
public static final MenuType<MenuPlatePress> PLATE_PRESS = new MenuType<>(MenuPlatePress::new);
public static final MenuType<MatterRecyclerMenu> MATTER_RECYCLER = new MenuType<>(MatterRecyclerMenu::new);
static {
ANDROID_STATION.setRegistryName(MNames.ANDROID_STATION);
BATTERY_BANK.setRegistryName(MNames.BATTERY_BANK);
MATTER_DECOMPOSER.setRegistryName(MNames.MATTER_DECOMPOSER);
MATTER_CAPACITOR_BANK.setRegistryName(MNames.MATTER_CAPACITOR_BANK);
PATTERN_STORAGE.setRegistryName(MNames.PATTERN_STORAGE);
MATTER_SCANNER.setRegistryName(MNames.MATTER_SCANNER);
MATTER_PANEL.setRegistryName(MNames.MATTER_PANEL);
MATTER_REPLICATOR.setRegistryName(MNames.MATTER_REPLICATOR);
MATTER_BOTTLER.setRegistryName(MNames.MATTER_BOTTLER);
DRIVE_VIEWER.setRegistryName(MNames.DRIVE_VIEWER);
CARGO_CRATE.setRegistryName(MNames.CARGO_CRATE);
DRIVE_RACK.setRegistryName(MNames.DRIVE_RACK);
ITEM_MONITOR.setRegistryName(MNames.ITEM_MONITOR);
ENERGY_COUNTER.setRegistryName(MNames.ENERGY_COUNTER);
CHEMICAL_GENERATOR.setRegistryName(MNames.CHEMICAL_GENERATOR);
PLATE_PRESS.setRegistryName(MNames.PLATE_PRESS);
MATTER_RECYCLER.setRegistryName(MNames.MATTER_RECYCLER);
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<MenuType<?>> event) {
event.getRegistry().register(ANDROID_STATION);
event.getRegistry().register(BATTERY_BANK);
event.getRegistry().register(MATTER_DECOMPOSER);
event.getRegistry().register(MATTER_CAPACITOR_BANK);
event.getRegistry().register(PATTERN_STORAGE);
event.getRegistry().register(MATTER_SCANNER);
event.getRegistry().register(MATTER_PANEL);
event.getRegistry().register(MATTER_REPLICATOR);
event.getRegistry().register(MATTER_BOTTLER);
event.getRegistry().register(DRIVE_VIEWER);
event.getRegistry().register(CARGO_CRATE);
event.getRegistry().register(DRIVE_RACK);
event.getRegistry().register(ITEM_MONITOR);
event.getRegistry().register(ENERGY_COUNTER);
event.getRegistry().register(CHEMICAL_GENERATOR);
event.getRegistry().register(PLATE_PRESS);
event.getRegistry().register(MATTER_RECYCLER);
// OverdriveThatMatters.LOGGER.info("Registered menus");
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void registerScreens(final FMLClientSetupEvent event) {
MenuScreens.register(ANDROID_STATION, AndroidStationScreen::new);
MenuScreens.register(BATTERY_BANK, BatteryBankScreen::new);
MenuScreens.register(MATTER_DECOMPOSER, MatterDecomposerScreen::new);
MenuScreens.register(MATTER_CAPACITOR_BANK, MatterCapacitorBankScreen::new);
MenuScreens.register(PATTERN_STORAGE, PatternStorageScreen::new);
MenuScreens.register(MATTER_SCANNER, MatterScannerScreen::new);
MenuScreens.register(MATTER_PANEL, MatterPanelScreen::new);
MenuScreens.register(MATTER_REPLICATOR, MatterReplicatorScreen::new);
MenuScreens.register(MATTER_BOTTLER, MatterBottlerScreen::new);
MenuScreens.register(DRIVE_VIEWER, DriveViewerScreen::new);
MenuScreens.register(CARGO_CRATE, CargoCrateScreen::new);
MenuScreens.register(DRIVE_RACK, DriveRackScreen::new);
MenuScreens.register(ITEM_MONITOR, ItemMonitorScreen::new);
MenuScreens.register(ENERGY_COUNTER, EnergyCounterScreen::new);
MenuScreens.register(CHEMICAL_GENERATOR, ChemicalGeneratorScreen::new);
MenuScreens.register(PLATE_PRESS, PlatePressScreen::new);
MenuScreens.register(MATTER_RECYCLER, MatterRecyclerScreen::new);
// OverdriveThatMatters.LOGGER.info("Registered screens");
}
}

View File

@ -1,175 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.resources.ResourceLocation;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
public class MNames {
private static ResourceLocation loc(String path) {
return new ResourceLocation(OverdriveThatMatters.MOD_ID, path);
}
// blocks
public static final ResourceLocation ANDROID_STATION = loc("android_station"); // без рецепта
public static final ResourceLocation BATTERY_BANK = loc("battery_bank"); // нужен рецепт
public static final ResourceLocation MATTER_DECOMPOSER = loc("matter_decomposer"); // есть рецепт
public static final ResourceLocation MATTER_CAPACITOR_BANK = loc("matter_capacitor_bank"); // есть рецепт
public static final ResourceLocation MATTER_CABLE = loc("matter_cable"); // есть рецепт
public static final ResourceLocation PATTERN_STORAGE = loc("pattern_storage"); // есть рецепт
public static final ResourceLocation MATTER_SCANNER = loc("matter_scanner"); // есть рецепт
public static final ResourceLocation MATTER_PANEL = loc("matter_panel"); // есть рецепт
public static final ResourceLocation MATTER_REPLICATOR = loc("matter_replicator"); // есть рецепт
public static final ResourceLocation MATTER_BOTTLER = loc("matter_bottler"); // есть рецепт
public static final ResourceLocation DRIVE_VIEWER = loc("drive_viewer"); // есть рецепт
public static final ResourceLocation DRIVE_RACK = loc("drive_rack"); // нужен рецепт (после улучшений)
public static final ResourceLocation ITEM_MONITOR = loc("item_monitor"); // нужен рецепт (после улучшений)
public static final ResourceLocation ENERGY_COUNTER = loc("energy_counter"); // есть рецепт
public static final ResourceLocation CHEMICAL_GENERATOR = loc("chemical_generator"); // есть рецепт
public static final ResourceLocation PLATE_PRESS = loc("plate_press"); // есть рецепт
public static final ResourceLocation MATTER_RECYCLER = loc("matter_recycler"); // нужен рецепт
public static final ResourceLocation DEBUG_EXPLOSION_SMALL = loc("debug_explosion_small");
public static final ResourceLocation DEBUG_SPHERE_POINTS = loc("debug_sphere_points");
public static final ResourceLocation BLACK_HOLE = loc("black_hole");
public static final ResourceLocation GRAVITATION_STABILIZER = loc("gravitation_stabilizer"); // нужен рецепт
public static final ResourceLocation GRAVITATION_STABILIZER_LENS = loc("gravitation_stabilizer_lens");
public static final ResourceLocation CARGO_CRATE = loc("cargo_crate"); // нужен рецепт?
// building blocks
public static final ResourceLocation TRITANIUM_BLOCK = loc("tritanium_block");
public static final ResourceLocation TRITANIUM_STRIPED_BLOCK = loc("tritanium_striped_block");
public static final ResourceLocation CARBON_FIBRE_BLOCK = loc("carbon_fibre_block");
// capabilities
public static final ResourceLocation ANDROID_CAPABILITY = loc("android_capability");
// items
public static final ResourceLocation GRAVITATIONAL_DISRUPTOR = loc("gravitational_disruptor");
public static final ResourceLocation MATTER_DUST = loc("matter_dust");
public static final ResourceLocation PILL_ANDROID = loc("pill_android");
public static final ResourceLocation PILL_HUMANE = loc("pill_humane");
public static final ResourceLocation PILL_OBLIVION = loc("pill_oblivion");
public static final ResourceLocation PILL_HEAL = loc("pill_heal");
public static final ResourceLocation BATTERY_CRUDE = loc("battery_crude");
public static final ResourceLocation BATTERY_BASIC = loc("battery_basic");
public static final ResourceLocation BATTERY_NORMAL = loc("battery_normal");
public static final ResourceLocation BATTERY_DENSE = loc("battery_dense");
public static final ResourceLocation BATTERY_CAPACITOR = loc("battery_capacitor");
public static final ResourceLocation BATTERY_CREATIVE = loc("battery_creative");
public static final ResourceLocation MATTER_CAPACITOR_PARTS = loc("matter_capacitor_parts");
public static final ResourceLocation MATTER_CAPACITOR_BASIC = loc("matter_capacitor_basic");
public static final ResourceLocation MATTER_CAPACITOR_NORMAL = loc("matter_capacitor_normal");
public static final ResourceLocation MATTER_CAPACITOR_DENSE = loc("matter_capacitor_dense");
public static final ResourceLocation MATTER_CAPACITOR_CREATIVE = loc("matter_capacitor_creative");
public static final ResourceLocation PATTERN_DRIVE_NORMAL = loc("pattern_drive_normal");
public static final ResourceLocation PATTERN_DRIVE_CREATIVE = loc("pattern_drive_creative");
public static final ResourceLocation NUTRIENT_PASTE = loc("nutrient_paste");
public static final ResourceLocation PORTABLE_CONDENSATION_DRIVE = loc("portable_condensation_drive");
public static final ResourceLocation PORTABLE_DENSE_CONDENSATION_DRIVE = loc("portable_dense_condensation_drive");
public static final ResourceLocation BLACK_HOLE_SCANNER = loc("black_hole_scanner");
public static final ResourceLocation GRAVITATION_FIELD_LIMITER = loc("gravitation_field_limiter");
public static final ResourceLocation GRAVITATION_FIELD_SENSOR = loc("graivtation_field_sensor");
public static final ResourceLocation PORTABLE_GRAVITATION_STABILIZER = loc("portable_gravitation_stabilizer");
// armor
public static final ResourceLocation TRITANIUM_HELMET = loc("tritanium_helmet");
public static final ResourceLocation TRITANIUM_CHESTPLATE = loc("tritanium_chestplate");
public static final ResourceLocation TRITANIUM_PANTS = loc("tritanium_pants");
public static final ResourceLocation TRITANIUM_BOOTS = loc("tritanium_boots");
// tools
public static final ResourceLocation TRITANIUM_SWORD = loc("tritanium_sword");
public static final ResourceLocation TRITANIUM_AXE = loc("tritanium_axe");
public static final ResourceLocation TRITANIUM_PICKAXE = loc("tritanium_pickaxe");
public static final ResourceLocation TRITANIUM_SHOVEL = loc("tritanium_shovel");
public static final ResourceLocation TRITANIUM_HOE = loc("tritanium_hoe");
public static final ResourceLocation ENERGY_SWORD = loc("energy_sword");
// items: crafting components
public static final ResourceLocation TRITANIUM_INGOT = loc("tritanium_ingot");
public static final ResourceLocation MATTER_IO_PORT = loc("matter_io_port");
public static final ResourceLocation MATTER_TRANSFORM_MATRIX = loc("matter_transform_matrix");
public static final ResourceLocation ENERGY_BUS = loc("energy_bus");
public static final ResourceLocation ELECTRIC_PARTS = loc("electric_parts");
public static final ResourceLocation MACHINE_FRAME = loc("machine_frame");
public static final ResourceLocation TRITANIUM_PLATE = loc("tritanium_plate");
public static final ResourceLocation IRON_PLATE = loc("iron_plate");
public static final ResourceLocation COPPER_WIRING = loc("copper_wiring");
public static final ResourceLocation GOLD_WIRING = loc("gold_wiring");
public static final ResourceLocation PORTABLE_CONDENSATION_DRIVE_CASING = loc("portable_condensation_drive_casing");
public static final ResourceLocation PORTABLE_DENSE_CONDENSATION_DRIVE_CASING = loc("portable_dense_condensation_drive_casing");
public static final ResourceLocation CIRCUIT_PLATING = loc("circuit_plating");
public static final ResourceLocation BASIC_CONTROL_CIRCUIT = loc("basic_control_circuit");
public static final ResourceLocation ADVANCED_CONTROL_CIRCUIT = loc("advanced_control_circuit");
public static final ResourceLocation TRITANIUM_ORE = loc("tritanium_ore");
public static final ResourceLocation DEEPSLATE_TRITANIUM_ORE = loc("deepslate_tritanium_ore");
public static final ResourceLocation TRITANIUM_RAW_BLOCK = loc("tritanium_raw_block");
public static final ResourceLocation TRITANIUM_ORE_CLUMP = loc("tritanium_ore_clump");
// android features and research
public static final ResourceLocation AIR_BAGS = loc("air_bags");
public static final ResourceLocation LIMB_OVERCLOCKING = loc("limb_overclocking");
public static final ResourceLocation LIMB_OVERCLOCKING_1 = loc("limb_overclocking_1");
public static final ResourceLocation LIMB_OVERCLOCKING_2 = loc("limb_overclocking_2");
public static final ResourceLocation LIMB_OVERCLOCKING_3 = loc("limb_overclocking_3");
public static final ResourceLocation LIMB_OVERCLOCKING_4 = loc("limb_overclocking_4");
public static final ResourceLocation[] LIMB_OVERCLOCKING_LIST = new ResourceLocation[]{LIMB_OVERCLOCKING_1, LIMB_OVERCLOCKING_2, LIMB_OVERCLOCKING_3, LIMB_OVERCLOCKING_4};
public static final ResourceLocation NANOBOTS = loc("nanobots");
public static final ResourceLocation NANOBOTS_REGENERATION = loc("nanobots_regeneration");
public static final ResourceLocation NANOBOTS_REGENERATION_1 = loc("nanobots_regeneration_1");
public static final ResourceLocation NANOBOTS_REGENERATION_2 = loc("nanobots_regeneration_2");
public static final ResourceLocation NANOBOTS_REGENERATION_3 = loc("nanobots_regeneration_3");
public static final ResourceLocation NANOBOTS_REGENERATION_4 = loc("nanobots_regeneration_4");
public static final ResourceLocation[] NANOBOTS_REGENERATION_LIST = new ResourceLocation[]{NANOBOTS_REGENERATION_1, NANOBOTS_REGENERATION_2, NANOBOTS_REGENERATION_3, NANOBOTS_REGENERATION_4};
public static final ResourceLocation NANOBOTS_ARMOR = loc("nanobots_armor");
public static final ResourceLocation NANOBOTS_ARMOR_STRENGTH_1 = loc("nanobots_armor_strength_1");
public static final ResourceLocation NANOBOTS_ARMOR_STRENGTH_2 = loc("nanobots_armor_strength_2");
public static final ResourceLocation NANOBOTS_ARMOR_STRENGTH_3 = loc("nanobots_armor_strength_3");
public static final ResourceLocation[] NANOBOTS_ARMOR_STRENGTH_LIST = new ResourceLocation[]{
NANOBOTS_ARMOR_STRENGTH_1,
NANOBOTS_ARMOR_STRENGTH_2,
NANOBOTS_ARMOR_STRENGTH_3,
};
public static final ResourceLocation NANOBOTS_ARMOR_SPEED_1 = loc("nanobots_armor_speed_1");
public static final ResourceLocation NANOBOTS_ARMOR_SPEED_2 = loc("nanobots_armor_speed_2");
public static final ResourceLocation NANOBOTS_ARMOR_SPEED_3 = loc("nanobots_armor_speed_3");
public static final ResourceLocation[] NANOBOTS_ARMOR_SPEED_LIST = new ResourceLocation[]{
NANOBOTS_ARMOR_SPEED_1,
NANOBOTS_ARMOR_SPEED_2,
NANOBOTS_ARMOR_SPEED_3,
};
public static final ResourceLocation HYDRAULICS_OVERLOAD = loc("hydraulics_overload");
public static final ResourceLocation HYDRAULICS_OVERLOAD_1 = loc("hydraulics_overload_1");
public static final ResourceLocation HYDRAULICS_OVERLOAD_2 = loc("hydraulics_overload_2");
public static final ResourceLocation HYDRAULICS_OVERLOAD_3 = loc("hydraulics_overload_3");
public static final ResourceLocation EXTENDED_REACH = loc("extended_reach");
// stats
public static final ResourceLocation DAMAGE_ABSORBED = loc("damage_absorbed");
public static final ResourceLocation HEALTH_REGENERATED = loc("health_regenerated");
public static final ResourceLocation POWER_CONSUMED = loc("power_consumed");
}

View File

@ -7,6 +7,7 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe; import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipeFactory; import ru.dbotthepony.mc.otm.recipe.PlatePressRecipeFactory;
@ -28,7 +29,7 @@ public class MRecipes {
} }
} }
public static final MatteryRecipeType<PlatePressRecipe> PLATE_PRESS = new MatteryRecipeType<>(MNames.PLATE_PRESS); public static final MatteryRecipeType<PlatePressRecipe> PLATE_PRESS = new MatteryRecipeType<>(OverdriveThatMatters.loc(MNames.PLATE_PRESS));
@SubscribeEvent @SubscribeEvent
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -1,19 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.stats.StatFormatter;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
public class MStats {
@SubscribeEvent
@SuppressWarnings("unused")
public static void registerVanilla(final FMLCommonSetupEvent event) {
net.minecraft.core.Registry.register(net.minecraft.core.Registry.CUSTOM_STAT, MNames.DAMAGE_ABSORBED, MNames.DAMAGE_ABSORBED);
net.minecraft.core.Registry.register(net.minecraft.core.Registry.CUSTOM_STAT, MNames.HEALTH_REGENERATED, MNames.HEALTH_REGENERATED);
net.minecraft.core.Registry.register(net.minecraft.core.Registry.CUSTOM_STAT, MNames.POWER_CONSUMED, MNames.POWER_CONSUMED);
net.minecraft.stats.Stats.CUSTOM.get(MNames.DAMAGE_ABSORBED, StatFormatter.DIVIDE_BY_TEN);
net.minecraft.stats.Stats.CUSTOM.get(MNames.HEALTH_REGENERATED, StatFormatter.DIVIDE_BY_TEN);
net.minecraft.stats.Stats.CUSTOM.get(MNames.POWER_CONSUMED, StatFormatter.DIVIDE_BY_TEN);
}
}

View File

@ -9,7 +9,7 @@ import java.util.Set;
public class MTags { public class MTags {
public static class Items { public static class Items {
public static final Tags.IOptionalNamedTag<Item> INGOT_TRITANIUM = ItemTags.createOptional(new ResourceLocation("forge", "ingots/tritanium"), Set.of(() -> MItems.TRITANIUM_INGOT)); public static final Tags.IOptionalNamedTag<Item> INGOT_TRITANIUM = ItemTags.createOptional(new ResourceLocation("forge", "ingots/tritanium"), Set.of(MItems.INSTANCE::getTRITANIUM_INGOT));
public static final Tags.IOptionalNamedTag<Item> PLATE_TRITANIUM = ItemTags.createOptional(new ResourceLocation("forge", "plates/tritanium"), Set.of(() -> MItems.TRITANIUM_PLATE)); public static final Tags.IOptionalNamedTag<Item> PLATE_TRITANIUM = ItemTags.createOptional(new ResourceLocation("forge", "plates/tritanium"), Set.of(MItems.INSTANCE::getTRITANIUM_PLATE));
} }
} }

View File

@ -1,210 +0,0 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.stats.StatFormatter;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import org.jetbrains.annotations.Nullable;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.android.AndroidResearchBuilder;
import ru.dbotthepony.mc.otm.android.AndroidResearchType;
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor;
import ru.dbotthepony.mc.otm.android.AndroidFeatureType;
import ru.dbotthepony.mc.otm.client.render.SkinElement;
import ru.dbotthepony.mc.otm.menu.*;
import ru.dbotthepony.mc.otm.client.screen.*;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipeFactory;
import net.minecraftforge.common.Tags.IOptionalNamedTag;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import ru.dbotthepony.mc.otm.registry.MItems;
import ru.dbotthepony.mc.otm.registry.MNames;
import java.util.ConcurrentModificationException;
import java.util.Set;
public class Registry {
static {
if (OverdriveThatMatters.INSTANCE == null) {
throw new ConcurrentModificationException("Accessing Registry before OverdriveThatMatters class is initialized. This is not supported! If no other mods are installed this is a bug.");
}
}
public static final DamageSource DAMAGE_BECOME_ANDROID = new DamageSource("otm_become_android");
public static final DamageSource DAMAGE_BECOME_HUMANE = new DamageSource("otm_become_humane");
public static final DamageSource DAMAGE_EVENT_HORIZON = new DamageSource("otm_event_horizon");
public static final DamageSource DAMAGE_HAWKING_RADIATION = new DamageSource("otm_hawking_radiation");
public static final String DAMAGE_EMP_NAME = "otm_emp";
public static final DamageSource DAMAGE_EMP = new EMPDamageSource();
static {
DAMAGE_BECOME_ANDROID.bypassArmor().bypassInvul().bypassMagic();
DAMAGE_BECOME_HUMANE.bypassArmor().bypassInvul().bypassMagic();
DAMAGE_EVENT_HORIZON.bypassMagic().bypassArmor();
DAMAGE_EMP.bypassMagic().bypassArmor();
// DAMAGE_HAWKING_RADIATION.bypassMagic().bypassArmor();
}
public static final ForgeRegistry<AndroidFeatureType<?>> ANDROID_FEATURES;
public static final ForgeRegistry<AndroidResearchType<?>> ANDROID_RESEARCH;
static {
var builder = new RegistryBuilder<AndroidFeatureType<?>>();
builder.setName(new ResourceLocation(OverdriveThatMatters.MOD_ID, "android_features"));
// make it shut up
builder.setType(c(AndroidFeatureType.class));
ANDROID_FEATURES = (ForgeRegistry<AndroidFeatureType<?>>) builder.create();
var builder2 = new RegistryBuilder<AndroidResearchType<?>>();
builder2.setName(new ResourceLocation(OverdriveThatMatters.MOD_ID, "android_research"));
// make it shut up
builder2.setType(c(AndroidResearchType.class));
ANDROID_RESEARCH = (ForgeRegistry<AndroidResearchType<?>>) builder2.create();
}
public static void dummy() {}
@SuppressWarnings("unchecked")
private static <T> Class<T> c(Class<?> cls) { return (Class<T>) cls; }
record CrateProps(MaterialColor color, ResourceLocation name) {
public CrateProps(MaterialColor color, String name) {
this(color, new ResourceLocation(OverdriveThatMatters.MOD_ID, "crate_" + name));
}
}
public static final CrateProps[] CRATES = new CrateProps[] {
new CrateProps(MaterialColor.COLOR_RED, "red"),
new CrateProps(MaterialColor.COLOR_BLUE, "blue"),
new CrateProps(MaterialColor.COLOR_YELLOW, "yellow"),
new CrateProps(MaterialColor.COLOR_GREEN, "green"),
new CrateProps(MaterialColor.COLOR_BLACK, "black"),
new CrateProps(MaterialColor.COLOR_PINK, "pink"),
new CrateProps(MaterialColor.COLOR_PURPLE, "purple"),
};
public record IndustrialGlassProps(@Nullable DyeColor color, ResourceLocation name, ResourceLocation namePane, Block block, Block pane, BlockItem item, BlockItem paneItem) {
public IndustrialGlassProps(@Nullable DyeColor color, ResourceLocation name, ResourceLocation namePane, Block block, Block pane, BlockItem item, BlockItem paneItem) {
this.color = color;
this.name = name;
this.namePane = namePane;
this.block = block;
this.pane = pane;
this.item = item;
this.paneItem = paneItem;
this.block.setRegistryName(this.name);
this.pane.setRegistryName(this.namePane);
this.item.setRegistryName(this.name);
this.paneItem.setRegistryName(this.namePane);
}
IndustrialGlassProps(@Nullable DyeColor color, ResourceLocation name, ResourceLocation namePane, Block block, Block pane) {
this(color, name, namePane, block, pane,
new BlockItem(block, new Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)),
new BlockItem(pane, new Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)));
}
IndustrialGlassProps(@Nullable DyeColor color, ResourceLocation name, ResourceLocation namePane) {
this(color, name, namePane,
glass(color, BlockBehaviour.Properties.of(Material.GLASS, color != null ? color.getMaterialColor() : MaterialColor.NONE)
.strength(1.5F, 5.0F)
.requiresCorrectToolForDrops()
.sound(SoundType.GLASS)
.noOcclusion()
.isValidSpawn((_a, _b, _c, _d) -> false)
.isRedstoneConductor((_a, _b, _c) -> false)
.isSuffocating((_a, _b, _c) -> false)
.isViewBlocking((_a, _b, _c) -> false)),
pane(color, BlockBehaviour.Properties.of(Material.GLASS, color != null ? color.getMaterialColor() : MaterialColor.NONE)
.strength(1.25F, 5.0F)
.requiresCorrectToolForDrops()
.sound(SoundType.GLASS)
.noOcclusion())
);
}
private static Block glass(@Nullable DyeColor color, BlockBehaviour.Properties props) {
if (color == null) {
return new GlassBlock(props);
}
return new StainedGlassBlock(color, props);
}
private static Block pane(@Nullable DyeColor color, BlockBehaviour.Properties props) {
if (color == null) {
return new IronBarsBlock(props);
}
return new StainedGlassPaneBlock(color, props);
}
IndustrialGlassProps(@Nullable DyeColor color) {
this(color,
new ResourceLocation(OverdriveThatMatters.MOD_ID, color != null ? "industrial_glass_" + color.getName() : "industrial_glass"),
new ResourceLocation(OverdriveThatMatters.MOD_ID, color != null ? "industrial_glass_pane_" + color.getName() : "industrial_glass_pane")
);
}
}
public static final IndustrialGlassProps INDUSTRIAL_GLASS = new IndustrialGlassProps(null);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_WHITE = new IndustrialGlassProps(DyeColor.WHITE);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_ORANGE = new IndustrialGlassProps(DyeColor.ORANGE);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_MAGENTA = new IndustrialGlassProps(DyeColor.MAGENTA);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_LIGHT_BLUE = new IndustrialGlassProps(DyeColor.LIGHT_BLUE);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_YELLOW = new IndustrialGlassProps(DyeColor.YELLOW);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_LIME = new IndustrialGlassProps(DyeColor.LIME);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_PINK = new IndustrialGlassProps(DyeColor.PINK);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_GRAY = new IndustrialGlassProps(DyeColor.GRAY);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_LIGHT_GRAY = new IndustrialGlassProps(DyeColor.LIGHT_GRAY);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_CYAN = new IndustrialGlassProps(DyeColor.CYAN);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_PURPLE = new IndustrialGlassProps(DyeColor.PURPLE);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_BLUE = new IndustrialGlassProps(DyeColor.BLUE);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_BROWN = new IndustrialGlassProps(DyeColor.BROWN);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_GREEN = new IndustrialGlassProps(DyeColor.GREEN);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_RED = new IndustrialGlassProps(DyeColor.RED);
public static final IndustrialGlassProps INDUSTRIAL_GLASS_BLACK = new IndustrialGlassProps(DyeColor.BLACK);
public static final IndustrialGlassProps[] INDUSTRIAL_GLASS_LIST = new IndustrialGlassProps[] {
INDUSTRIAL_GLASS,
INDUSTRIAL_GLASS_WHITE,
INDUSTRIAL_GLASS_ORANGE,
INDUSTRIAL_GLASS_MAGENTA,
INDUSTRIAL_GLASS_LIGHT_BLUE,
INDUSTRIAL_GLASS_YELLOW,
INDUSTRIAL_GLASS_LIME,
INDUSTRIAL_GLASS_PINK,
INDUSTRIAL_GLASS_GRAY,
INDUSTRIAL_GLASS_LIGHT_GRAY,
INDUSTRIAL_GLASS_CYAN,
INDUSTRIAL_GLASS_PURPLE,
INDUSTRIAL_GLASS_BLUE,
INDUSTRIAL_GLASS_BROWN,
INDUSTRIAL_GLASS_GREEN,
INDUSTRIAL_GLASS_RED,
INDUSTRIAL_GLASS_BLACK,
};
}

View File

@ -15,13 +15,13 @@ import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.EnumProperty import net.minecraft.world.level.block.state.properties.EnumProperty
import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter import ru.dbotthepony.mc.otm.block.entity.EnergyCounterBlockEntity
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class EnergyCounterBlock : BlockMattery(), EntityBlock { class EnergyCounterBlock : BlockMattery(), EntityBlock {
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity { override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
return BlockEntityEnergyCounter(blockPos, blockState) return EnergyCounterBlockEntity(blockPos, blockState)
} }
override fun <T : BlockEntity?> getTicker( override fun <T : BlockEntity?> getTicker(
@ -33,9 +33,9 @@ class EnergyCounterBlock : BlockMattery(), EntityBlock {
return null return null
if (level.isClientSide) if (level.isClientSide)
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityEnergyCounter) tile.clientTick() } return BlockEntityTicker { _, _, _, tile -> if (tile is EnergyCounterBlockEntity) tile.clientTick() }
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityEnergyCounter) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is EnergyCounterBlockEntity) tile.tick() }
} }
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
@ -71,7 +71,7 @@ class EnergyCounterBlock : BlockMattery(), EntityBlock {
super.neighborChanged(state, level, pos, sender, sender_pos, flag) super.neighborChanged(state, level, pos, sender, sender_pos, flag)
if (!level.isClientSide) { if (!level.isClientSide) {
(level.getBlockEntity(pos) as? BlockEntityEnergyCounter)?.checkSurroundings(level) (level.getBlockEntity(pos) as? EnergyCounterBlockEntity)?.checkSurroundings(level)
} }
} }

View File

@ -51,7 +51,7 @@ data class EnergyCounterPacket(val pos: BlockPos, val thisTick: ImpreciseFractio
context.get().enqueueWork { context.get().enqueueWork {
val ply = Minecraft.getInstance().player ?: return@enqueueWork val ply = Minecraft.getInstance().player ?: return@enqueueWork
val level = ply.level ?: return@enqueueWork val level = ply.level ?: return@enqueueWork
val tile = level.getBlockEntity(pos) as? BlockEntityEnergyCounter ?: return@enqueueWork val tile = level.getBlockEntity(pos) as? EnergyCounterBlockEntity ?: return@enqueueWork
tile.lastTick = thisTick tile.lastTick = thisTick
tile.passed = total tile.passed = total
@ -72,7 +72,7 @@ data class EnergyCounterPacket(val pos: BlockPos, val thisTick: ImpreciseFractio
} }
} }
class BlockEntityEnergyCounter(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) { class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) {
var passed = ImpreciseFraction.ZERO var passed = ImpreciseFraction.ZERO
private val history = Array(10 * 20) { ImpreciseFraction.ZERO } private val history = Array(10 * 20) { ImpreciseFraction.ZERO }

View File

@ -25,7 +25,7 @@ import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.Graph6Node
import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode
import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph
import ru.dbotthepony.mc.otm.menu.MatterCapacitorMenu import ru.dbotthepony.mc.otm.menu.MatterCapacitorBankMenu
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import javax.annotation.ParametersAreNonnullByDefault import javax.annotation.ParametersAreNonnullByDefault
@ -163,7 +163,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
} }
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu { override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return MatterCapacitorMenu(containerID, inventory, this) return MatterCapacitorBankMenu(containerID, inventory, this)
} }
private var valid = true private var valid = true

View File

@ -30,6 +30,7 @@ import ru.dbotthepony.mc.otm.graph.Graph6Node
import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode
import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph
import ru.dbotthepony.mc.otm.ifHas import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.item.MatterDustItem
import ru.dbotthepony.mc.otm.matter.baselineComplexityDecomposeTicks import ru.dbotthepony.mc.otm.matter.baselineComplexityDecomposeTicks
import ru.dbotthepony.mc.otm.matter.canDecompose import ru.dbotthepony.mc.otm.matter.canDecompose
import ru.dbotthepony.mc.otm.matter.getMatterValue import ru.dbotthepony.mc.otm.matter.getMatterValue
@ -40,7 +41,7 @@ import ru.dbotthepony.mc.otm.set
fun moveMatterAsDustIntoContainer(_matterValue: ImpreciseFraction, container: MatteryContainer, OUTPUT_DUST_MAIN: Int, OUTPUT_DUST_STACKING: Int): ImpreciseFraction { fun moveMatterAsDustIntoContainer(_matterValue: ImpreciseFraction, container: MatteryContainer, OUTPUT_DUST_MAIN: Int, OUTPUT_DUST_STACKING: Int): ImpreciseFraction {
var matterValue = _matterValue var matterValue = _matterValue
val item = MItems.MATTER_DUST val item = MItems.MATTER_DUST as MatterDustItem
while (matterValue > ImpreciseFraction.ZERO) { while (matterValue > ImpreciseFraction.ZERO) {
val stack = container[OUTPUT_DUST_MAIN] val stack = container[OUTPUT_DUST_MAIN]

View File

@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.container.MatteryContainerFilter import ru.dbotthepony.mc.otm.container.MatteryContainerFilter
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.MenuPlatePress import ru.dbotthepony.mc.otm.menu.PlatePressMenu
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MRecipes import ru.dbotthepony.mc.otm.registry.MRecipes
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
@ -68,7 +68,7 @@ class PlatePressBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matter
override fun getDefaultDisplayName() = NAME override fun getDefaultDisplayName() = NAME
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu { override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return MenuPlatePress(containerID, inventory, this) return PlatePressMenu(containerID, inventory, this)
} }
override fun onJobFinish(job: WorkerJob): WorkerJobStatus { override fun onJobFinish(job: WorkerJob): WorkerJobStatus {

View File

@ -21,7 +21,6 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.levelgen.structure.BoundingBox import net.minecraft.world.level.levelgen.structure.BoundingBox
import net.minecraft.world.phys.AABB import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.block.BlackHoleBlock import ru.dbotthepony.mc.otm.block.BlackHoleBlock
import ru.dbotthepony.mc.otm.block.entity.GravitationStabilizerBlockEntity import ru.dbotthepony.mc.otm.block.entity.GravitationStabilizerBlockEntity
import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel
@ -30,6 +29,7 @@ import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.matter.getMatterValue import ru.dbotthepony.mc.otm.matter.getMatterValue
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import kotlin.math.roundToInt import kotlin.math.roundToInt
import kotlin.math.sqrt import kotlin.math.sqrt
@ -137,7 +137,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
} else { } else {
level.explode( level.explode(
null, null,
Registry.DAMAGE_HAWKING_RADIATION, MRegistry.DAMAGE_HAWKING_RADIATION,
null, null,
blockPos.x + 0.5, blockPos.x + 0.5,
blockPos.y + 0.5, blockPos.y + 0.5,
@ -267,7 +267,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
} }
if (distance < gravitationStrength + 1) { if (distance < gravitationStrength + 1) {
living.hurt(Registry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) living.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat())
} }
} }
@ -276,7 +276,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
setDeltaMovement(item, center, distance, false) setDeltaMovement(item, center, distance, false)
if (distance < gravitationStrength + 1) { if (distance < gravitationStrength + 1) {
if (item.hurt(Registry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) { if (item.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) {
if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) { if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) {
collapse() collapse()
} else { } else {

View File

@ -19,10 +19,10 @@ import net.minecraft.world.phys.Vec3
import net.minecraftforge.event.TickEvent import net.minecraftforge.event.TickEvent
import net.minecraftforge.eventbus.api.SubscribeEvent import net.minecraftforge.eventbus.api.SubscribeEvent
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.block.BlockExplosionDebugger import ru.dbotthepony.mc.otm.block.BlockExplosionDebugger
import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.core.Vector import ru.dbotthepony.mc.otm.core.Vector
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -529,7 +529,7 @@ private data class QueuedExplosion(val x: Double, val y: Double, val z: Double,
fun explode(level: Level) { fun explode(level: Level) {
level.explode( level.explode(
null, null,
Registry.DAMAGE_HAWKING_RADIATION, MRegistry.DAMAGE_HAWKING_RADIATION,
BlackHoleExplosionDamageCalculator, BlackHoleExplosionDamageCalculator,
x, x,
y, y,

View File

@ -31,13 +31,14 @@ import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.eventbus.api.SubscribeEvent import net.minecraftforge.eventbus.api.SubscribeEvent
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent
import net.minecraftforge.eventbus.api.EventPriority import net.minecraftforge.eventbus.api.EventPriority
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage
import ru.dbotthepony.mc.otm.capability.extractEnergy import ru.dbotthepony.mc.otm.capability.extractEnergy
import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.capability.receiveEnergy
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.ifHas import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.registry.StatNames
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import java.util.* import java.util.*
@ -188,7 +189,7 @@ open class AndroidCapability(@JvmField protected val ent: LivingEntity) : ICapab
for (tag in featuresNbt) { for (tag in featuresNbt) {
if (tag is CompoundTag) { if (tag is CompoundTag) {
val feature = Registry.ANDROID_FEATURES.getValue(ResourceLocation(tag.getString("id"))) val feature = MRegistry.ANDROID_FEATURES.getValue(ResourceLocation(tag.getString("id")))
if (feature != null && feature.isApplicable(this)) { if (feature != null && feature.isApplicable(this)) {
val feature = feature.factory(this) val feature = feature.factory(this)
@ -325,7 +326,7 @@ open class AndroidCapability(@JvmField protected val ent: LivingEntity) : ICapab
if (howMuch.isZero) { if (howMuch.isZero) {
if (!simulate && ent is ServerPlayer) { if (!simulate && ent is ServerPlayer) {
ent.awardStat(MNames.POWER_CONSUMED, drained.toInt() * 10) ent.awardStat(StatNames.POWER_CONSUMED, drained.toInt() * 10)
} }
return drained return drained
@ -339,7 +340,7 @@ open class AndroidCapability(@JvmField protected val ent: LivingEntity) : ICapab
battery = new battery = new
if (ent is ServerPlayer) { if (ent is ServerPlayer) {
ent.awardStat(MNames.POWER_CONSUMED, drained.toInt() * 10) ent.awardStat(StatNames.POWER_CONSUMED, drained.toInt() * 10)
} }
} }

View File

@ -13,7 +13,6 @@ import net.minecraftforge.event.AttachCapabilitiesEvent
import net.minecraftforge.event.entity.player.PlayerEvent.Clone import net.minecraftforge.event.entity.player.PlayerEvent.Clone
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerChangedDimensionEvent import net.minecraftforge.event.entity.player.PlayerEvent.PlayerChangedDimensionEvent
import net.minecraftforge.eventbus.api.SubscribeEvent import net.minecraftforge.eventbus.api.SubscribeEvent
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearch
import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
@ -22,6 +21,7 @@ import ru.dbotthepony.mc.otm.network.android.AndroidResearchPacket
import ru.dbotthepony.mc.otm.network.android.AndroidStatusPacket import ru.dbotthepony.mc.otm.network.android.AndroidStatusPacket
import ru.dbotthepony.mc.otm.registry.AndroidFeatures import ru.dbotthepony.mc.otm.registry.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import java.util.* import java.util.*
@ -68,7 +68,7 @@ class AndroidCapabilityPlayer(@JvmField val ply: Player) : AndroidCapability(ply
if (isAndroid) return if (isAndroid) return
becomeAndroid() becomeAndroid()
ply.hurt(Registry.DAMAGE_BECOME_ANDROID, ply.maxHealth * 2) ply.hurt(MRegistry.DAMAGE_BECOME_ANDROID, ply.maxHealth * 2)
} }
fun becomeHumane() { fun becomeHumane() {
@ -86,7 +86,7 @@ class AndroidCapabilityPlayer(@JvmField val ply: Player) : AndroidCapability(ply
if (!isAndroid) return if (!isAndroid) return
becomeHumane() becomeHumane()
ply.hurt(Registry.DAMAGE_BECOME_HUMANE, ply.maxHealth * 2) ply.hurt(MRegistry.DAMAGE_BECOME_HUMANE, ply.maxHealth * 2)
} }
override fun deserializeNBT(compound: CompoundTag?) { override fun deserializeNBT(compound: CompoundTag?) {
@ -100,7 +100,7 @@ class AndroidCapabilityPlayer(@JvmField val ply: Player) : AndroidCapability(ply
for (tag in list) { for (tag in list) {
if (tag is CompoundTag) { if (tag is CompoundTag) {
val research = Registry.ANDROID_RESEARCH.getValue(ResourceLocation(tag.getString("id"))) val research = MRegistry.ANDROID_RESEARCH.getValue(ResourceLocation(tag.getString("id")))
if (research != null) { if (research != null) {
val instance = research.factory(this) val instance = research.factory(this)
@ -260,7 +260,7 @@ class AndroidCapabilityPlayer(@JvmField val ply: Player) : AndroidCapability(ply
val ent = event.`object` val ent = event.`object`
if (ent is Player) { if (ent is Player) {
event.addCapability(MNames.ANDROID_CAPABILITY, AndroidCapabilityPlayer(ent)) event.addCapability(MNames.ANDROID_CAPABILITY_RS, AndroidCapabilityPlayer(ent))
} }
} }

View File

@ -8,16 +8,16 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
import net.minecraft.core.Direction import net.minecraft.core.Direction
import net.minecraft.network.chat.TranslatableComponent import net.minecraft.network.chat.TranslatableComponent
import ru.dbotthepony.mc.otm.block.EnergyCounterBlock import ru.dbotthepony.mc.otm.block.EnergyCounterBlock
import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter import ru.dbotthepony.mc.otm.block.entity.EnergyCounterBlockEntity
import ru.dbotthepony.mc.otm.core.RGBAColor import ru.dbotthepony.mc.otm.core.RGBAColor
import ru.dbotthepony.mc.otm.core.asAngle import ru.dbotthepony.mc.otm.core.asAngle
import ru.dbotthepony.mc.otm.core.times import ru.dbotthepony.mc.otm.core.times
import ru.dbotthepony.mc.otm.menu.FormattingHelper import ru.dbotthepony.mc.otm.menu.FormattingHelper
import kotlin.math.PI import kotlin.math.PI
class EnergyCounterRenderer(private val context: BlockEntityRendererProvider.Context) : BlockEntityRenderer<BlockEntityEnergyCounter> { class EnergyCounterRenderer(private val context: BlockEntityRendererProvider.Context) : BlockEntityRenderer<EnergyCounterBlockEntity> {
override fun render( override fun render(
tile: BlockEntityEnergyCounter, tile: EnergyCounterBlockEntity,
p_112308_: Float, p_112308_: Float,
poseStack: PoseStack, poseStack: PoseStack,
p_112310_: MultiBufferSource, p_112310_: MultiBufferSource,

View File

@ -6,7 +6,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TranslatableComponent import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearch
import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
@ -17,6 +16,7 @@ import ru.dbotthepony.mc.otm.client.render.RenderHelper
import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
import ru.dbotthepony.mc.otm.menu.AndroidStationMenu import ru.dbotthepony.mc.otm.menu.AndroidStationMenu
import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.* import java.util.*
class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: Inventory, p_97743_: Component) : class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: Inventory, p_97743_: Component) :
@ -152,7 +152,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
Arrays.fill(rows, null) Arrays.fill(rows, null)
nextX = 0f nextX = 0f
for (research in Registry.ANDROID_RESEARCH.values) { for (research in MRegistry.ANDROID_RESEARCH.values) {
if (research.prerequisites.size == 0) { if (research.prerequisites.size == 0) {
dive(it, research, 0) dive(it, research, 0)

View File

@ -1,14 +1,14 @@
package ru.dbotthepony.mc.otm.client.screen package ru.dbotthepony.mc.otm.client.screen
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.menu.MatterCapacitorMenu import ru.dbotthepony.mc.otm.menu.MatterCapacitorBankMenu
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel
class MatterCapacitorBankScreen(p_97741_: MatterCapacitorMenu, p_97742_: Inventory, p_97743_: Component) : class MatterCapacitorBankScreen(p_97741_: MatterCapacitorBankMenu, p_97742_: Inventory, p_97743_: Component) :
MatteryScreen<MatterCapacitorMenu>(p_97741_, p_97742_, p_97743_) { MatteryScreen<MatterCapacitorBankMenu>(p_97741_, p_97742_, p_97743_) {
override fun makeMainFrame(): FramePanel { override fun makeMainFrame(): FramePanel {
val frame = super.makeMainFrame()!! val frame = super.makeMainFrame()!!

View File

@ -6,10 +6,10 @@ import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
import ru.dbotthepony.mc.otm.menu.MenuPlatePress import ru.dbotthepony.mc.otm.menu.PlatePressMenu
class PlatePressScreen(menu: MenuPlatePress, inventory: Inventory, title: Component) : class PlatePressScreen(menu: PlatePressMenu, inventory: Inventory, title: Component) :
MatteryScreen<MenuPlatePress>(menu, inventory, title) { MatteryScreen<PlatePressMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel { override fun makeMainFrame(): FramePanel {
val frame = super.makeMainFrame()!! val frame = super.makeMainFrame()!!

View File

@ -5,7 +5,7 @@ import kotlin.jvm.JvmOverloads
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import ru.dbotthepony.mc.otm.block.EnergyCounterBlock import ru.dbotthepony.mc.otm.block.EnergyCounterBlock
import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter import ru.dbotthepony.mc.otm.block.entity.EnergyCounterBlockEntity
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.data.EnumDataContainer import ru.dbotthepony.mc.otm.menu.data.EnumDataContainer
import ru.dbotthepony.mc.otm.menu.data.ImpreciseFractionDataContainer import ru.dbotthepony.mc.otm.menu.data.ImpreciseFractionDataContainer
@ -17,7 +17,7 @@ import java.math.BigDecimal
class EnergyCounterMenu @JvmOverloads constructor( class EnergyCounterMenu @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityEnergyCounter? = null tile: EnergyCounterBlockEntity? = null
) : MatteryMenu(MMenus.ENERGY_COUNTER, p_38852_, inventory, tile) { ) : MatteryMenu(MMenus.ENERGY_COUNTER, p_38852_, inventory, tile) {
val passed = ImpreciseFractionDataContainer() val passed = ImpreciseFractionDataContainer()
val average = ImpreciseFractionDataContainer() val average = ImpreciseFractionDataContainer()
@ -60,7 +60,7 @@ class EnergyCounterMenu @JvmOverloads constructor(
} }
override fun broadcastChanges() { override fun broadcastChanges() {
if (tile is BlockEntityEnergyCounter) { if (tile is EnergyCounterBlockEntity) {
passed.value = tile.passed passed.value = tile.passed
average.value = tile.calcAverage(20) average.value = tile.calcAverage(20)
lastTick.value = tile.lastTick lastTick.value = tile.lastTick

View File

@ -8,7 +8,7 @@ import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus import ru.dbotthepony.mc.otm.registry.MMenus
class MatterCapacitorMenu @JvmOverloads constructor( class MatterCapacitorBankMenu @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: MatterCapacitorBankBlockEntity? = null tile: MatterCapacitorBankBlockEntity? = null

View File

@ -6,7 +6,7 @@ import ru.dbotthepony.mc.otm.block.entity.PlatePressBlockEntity
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus import ru.dbotthepony.mc.otm.registry.MMenus
class MenuPlatePress @JvmOverloads constructor( class PlatePressMenu @JvmOverloads constructor(
containerID: Int, containerID: Int,
inventory: Inventory, inventory: Inventory,
tile: PlatePressBlockEntity? = null tile: PlatePressBlockEntity? = null

View File

@ -87,7 +87,7 @@ object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), Reci
private val LOGGER = LogManager.getLogger() private val LOGGER = LogManager.getLogger()
init { init {
registryName = MNames.PLATE_PRESS registryName = OverdriveThatMatters.loc(MNames.PLATE_PRESS)
} }
override fun fromJson(loc: ResourceLocation, obj: JsonObject): PlatePressRecipe { override fun fromJson(loc: ResourceLocation, obj: JsonObject): PlatePressRecipe {

View File

@ -0,0 +1,25 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.android.AndroidFeature
import ru.dbotthepony.mc.otm.android.feature.AndroidExtendedReach
import ru.dbotthepony.mc.otm.android.feature.AndroidLimbOverclocking
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsRegeneration
object AndroidFeatures {
private val registry = DeferredRegister.create(AndroidFeatureType::class.java, OverdriveThatMatters.MOD_ID)
val AIR_BAGS: AndroidFeatureType<*> by registry.register(MNames.AIR_BAGS) { AndroidFeatureType(::AndroidFeature) }
val LIMB_OVERCLOCKING: AndroidFeatureType<*> by registry.register(MNames.LIMB_OVERCLOCKING) { AndroidFeatureType(::AndroidLimbOverclocking) }
val NANOBOTS_REGENERATION: AndroidFeatureType<*> by registry.register(MNames.NANOBOTS_REGENERATION) { AndroidFeatureType(::AndroidNanobotsRegeneration) }
val NANOBOTS_ARMOR: AndroidFeatureType<*> by registry.register(MNames.NANOBOTS_ARMOR) { AndroidFeatureType(::AndroidNanobotsArmor) }
val EXTENDED_REACH: AndroidFeatureType<*> by registry.register(MNames.EXTENDED_REACH) { AndroidFeatureType(::AndroidExtendedReach) }
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
}
}

View File

@ -0,0 +1,261 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.network.chat.TextComponent
import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.resources.ResourceLocation
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.RegistryObject
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.android.AndroidResearchBuilder
import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor
import ru.dbotthepony.mc.otm.client.render.SkinElement
object AndroidResearch {
val ICONS = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png")
val ICON_TRANSFER: SkinElement
val ICON_ATTACK_BOOST: SkinElement
val ICON_PLASMA_SHIELD_BOOST: SkinElement
val ICON_CLOAK: SkinElement
val ICON_GRAVITATIONAL_STABILIZER: SkinElement
val ICON_AIR_BAGS: SkinElement
val ICON_JUMP_BOOST: SkinElement
val ICON_FEATHER_FALLING: SkinElement
val ICON_ARC: SkinElement
val ICON_ARROW: SkinElement
val ICON_ARMOR: SkinElement
val ICON_NANOBOTS: SkinElement
val ICON_NIGHT_VISION: SkinElement
val ICON_OXYGEN_SUPPLY: SkinElement
val ICON_PLASMA_SHIELD: SkinElement
val ICON_SHOCKWAVE: SkinElement
val ICON_LIMB_OVERCLOCKING: SkinElement
val ICON_STEP_ASSIST: SkinElement
val ICON_ENDER_TELEPORT: SkinElement
val ICON_WIRELESS_CHARGING: SkinElement
val ICON_UNKNOWN: SkinElement
val ICON_EXTENDED_REACH: SkinElement
init {
var x = 0f
var y = 0f
ICON_TRANSFER = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_ATTACK_BOOST = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_PLASMA_SHIELD_BOOST = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_CLOAK = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_GRAVITATIONAL_STABILIZER = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_AIR_BAGS = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_JUMP_BOOST = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
y += 18f
x = 0f
ICON_FEATHER_FALLING = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_ARC = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_ARROW = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_ARMOR = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_NANOBOTS = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_NIGHT_VISION = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_OXYGEN_SUPPLY = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
y += 18
x = 0f
ICON_PLASMA_SHIELD = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_SHOCKWAVE = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_LIMB_OVERCLOCKING = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_STEP_ASSIST = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_ENDER_TELEPORT = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_WIRELESS_CHARGING = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
ICON_UNKNOWN = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
y += 18f
x = 0f
ICON_EXTENDED_REACH = SkinElement(ICONS, x, y, 18f, 18f, 126f, 126f)
x += 18f
}
private val registry = DeferredRegister.create(AndroidResearchType::class.java, OverdriveThatMatters.MOD_ID)
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
}
val AIR_BAGS by registry.register(MNames.AIR_BAGS) {
AndroidResearchBuilder()
.setExperienceCost(18)
.addFeatureResult(AndroidFeatures.AIR_BAGS)
.withDescription()
.withIcon(ICON_AIR_BAGS)
.build()
}
val EXTENDED_REACH by registry.register(MNames.EXTENDED_REACH) {
AndroidResearchBuilder()
.setExperienceCost(40)
.addFeatureResult(AndroidFeatures.EXTENDED_REACH)
.withDescription()
.withIcon(ICON_EXTENDED_REACH)
.build()
}
val NANOBOTS by registry.register(MNames.NANOBOTS) {
AndroidResearchBuilder()
.setExperienceCost(15)
.withDescription()
.withIcon(ICON_NANOBOTS)
.build()
}
val NANOBOTS_ARMOR by registry.register(MNames.NANOBOTS_ARMOR) {
AndroidResearchBuilder()
.setExperienceCost(25)
.withDescription()
.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS))
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR))
.withIcon(ICON_ARMOR)
.build()
}
val LIMB_OVERCLOCKING: List<AndroidResearchType<*>>
val NANOBOTS_ARMOR_SPEED: List<AndroidResearchType<*>>
val NANOBOTS_ARMOR_STRENGTH: List<AndroidResearchType<*>>
val NANOBOTS_REGENERATION: List<AndroidResearchType<*>>
init {
val limbList = ArrayList<RegistryObject<AndroidResearchType<*>>>()
val regenList = ArrayList<RegistryObject<AndroidResearchType<*>>>()
val armorStrengthList = ArrayList<RegistryObject<AndroidResearchType<*>>>()
val armorSpeedList = ArrayList<RegistryObject<AndroidResearchType<*>>>()
for (i in 0 until 4) {
limbList.add(registry.register(MNames.LIMB_OVERCLOCKING_LIST[i]) {
val limbs = AndroidResearchBuilder()
.setExperienceCost(18 + i * 8)
.withIconText(TextComponent((i + 1).toString()))
.withIcon(ICON_LIMB_OVERCLOCKING)
.withName(TranslatableComponent("android_research.overdrive_that_matters.limb_overclocking", i + 1))
.withDescription(
TranslatableComponent(
"android_research.overdrive_that_matters.limb_overclocking.description",
(i + 1) * 8,
(i + 1) * 6
)
)
.addFeatureResult(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING), i)
if (i > 0) {
limbs.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]))
}
limbs.build()
})
regenList.add(registry.register(MNames.NANOBOTS_REGENERATION_LIST[i]) {
val regeneration = AndroidResearchBuilder()
.setExperienceCost(20 + i * 6)
.withIconText(TextComponent((i + 1).toString()))
.withIcon(ICON_NANOBOTS)
.withName(TranslatableComponent("android_research.overdrive_that_matters.nanobots_regeneration", i + 1))
.withDescription(
if (i > 0) TranslatableComponent("android_research.overdrive_that_matters.nanobots_regeneration.description_improve") else TranslatableComponent(
"android_research.overdrive_that_matters.nanobots_regeneration.description"
)
)
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION), i)
if (i > 0) {
regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION_LIST[i - 1]))
} else {
regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS))
}
regeneration.build()
})
}
for (i in 0 until 3) {
val level = i + 1
armorStrengthList.add(registry.register(MNames.NANOBOTS_ARMOR_STRENGTH_LIST[i]) {
AndroidResearchBuilder()
.setExperienceCost(20 + i * 8)
.withIconText(TextComponent((i + 1).toString()))
.withIcon(ICON_ARMOR)
.addPrerequisite(OverdriveThatMatters.loc(if (i > 0) MNames.NANOBOTS_ARMOR_STRENGTH_LIST[i - 1] else MNames.NANOBOTS_ARMOR))
.withName(
TranslatableComponent(
"android_research.overdrive_that_matters.nanobots_armor_strength",
i + 1
)
)
.withDescription(
TranslatableComponent(
"android_research.overdrive_that_matters.nanobots_armor_strength.description",
(i + 1) * 8,
(i + 1) * 6
)
)
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR), 0) { feature ->
if ((feature as AndroidNanobotsArmor).strength < level) feature.strength = level
}
.build()
})
armorSpeedList.add(registry.register(MNames.NANOBOTS_ARMOR_SPEED_LIST[i]) {
AndroidResearchBuilder()
.setExperienceCost(20 + i * 8)
.withIconText(TextComponent((i + 1).toString()))
.withIcon(ICON_ARMOR)
.addPrerequisite(OverdriveThatMatters.loc(if (i > 0) MNames.NANOBOTS_ARMOR_SPEED_LIST[i - 1] else MNames.NANOBOTS_ARMOR))
.withName(
TranslatableComponent(
"android_research.overdrive_that_matters.nanobots_armor_speed",
i + 1
)
)
.withDescription(
TranslatableComponent(
"android_research.overdrive_that_matters.nanobots_armor_speed.description",
(i + 1) * 8,
(i + 1) * 6
)
)
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR), 0) { feature ->
if ((feature as AndroidNanobotsArmor).speed < level) feature.speed = level
}
.build()
})
}
LIMB_OVERCLOCKING = RegistryObjectList(limbList)
NANOBOTS_REGENERATION = RegistryObjectList(regenList)
NANOBOTS_ARMOR_SPEED = RegistryObjectList(armorSpeedList)
NANOBOTS_ARMOR_STRENGTH = RegistryObjectList(armorStrengthList)
}
}

View File

@ -7,7 +7,7 @@ import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
class EMPDamageSource(private val entity: Entity? = null) : DamageSource(Registry.DAMAGE_EMP_NAME) { class EMPDamageSource(private val entity: Entity? = null) : DamageSource(MRegistry.DAMAGE_EMP_NAME) {
init { init {
bypassArmor() bypassArmor()
bypassMagic() bypassMagic()

View File

@ -0,0 +1,24 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraftforge.registries.IForgeRegistryEntry
import net.minecraftforge.registries.RegistryObject
class LazyList<T>(private vararg val getters: () -> T) : AbstractList<T>() {
override val size: Int
get() = getters.size
override fun get(index: Int): T {
return getters[index].invoke()
}
}
class RegistryObjectList<T : IForgeRegistryEntry<T>>(private vararg val getters: RegistryObject<T>) : AbstractList<T>() {
constructor(getters: List<RegistryObject<T>>) : this(*getters.toTypedArray())
override val size: Int
get() = getters.size
override fun get(index: Int): T {
return getters[index].get()
}
}

View File

@ -0,0 +1,56 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers
import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.entity.*
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
import ru.dbotthepony.mc.otm.client.render.BlackHoleRenderer
import ru.dbotthepony.mc.otm.client.render.EnergyCounterRenderer
import ru.dbotthepony.mc.otm.client.render.GravitationStabilizerRenderer
object MBlockEntities {
private val registry = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, OverdriveThatMatters.MOD_ID)
val ANDROID_STATION: BlockEntityType<*> by registry.register(MNames.ANDROID_STATION) { BlockEntityType.Builder.of(::AndroidStationBlockEntity, MBlocks.ANDROID_STATION).build(null) }
val BATTERY_BANK: BlockEntityType<*> by registry.register(MNames.BATTERY_BANK) { BlockEntityType.Builder.of(::BatteryBankBlockEntity, MBlocks.BATTERY_BANK).build(null) }
val MATTER_DECOMPOSER: BlockEntityType<*> by registry.register(MNames.MATTER_DECOMPOSER) { BlockEntityType.Builder.of(::MatterDecomposerBlockEntity, MBlocks.MATTER_DECOMPOSER).build(null) }
val MATTER_CAPACITOR_BANK: BlockEntityType<*> by registry.register(MNames.MATTER_CAPACITOR_BANK) { BlockEntityType.Builder.of(::MatterCapacitorBankBlockEntity, MBlocks.MATTER_CAPACITOR_BANK).build(null) }
val MATTER_CABLE: BlockEntityType<*> by registry.register(MNames.MATTER_CABLE) { BlockEntityType.Builder.of(::MatterCableBlockEntity, MBlocks.MATTER_CABLE).build(null) }
val PATTERN_STORAGE: BlockEntityType<*> by registry.register(MNames.PATTERN_STORAGE) { BlockEntityType.Builder.of(::PatternStorageBlockEntity, MBlocks.PATTERN_STORAGE).build(null) }
val MATTER_SCANNER: BlockEntityType<*> by registry.register(MNames.MATTER_SCANNER) { BlockEntityType.Builder.of(::MatterScannerBlockEntity, MBlocks.MATTER_SCANNER).build(null) }
val MATTER_PANEL: BlockEntityType<*> by registry.register(MNames.MATTER_PANEL) { BlockEntityType.Builder.of(::MatterPanelBlockEntity, MBlocks.MATTER_PANEL).build(null) }
val MATTER_REPLICATOR: BlockEntityType<*> by registry.register(MNames.MATTER_REPLICATOR) { BlockEntityType.Builder.of(::MatterReplicatorBlockEntity, MBlocks.MATTER_REPLICATOR).build(null) }
val MATTER_BOTTLER: BlockEntityType<*> by registry.register(MNames.MATTER_BOTTLER) { BlockEntityType.Builder.of(::MatterBottlerBlockEntity, MBlocks.MATTER_BOTTLER).build(null) }
val DRIVE_VIEWER: BlockEntityType<*> by registry.register(MNames.DRIVE_VIEWER) { BlockEntityType.Builder.of(::DriveViewerBlockEntity, MBlocks.DRIVE_VIEWER).build(null) }
val BLACK_HOLE: BlockEntityType<*> by registry.register(MNames.BLACK_HOLE) { BlockEntityType.Builder.of(::BlackHoleBlockEntity, MBlocks.BLACK_HOLE).build(null) }
val CARGO_CRATE: BlockEntityType<*> by registry.register(MNames.CARGO_CRATE) { BlockEntityType.Builder.of(::CargoCrateBlockEntity, MBlocks.CARGO_CRATE).build(null) }
val DRIVE_RACK: BlockEntityType<*> by registry.register(MNames.DRIVE_RACK) { BlockEntityType.Builder.of(::DriveRackBlockEntity, MBlocks.DRIVE_RACK).build(null) }
val ITEM_MONITOR: BlockEntityType<*> by registry.register(MNames.ITEM_MONITOR) { BlockEntityType.Builder.of(::ItemMonitorBlockEntity, MBlocks.ITEM_MONITOR).build(null) }
val ENERGY_COUNTER: BlockEntityType<*> by registry.register(MNames.ENERGY_COUNTER) { BlockEntityType.Builder.of(::EnergyCounterBlockEntity, MBlocks.ENERGY_COUNTER).build(null) }
val CHEMICAL_GENERATOR: BlockEntityType<*> by registry.register(MNames.CHEMICAL_GENERATOR) { BlockEntityType.Builder.of(::ChemicalGeneratorBlockEntity, MBlocks.CHEMICAL_GENERATOR).build(null) }
val PLATE_PRESS: BlockEntityType<*> by registry.register(MNames.PLATE_PRESS) { BlockEntityType.Builder.of(::PlatePressBlockEntity, MBlocks.PLATE_PRESS).build(null) }
val GRAVITATION_STABILIZER: BlockEntityType<*> by registry.register(MNames.GRAVITATION_STABILIZER) { BlockEntityType.Builder.of(::GravitationStabilizerBlockEntity, MBlocks.GRAVITATION_STABILIZER).build(null) }
val MATTER_RECYCLER: BlockEntityType<*> by registry.register(MNames.MATTER_RECYCLER) { BlockEntityType.Builder.of(::MatterRecyclerBlockEntity, MBlocks.MATTER_RECYCLER).build(null) }
val DEBUG_EXPLOSION_SMALL: BlockEntityType<*> by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockEntityType.Builder.of(::BlockEntityExplosionDebugger, MBlocks.DEBUG_EXPLOSION_SMALL).build(null) }
val DEBUG_SPHERE_POINTS: BlockEntityType<*> by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockEntityType.Builder.of(::BlockEntitySphereDebugger, MBlocks.DEBUG_SPHERE_POINTS).build(null) }
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
FMLJavaModLoadingContext.get().modEventBus.addListener(this::registerClient)
}
@Suppress("unchecked_cast")
private fun registerClient(event: FMLClientSetupEvent) {
BlockEntityRenderers.register(BLACK_HOLE as BlockEntityType<BlackHoleBlockEntity>, ::BlackHoleRenderer)
BlockEntityRenderers.register(GRAVITATION_STABILIZER as BlockEntityType<GravitationStabilizerBlockEntity>, ::GravitationStabilizerRenderer)
BlockEntityRenderers.register(ENERGY_COUNTER as BlockEntityType<EnergyCounterBlockEntity>, ::EnergyCounterRenderer)
}
}

View File

@ -0,0 +1,203 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.client.renderer.ItemBlockRenderTypes
import net.minecraft.client.renderer.RenderType
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.OreBlock
import net.minecraft.world.level.block.SoundType
import net.minecraft.world.level.block.state.BlockBehaviour
import net.minecraft.world.level.material.Material
import net.minecraft.world.level.material.MaterialColor
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.*
object MBlocks {
private val registry = DeferredRegister.create(ForgeRegistries.BLOCKS, OverdriveThatMatters.MOD_ID)
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
FMLJavaModLoadingContext.get().modEventBus.addListener(this::registerClient)
}
private fun registerClient(event: FMLClientSetupEvent) {
val translucent = RenderType.translucent()
for (block in INDUSTRIAL_GLASS_LIST) {
ItemBlockRenderTypes.setRenderLayer(block, translucent)
}
for (block in INDUSTRIAL_GLASS_PANE_LIST) {
ItemBlockRenderTypes.setRenderLayer(block, translucent)
}
}
val ANDROID_STATION: Block by registry.register(MNames.ANDROID_STATION) { AndroidStationBlock() }
val BATTERY_BANK: Block by registry.register(MNames.BATTERY_BANK) { BatteryBankBlock() }
val MATTER_DECOMPOSER: Block by registry.register(MNames.MATTER_DECOMPOSER) { MatterDecomposerBlock() }
val MATTER_CAPACITOR_BANK: Block by registry.register(MNames.MATTER_CAPACITOR_BANK) { MatterCapacitorBankBlock() }
val MATTER_CABLE: Block by registry.register(MNames.MATTER_CABLE) { BlockMatterCable() }
val PATTERN_STORAGE: Block by registry.register(MNames.PATTERN_STORAGE) { PatternStorageBlock() }
val MATTER_SCANNER: Block by registry.register(MNames.MATTER_SCANNER) { MatterScannerBlock() }
val MATTER_PANEL: Block by registry.register(MNames.MATTER_PANEL) { MatterPanelBlock() }
val MATTER_REPLICATOR: Block by registry.register(MNames.MATTER_REPLICATOR) { MatterReplicatorBlock() }
val MATTER_BOTTLER: Block by registry.register(MNames.MATTER_BOTTLER) { MatterBottlerBlock() }
val DRIVE_VIEWER: Block by registry.register(MNames.DRIVE_VIEWER) { DriveViewerBlock() }
val CARGO_CRATE: Block by registry.register(MNames.CARGO_CRATE) { CargoCrateBlock() }
val DRIVE_RACK: Block by registry.register(MNames.DRIVE_RACK) { DriveRackBlock() }
val ITEM_MONITOR: Block by registry.register(MNames.ITEM_MONITOR) { ItemMonitorBlock() }
val ENERGY_COUNTER: Block by registry.register(MNames.ENERGY_COUNTER) { EnergyCounterBlock() }
val CHEMICAL_GENERATOR: Block by registry.register(MNames.CHEMICAL_GENERATOR) { ChemicalGeneratorBlock() }
val PLATE_PRESS: Block by registry.register(MNames.PLATE_PRESS) { PlatePressBlock() }
val MATTER_RECYCLER: Block by registry.register(MNames.MATTER_RECYCLER) { MatterRecyclerBlock() }
val DEBUG_EXPLOSION_SMALL: Block by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockExplosionDebugger() }
val DEBUG_SPHERE_POINTS: Block by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockSphereDebugger() }
val BLACK_HOLE: Block by registry.register(MNames.BLACK_HOLE) { BlackHoleBlock() }
val GRAVITATION_STABILIZER: Block by registry.register(MNames.GRAVITATION_STABILIZER) { BlockGravitationStabilizer() }
val GRAVITATION_STABILIZER_LENS: Block by registry.register(MNames.GRAVITATION_STABILIZER_LENS) { BlockGravitationStabilizerLens() }
val TRITANIUM_ORE: Block by registry.register(MNames.TRITANIUM_ORE) { OreBlock(
BlockBehaviour.Properties.of(Material.STONE)
.strength(3.25f, 6.0f)
.requiresCorrectToolForDrops(),
UniformInt.of(0, 3)
) }
val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { OreBlock(
BlockBehaviour.Properties.of(Material.STONE)
.strength(4.75f, 6.5f)
.requiresCorrectToolForDrops(),
UniformInt.of(0, 3)
) }
val TRITANIUM_RAW_BLOCK: Block by registry.register(MNames.TRITANIUM_RAW_BLOCK) { Block(
BlockBehaviour.Properties.of(Material.STONE)
.strength(8.0f, 10f)
.requiresCorrectToolForDrops()
) }
val TRITANIUM_BLOCK: Block by registry.register(MNames.TRITANIUM_BLOCK) { Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f)
) }
val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f)
) }
val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(40f)
.strength(3f)
) }
val CRATE_RED: Block by registry.register(MRegistry.CRATE_RED.name) { MRegistry.CRATE_RED.makeBlock() }
val CRATE_BLUE: Block by registry.register(MRegistry.CRATE_BLUE.name) { MRegistry.CRATE_BLUE.makeBlock() }
val CRATE_YELLOW: Block by registry.register(MRegistry.CRATE_YELLOW.name) { MRegistry.CRATE_YELLOW.makeBlock() }
val CRATE_GREEN: Block by registry.register(MRegistry.CRATE_GREEN.name) { MRegistry.CRATE_GREEN.makeBlock() }
val CRATE_BLACK: Block by registry.register(MRegistry.CRATE_BLACK.name) { MRegistry.CRATE_BLACK.makeBlock() }
val CRATE_PINK: Block by registry.register(MRegistry.CRATE_PINK.name) { MRegistry.CRATE_PINK.makeBlock() }
val CRATE_PURPLE: Block by registry.register(MRegistry.CRATE_PURPLE.name) { MRegistry.CRATE_PURPLE.makeBlock() }
val CRATE_LIST = LazyList(
{ CRATE_RED },
{ CRATE_BLUE },
{ CRATE_YELLOW },
{ CRATE_GREEN },
{ CRATE_BLACK },
{ CRATE_PINK },
{ CRATE_PURPLE },
)
val INDUSTRIAL_GLASS: Block by registry.register(MRegistry.INDUSTRIAL_GLASS.name) { MRegistry.INDUSTRIAL_GLASS.makeBlock() }
val INDUSTRIAL_GLASS_WHITE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.name) { MRegistry.INDUSTRIAL_GLASS_WHITE.makeBlock() }
val INDUSTRIAL_GLASS_ORANGE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.name) { MRegistry.INDUSTRIAL_GLASS_ORANGE.makeBlock() }
val INDUSTRIAL_GLASS_MAGENTA: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_MAGENTA.name) { MRegistry.INDUSTRIAL_GLASS_MAGENTA.makeBlock() }
val INDUSTRIAL_GLASS_LIGHT_BLUE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.name) { MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.makeBlock() }
val INDUSTRIAL_GLASS_YELLOW: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_YELLOW.name) { MRegistry.INDUSTRIAL_GLASS_YELLOW.makeBlock() }
val INDUSTRIAL_GLASS_LIME: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIME.name) { MRegistry.INDUSTRIAL_GLASS_LIME.makeBlock() }
val INDUSTRIAL_GLASS_PINK: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_PINK.name) { MRegistry.INDUSTRIAL_GLASS_PINK.makeBlock() }
val INDUSTRIAL_GLASS_GRAY: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_GRAY.name) { MRegistry.INDUSTRIAL_GLASS_GRAY.makeBlock() }
val INDUSTRIAL_GLASS_LIGHT_GRAY: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.name) { MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.makeBlock() }
val INDUSTRIAL_GLASS_CYAN: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_CYAN.name) { MRegistry.INDUSTRIAL_GLASS_CYAN.makeBlock() }
val INDUSTRIAL_GLASS_PURPLE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_PURPLE.name) { MRegistry.INDUSTRIAL_GLASS_PURPLE.makeBlock() }
val INDUSTRIAL_GLASS_BLUE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BLUE.name) { MRegistry.INDUSTRIAL_GLASS_BLUE.makeBlock() }
val INDUSTRIAL_GLASS_BROWN: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BROWN.name) { MRegistry.INDUSTRIAL_GLASS_BROWN.makeBlock() }
val INDUSTRIAL_GLASS_GREEN: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_GREEN.name) { MRegistry.INDUSTRIAL_GLASS_GREEN.makeBlock() }
val INDUSTRIAL_GLASS_RED: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_RED.name) { MRegistry.INDUSTRIAL_GLASS_RED.makeBlock() }
val INDUSTRIAL_GLASS_BLACK: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BLACK.name) { MRegistry.INDUSTRIAL_GLASS_BLACK.makeBlock() }
val INDUSTRIAL_GLASS_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS.namePane) { MRegistry.INDUSTRIAL_GLASS.makePaneBlock() }
val INDUSTRIAL_GLASS_WHITE_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.namePane) { MRegistry.INDUSTRIAL_GLASS_WHITE.makePaneBlock() }
val INDUSTRIAL_GLASS_ORANGE_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.namePane) { MRegistry.INDUSTRIAL_GLASS_ORANGE.makePaneBlock() }
val INDUSTRIAL_GLASS_MAGENTA_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_MAGENTA.namePane) { MRegistry.INDUSTRIAL_GLASS_MAGENTA.makePaneBlock() }
val INDUSTRIAL_GLASS_LIGHT_BLUE_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.namePane) { MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.makePaneBlock() }
val INDUSTRIAL_GLASS_YELLOW_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_YELLOW.namePane) { MRegistry.INDUSTRIAL_GLASS_YELLOW.makePaneBlock() }
val INDUSTRIAL_GLASS_LIME_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIME.namePane) { MRegistry.INDUSTRIAL_GLASS_LIME.makePaneBlock() }
val INDUSTRIAL_GLASS_PINK_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_PINK.namePane) { MRegistry.INDUSTRIAL_GLASS_PINK.makePaneBlock() }
val INDUSTRIAL_GLASS_GRAY_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_GRAY.namePane) { MRegistry.INDUSTRIAL_GLASS_GRAY.makePaneBlock() }
val INDUSTRIAL_GLASS_LIGHT_GRAY_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.namePane) { MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.makePaneBlock() }
val INDUSTRIAL_GLASS_CYAN_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_CYAN.namePane) { MRegistry.INDUSTRIAL_GLASS_CYAN.makePaneBlock() }
val INDUSTRIAL_GLASS_PURPLE_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_PURPLE.namePane) { MRegistry.INDUSTRIAL_GLASS_PURPLE.makePaneBlock() }
val INDUSTRIAL_GLASS_BLUE_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BLUE.namePane) { MRegistry.INDUSTRIAL_GLASS_BLUE.makePaneBlock() }
val INDUSTRIAL_GLASS_BROWN_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BROWN.namePane) { MRegistry.INDUSTRIAL_GLASS_BROWN.makePaneBlock() }
val INDUSTRIAL_GLASS_GREEN_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_GREEN.namePane) { MRegistry.INDUSTRIAL_GLASS_GREEN.makePaneBlock() }
val INDUSTRIAL_GLASS_RED_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_RED.namePane) { MRegistry.INDUSTRIAL_GLASS_RED.makePaneBlock() }
val INDUSTRIAL_GLASS_BLACK_PANE: Block by registry.register(MRegistry.INDUSTRIAL_GLASS_BLACK.namePane) { MRegistry.INDUSTRIAL_GLASS_BLACK.makePaneBlock() }
val INDUSTRIAL_GLASS_LIST = LazyList(
{ INDUSTRIAL_GLASS },
{ INDUSTRIAL_GLASS_WHITE },
{ INDUSTRIAL_GLASS_ORANGE },
{ INDUSTRIAL_GLASS_MAGENTA },
{ INDUSTRIAL_GLASS_LIGHT_BLUE },
{ INDUSTRIAL_GLASS_YELLOW },
{ INDUSTRIAL_GLASS_LIME },
{ INDUSTRIAL_GLASS_PINK },
{ INDUSTRIAL_GLASS_GRAY },
{ INDUSTRIAL_GLASS_LIGHT_GRAY },
{ INDUSTRIAL_GLASS_CYAN },
{ INDUSTRIAL_GLASS_PURPLE },
{ INDUSTRIAL_GLASS_BLUE },
{ INDUSTRIAL_GLASS_BROWN },
{ INDUSTRIAL_GLASS_GREEN },
{ INDUSTRIAL_GLASS_RED },
{ INDUSTRIAL_GLASS_BLACK },
)
val INDUSTRIAL_GLASS_PANE_LIST = LazyList(
{ INDUSTRIAL_GLASS_PANE },
{ INDUSTRIAL_GLASS_WHITE_PANE },
{ INDUSTRIAL_GLASS_ORANGE_PANE },
{ INDUSTRIAL_GLASS_MAGENTA_PANE },
{ INDUSTRIAL_GLASS_LIGHT_BLUE_PANE },
{ INDUSTRIAL_GLASS_YELLOW_PANE },
{ INDUSTRIAL_GLASS_LIME_PANE },
{ INDUSTRIAL_GLASS_PINK_PANE },
{ INDUSTRIAL_GLASS_GRAY_PANE },
{ INDUSTRIAL_GLASS_LIGHT_GRAY_PANE },
{ INDUSTRIAL_GLASS_CYAN_PANE },
{ INDUSTRIAL_GLASS_PURPLE_PANE },
{ INDUSTRIAL_GLASS_BLUE_PANE },
{ INDUSTRIAL_GLASS_BROWN_PANE },
{ INDUSTRIAL_GLASS_GREEN_PANE },
{ INDUSTRIAL_GLASS_RED_PANE },
{ INDUSTRIAL_GLASS_BLACK_PANE },
)
}

View File

@ -0,0 +1,307 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.tags.BlockTags
import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.food.FoodProperties
import net.minecraft.world.item.*
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block
import net.minecraftforge.common.ForgeTier
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.item.*
object MItems {
private val DEFAULT_PROPERTIES = Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
private val registry = DeferredRegister.create(ForgeRegistries.ITEMS, OverdriveThatMatters.MOD_ID)
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
}
val ANDROID_STATION: Item by registry.register(MNames.ANDROID_STATION) { BlockItem(MBlocks.ANDROID_STATION, DEFAULT_PROPERTIES) }
val BATTERY_BANK: Item by registry.register(MNames.BATTERY_BANK) { BlockItem(MBlocks.BATTERY_BANK, DEFAULT_PROPERTIES) }
val MATTER_DECOMPOSER: Item by registry.register(MNames.MATTER_DECOMPOSER) { BlockItem(MBlocks.MATTER_DECOMPOSER, DEFAULT_PROPERTIES) }
val MATTER_CAPACITOR_BANK: Item by registry.register(MNames.MATTER_CAPACITOR_BANK) { BlockItem(MBlocks.MATTER_CAPACITOR_BANK, DEFAULT_PROPERTIES) }
val MATTER_CABLE: Item by registry.register(MNames.MATTER_CABLE) { BlockItem(MBlocks.MATTER_CABLE, DEFAULT_PROPERTIES) }
val PATTERN_STORAGE: Item by registry.register(MNames.PATTERN_STORAGE) { BlockItem(MBlocks.PATTERN_STORAGE, DEFAULT_PROPERTIES) }
val MATTER_SCANNER: Item by registry.register(MNames.MATTER_SCANNER) { BlockItem(MBlocks.MATTER_SCANNER, DEFAULT_PROPERTIES) }
val MATTER_PANEL: Item by registry.register(MNames.MATTER_PANEL) { BlockItem(MBlocks.MATTER_PANEL, DEFAULT_PROPERTIES) }
val MATTER_REPLICATOR: Item by registry.register(MNames.MATTER_REPLICATOR) { BlockItem(MBlocks.MATTER_REPLICATOR, DEFAULT_PROPERTIES) }
val MATTER_BOTTLER: Item by registry.register(MNames.MATTER_BOTTLER) { BlockItem(MBlocks.MATTER_BOTTLER, DEFAULT_PROPERTIES) }
val DRIVE_VIEWER: Item by registry.register(MNames.DRIVE_VIEWER) { BlockItem(MBlocks.DRIVE_VIEWER, DEFAULT_PROPERTIES) }
val CARGO_CRATE: Item by registry.register(MNames.CARGO_CRATE) { BlockItem(MBlocks.CARGO_CRATE, DEFAULT_PROPERTIES) }
val TRITANIUM_ORE: Item by registry.register(MNames.TRITANIUM_ORE) { BlockItem(MBlocks.TRITANIUM_ORE, DEFAULT_PROPERTIES) }
val DEEPSLATE_TRITANIUM_ORE: Item by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { BlockItem(MBlocks.DEEPSLATE_TRITANIUM_ORE, DEFAULT_PROPERTIES) }
val TRITANIUM_RAW_BLOCK: Item by registry.register(MNames.TRITANIUM_RAW_BLOCK) { BlockItem(MBlocks.TRITANIUM_RAW_BLOCK, DEFAULT_PROPERTIES) }
val DRIVE_RACK: Item by registry.register(MNames.DRIVE_RACK) { BlockItem(MBlocks.DRIVE_RACK, DEFAULT_PROPERTIES) }
val ITEM_MONITOR: Item by registry.register(MNames.ITEM_MONITOR) { BlockItem(MBlocks.ITEM_MONITOR, DEFAULT_PROPERTIES) }
val ENERGY_COUNTER: Item by registry.register(MNames.ENERGY_COUNTER) { BlockItem(MBlocks.ENERGY_COUNTER, DEFAULT_PROPERTIES) }
val CHEMICAL_GENERATOR: Item by registry.register(MNames.CHEMICAL_GENERATOR) { BlockItem(MBlocks.CHEMICAL_GENERATOR, DEFAULT_PROPERTIES) }
val PLATE_PRESS: Item by registry.register(MNames.PLATE_PRESS) { BlockItem(MBlocks.PLATE_PRESS, DEFAULT_PROPERTIES) }
val MATTER_RECYCLER: Item by registry.register(MNames.MATTER_RECYCLER) { BlockItem(MBlocks.MATTER_RECYCLER, DEFAULT_PROPERTIES) }
val GRAVITATION_STABILIZER: Item by registry.register(MNames.GRAVITATION_STABILIZER) {
object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) {
override fun appendHoverText(
p_40572_: ItemStack,
p_40573_: Level?,
p_40574_: MutableList<Component>,
p_40575_: TooltipFlag
) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_)
p_40574_.add(TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc").withStyle(ChatFormatting.GRAY))
p_40574_.add(TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc2").withStyle(ChatFormatting.DARK_GRAY))
p_40574_.add(TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc3").withStyle(ChatFormatting.DARK_GRAY))
p_40574_.add(TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer.desc4").withStyle(ChatFormatting.DARK_GRAY))
}
}
}
val DEBUG_EXPLOSION_SMALL: Item by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockItem(MBlocks.DEBUG_EXPLOSION_SMALL, DEFAULT_PROPERTIES) }
val DEBUG_SPHERE_POINTS: Item by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockItem(MBlocks.DEBUG_SPHERE_POINTS, DEFAULT_PROPERTIES) }
val MATTER_DUST: Item by registry.register(MNames.MATTER_DUST) { MatterDustItem() }
val TRITANIUM_ORE_CLUMP: Item by registry.register(MNames.TRITANIUM_ORE_CLUMP) { Item(DEFAULT_PROPERTIES) }
val TRITANIUM_INGOT: Item by registry.register(MNames.TRITANIUM_INGOT) { Item(DEFAULT_PROPERTIES) }
val TRITANIUM_COMPONENT: ForgeTier
init {
TRITANIUM_COMPONENT = ForgeTier(
Tiers.IRON.level,
3072,
Tiers.IRON.speed * 1.1f,
3.5f,
16,
BlockTags.NEEDS_IRON_TOOL
) { Ingredient.of(TRITANIUM_INGOT) }
}
private val TOOLS_PROPRTIES = Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
val TRITANIUM_SWORD: Item by registry.register(MNames.TRITANIUM_SWORD) { SwordItem(TRITANIUM_COMPONENT, 4, -2.7f, TOOLS_PROPRTIES) }
val TRITANIUM_SHOVEL: Item by registry.register(MNames.TRITANIUM_SHOVEL) { ShovelItem(TRITANIUM_COMPONENT, 1.5f, -2.4f, TOOLS_PROPRTIES) }
val TRITANIUM_AXE: Item by registry.register(MNames.TRITANIUM_AXE) { AxeItem(TRITANIUM_COMPONENT, 8.5f, -3.4f, TOOLS_PROPRTIES) }
val TRITANIUM_PICKAXE: Item by registry.register(MNames.TRITANIUM_PICKAXE) { PickaxeItem(TRITANIUM_COMPONENT, 2, -2.8f, TOOLS_PROPRTIES) }
val TRITANIUM_HOE: Item by registry.register(MNames.TRITANIUM_HOE) { HoeItem(TRITANIUM_COMPONENT, 0, -3.4f, TOOLS_PROPRTIES) }
val TRITANIUM_TOOLS = LazyList(
{ TRITANIUM_SWORD },
{ TRITANIUM_SHOVEL },
{ TRITANIUM_AXE },
{ TRITANIUM_PICKAXE },
{ TRITANIUM_HOE }
)
val TRITANIUM_HELMET: Item by registry.register(MNames.TRITANIUM_HELMET) { ItemTritaniumArmor(EquipmentSlot.HEAD) }
val TRITANIUM_CHESTPLATE: Item by registry.register(MNames.TRITANIUM_CHESTPLATE) { ItemTritaniumArmor(EquipmentSlot.CHEST) }
val TRITANIUM_PANTS: Item by registry.register(MNames.TRITANIUM_PANTS) { ItemTritaniumArmor(EquipmentSlot.LEGS) }
val TRITANIUM_BOOTS: Item by registry.register(MNames.TRITANIUM_BOOTS) { ItemTritaniumArmor(EquipmentSlot.FEET) }
val TRITANIUM_ARMOR = LazyList(
{ TRITANIUM_HELMET },
{ TRITANIUM_CHESTPLATE },
{ TRITANIUM_PANTS },
{ TRITANIUM_BOOTS }
)
val ENERGY_SWORD: Item by registry.register(MNames.ENERGY_SWORD) { EnergySwordItem() }
val MATTER_IO_PORT: Item by registry.register(MNames.MATTER_IO_PORT) { Item(DEFAULT_PROPERTIES) }
val MATTER_TRANSFORM_MATRIX: Item by registry.register(MNames.MATTER_TRANSFORM_MATRIX) { Item(DEFAULT_PROPERTIES) }
val ENERGY_BUS: Item by registry.register(MNames.ENERGY_BUS) { Item(DEFAULT_PROPERTIES) }
val ELECTRIC_PARTS: Item by registry.register(MNames.ELECTRIC_PARTS) { Item(DEFAULT_PROPERTIES) }
val MACHINE_FRAME: Item by registry.register(MNames.MACHINE_FRAME) { Item(DEFAULT_PROPERTIES) }
val TRITANIUM_PLATE: Item by registry.register(MNames.TRITANIUM_PLATE) { Item(DEFAULT_PROPERTIES) }
val IRON_PLATE: Item by registry.register(MNames.IRON_PLATE) { Item(DEFAULT_PROPERTIES) }
val COPPER_WIRING: Item by registry.register(MNames.COPPER_WIRING) { Item(DEFAULT_PROPERTIES) }
val GOLD_WIRING: Item by registry.register(MNames.GOLD_WIRING) { Item(DEFAULT_PROPERTIES) }
val PORTABLE_CONDENSATION_DRIVE_CASING: Item by registry.register(MNames.PORTABLE_CONDENSATION_DRIVE_CASING) { Item(DEFAULT_PROPERTIES) }
val PORTABLE_DENSE_CONDENSATION_DRIVE_CASING: Item by registry.register(MNames.PORTABLE_DENSE_CONDENSATION_DRIVE_CASING) { Item(DEFAULT_PROPERTIES) }
val CIRCUIT_PLATING: Item by registry.register(MNames.CIRCUIT_PLATING) { Item(DEFAULT_PROPERTIES) }
val BASIC_CONTROL_CIRCUIT: Item by registry.register(MNames.BASIC_CONTROL_CIRCUIT) { Item(DEFAULT_PROPERTIES) }
val ADVANCED_CONTROL_CIRCUIT: Item by registry.register(MNames.ADVANCED_CONTROL_CIRCUIT) { Item(DEFAULT_PROPERTIES) }
val BLACK_HOLE_SCANNER: Item by registry.register(MNames.BLACK_HOLE_SCANNER) {
object : Item(DEFAULT_PROPERTIES) {
override fun appendHoverText(
p_41421_: ItemStack,
p_41422_: Level?,
p_41423_: MutableList<Component>,
p_41424_: TooltipFlag
) {
p_41423_.add(TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc").withStyle(ChatFormatting.GRAY))
p_41423_.add(TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc2").withStyle(ChatFormatting.DARK_GRAY))
}
}
}
val GRAVITATION_FIELD_LIMITER: Item by registry.register(MNames.GRAVITATION_FIELD_LIMITER) { Item(DEFAULT_PROPERTIES) }
val GRAVITATION_FIELD_SENSOR: Item by registry.register(MNames.GRAVITATION_FIELD_SENSOR) { Item(DEFAULT_PROPERTIES) }
val PORTABLE_GRAVITATION_STABILIZER: Item by registry.register(MNames.PORTABLE_GRAVITATION_STABILIZER) { ItemPortableGravitationStabilizer() }
val BLACK_HOLE: Item by registry.register(MNames.BLACK_HOLE) { BlockItem(MBlocks.BLACK_HOLE, DEFAULT_PROPERTIES) }
val GRAVITATIONAL_DISRUPTOR: Item by registry.register(MNames.GRAVITATIONAL_DISRUPTOR) { GravitationalDisruptorItem() }
val PILL_ANDROID: Item by registry.register(MNames.PILL_ANDROID) { PillItem(PillType.BECOME_ANDROID) }
val PILL_HUMANE: Item by registry.register(MNames.PILL_HUMANE) { PillItem(PillType.BECOME_HUMANE) }
val PILL_OBLIVION: Item by registry.register(MNames.PILL_OBLIVION) { PillItem(PillType.OBLIVION) }
val PILL_HEAL: Item by registry.register(MNames.PILL_HEAL) { HealPillItem() }
val BATTERY_CRUDE: Item by registry.register(MNames.BATTERY_CRUDE) { BatteryItem(ImpreciseFraction(30_000), ImpreciseFraction(150), ImpreciseFraction(150)) }
val BATTERY_BASIC: Item by registry.register(MNames.BATTERY_BASIC) { BatteryItem(ImpreciseFraction(60_000), ImpreciseFraction(300), ImpreciseFraction(300)) }
val BATTERY_NORMAL: Item by registry.register(MNames.BATTERY_NORMAL) { BatteryItem(ImpreciseFraction(250_000), ImpreciseFraction(1000), ImpreciseFraction(1000)) }
val BATTERY_DENSE: Item by registry.register(MNames.BATTERY_DENSE) { BatteryItem(ImpreciseFraction(1_000_000), ImpreciseFraction(2000), ImpreciseFraction(2000)) }
val BATTERY_CAPACITOR: Item by registry.register(MNames.BATTERY_CAPACITOR) { BatteryItem(ImpreciseFraction(150_000), ImpreciseFraction(15000), ImpreciseFraction(15000)) }
val BATTERY_CREATIVE: Item by registry.register(MNames.BATTERY_CREATIVE) { BatteryItem() }
val BATTERIES = LazyList(
{ BATTERY_CRUDE },
{ BATTERY_BASIC },
{ BATTERY_NORMAL },
{ BATTERY_DENSE },
{ BATTERY_CAPACITOR },
)
val MATTER_CAPACITOR_PARTS: Item by registry.register(MNames.MATTER_CAPACITOR_PARTS) { Item(DEFAULT_PROPERTIES) }
val DATAGEN_COMPONENTS = LazyList(
{ ENERGY_BUS },
{ ELECTRIC_PARTS },
{ TRITANIUM_PLATE },
{ IRON_PLATE },
{ COPPER_WIRING },
{ GOLD_WIRING },
{ CIRCUIT_PLATING },
{ BASIC_CONTROL_CIRCUIT },
{ ADVANCED_CONTROL_CIRCUIT },
{ MATTER_CAPACITOR_PARTS },
{ MATTER_IO_PORT },
{ MATTER_TRANSFORM_MATRIX },
)
val MATTER_CAPACITOR_BASIC: Item by registry.register(MNames.MATTER_CAPACITOR_BASIC) { MatterCapacitorItem(ImpreciseFraction("4")) }
val MATTER_CAPACITOR_NORMAL: Item by registry.register(MNames.MATTER_CAPACITOR_NORMAL) { MatterCapacitorItem(ImpreciseFraction("10")) }
val MATTER_CAPACITOR_DENSE: Item by registry.register(MNames.MATTER_CAPACITOR_DENSE) { MatterCapacitorItem(ImpreciseFraction("40")) }
val MATTER_CAPACITOR_CREATIVE: Item by registry.register(MNames.MATTER_CAPACITOR_CREATIVE) { MatterCapacitorItem() }
val PATTERN_DRIVE_NORMAL: Item by registry.register(MNames.PATTERN_DRIVE_NORMAL) { PatternStorageItem(4) }
val PATTERN_DRIVE_CREATIVE: Item by registry.register(MNames.PATTERN_DRIVE_CREATIVE) { PatternStorageItem() }
val PORTABLE_CONDENSATION_DRIVE: Item by registry.register(MNames.PORTABLE_CONDENSATION_DRIVE) { PortableCondensationDriveItem(4000) }
val PORTABLE_DENSE_CONDENSATION_DRIVE: Item by registry.register(MNames.PORTABLE_DENSE_CONDENSATION_DRIVE) { PortableCondensationDriveItem(25000) }
val NUTRIENT_PASTE: Item by registry.register(MNames.NUTRIENT_PASTE) { Item(Item.Properties().stacksTo(64).food(
FoodProperties.Builder().meat().nutrition(8).saturationMod(0.9F).build()).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) }
val CRATE_RED: Item by registry.register(MRegistry.CRATE_RED.name) { BlockItem(MBlocks.CRATE_RED, DEFAULT_PROPERTIES) }
val CRATE_BLUE: Item by registry.register(MRegistry.CRATE_BLUE.name) { BlockItem(MBlocks.CRATE_BLUE, DEFAULT_PROPERTIES) }
val CRATE_YELLOW: Item by registry.register(MRegistry.CRATE_YELLOW.name) { BlockItem(MBlocks.CRATE_YELLOW, DEFAULT_PROPERTIES) }
val CRATE_GREEN: Item by registry.register(MRegistry.CRATE_GREEN.name) { BlockItem(MBlocks.CRATE_GREEN, DEFAULT_PROPERTIES) }
val CRATE_BLACK: Item by registry.register(MRegistry.CRATE_BLACK.name) { BlockItem(MBlocks.CRATE_BLACK, DEFAULT_PROPERTIES) }
val CRATE_PINK: Item by registry.register(MRegistry.CRATE_PINK.name) { BlockItem(MBlocks.CRATE_PINK, DEFAULT_PROPERTIES) }
val CRATE_PURPLE: Item by registry.register(MRegistry.CRATE_PURPLE.name) { BlockItem(MBlocks.CRATE_PURPLE, DEFAULT_PROPERTIES) }
val CRATE_LIST = LazyList(
{ CRATE_RED },
{ CRATE_BLUE },
{ CRATE_YELLOW },
{ CRATE_GREEN },
{ CRATE_BLACK },
{ CRATE_PINK },
{ CRATE_PURPLE },
)
val TRITANIUM_BLOCK: Item by registry.register(MNames.TRITANIUM_BLOCK) { BlockItem(MBlocks.TRITANIUM_BLOCK, DEFAULT_PROPERTIES) }
val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES) }
val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS: Item by registry.register(MRegistry.INDUSTRIAL_GLASS.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_WHITE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_WHITE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_ORANGE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_ORANGE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_MAGENTA: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_MAGENTA.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_MAGENTA, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIGHT_BLUE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIGHT_BLUE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_YELLOW: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_YELLOW.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_YELLOW, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIME: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIME.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIME, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_PINK: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_PINK.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_PINK, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_GRAY: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_GRAY.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_GRAY, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIGHT_GRAY: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIGHT_GRAY, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_CYAN: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_CYAN.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_CYAN, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_PURPLE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_PURPLE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_PURPLE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BLUE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BLUE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BLUE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BROWN: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BROWN.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BROWN, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_GREEN: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_GREEN.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_GREEN, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_RED: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_RED.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_RED, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BLACK: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BLACK.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BLACK, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_WHITE_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_WHITE_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_ORANGE_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_ORANGE_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_MAGENTA_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_MAGENTA.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_MAGENTA_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIGHT_BLUE_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_BLUE.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIGHT_BLUE_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_YELLOW_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_YELLOW.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_YELLOW_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIME_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIME.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIME_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_PINK_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_PINK.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_PINK_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_GRAY_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_GRAY.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_GRAY_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIGHT_GRAY_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_LIGHT_GRAY.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_LIGHT_GRAY_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_CYAN_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_CYAN.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_CYAN_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_PURPLE_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_PURPLE.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_PURPLE_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BLUE_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BLUE.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BLUE_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BROWN_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BROWN.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BROWN_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_GREEN_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_GREEN.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_GREEN_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_RED_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_RED.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_RED_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_BLACK_PANE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_BLACK.namePane) { BlockItem(MBlocks.INDUSTRIAL_GLASS_BLACK_PANE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_LIST = LazyList(
{ INDUSTRIAL_GLASS },
{ INDUSTRIAL_GLASS_WHITE },
{ INDUSTRIAL_GLASS_ORANGE },
{ INDUSTRIAL_GLASS_MAGENTA },
{ INDUSTRIAL_GLASS_LIGHT_BLUE },
{ INDUSTRIAL_GLASS_YELLOW },
{ INDUSTRIAL_GLASS_LIME },
{ INDUSTRIAL_GLASS_PINK },
{ INDUSTRIAL_GLASS_GRAY },
{ INDUSTRIAL_GLASS_LIGHT_GRAY },
{ INDUSTRIAL_GLASS_CYAN },
{ INDUSTRIAL_GLASS_PURPLE },
{ INDUSTRIAL_GLASS_BLUE },
{ INDUSTRIAL_GLASS_BROWN },
{ INDUSTRIAL_GLASS_GREEN },
{ INDUSTRIAL_GLASS_RED },
{ INDUSTRIAL_GLASS_BLACK },
)
val INDUSTRIAL_GLASS_PANE_LIST = LazyList(
{ INDUSTRIAL_GLASS_PANE },
{ INDUSTRIAL_GLASS_WHITE_PANE },
{ INDUSTRIAL_GLASS_ORANGE_PANE },
{ INDUSTRIAL_GLASS_MAGENTA_PANE },
{ INDUSTRIAL_GLASS_LIGHT_BLUE_PANE },
{ INDUSTRIAL_GLASS_YELLOW_PANE },
{ INDUSTRIAL_GLASS_LIME_PANE },
{ INDUSTRIAL_GLASS_PINK_PANE },
{ INDUSTRIAL_GLASS_GRAY_PANE },
{ INDUSTRIAL_GLASS_LIGHT_GRAY_PANE },
{ INDUSTRIAL_GLASS_CYAN_PANE },
{ INDUSTRIAL_GLASS_PURPLE_PANE },
{ INDUSTRIAL_GLASS_BLUE_PANE },
{ INDUSTRIAL_GLASS_BROWN_PANE },
{ INDUSTRIAL_GLASS_GREEN_PANE },
{ INDUSTRIAL_GLASS_RED_PANE },
{ INDUSTRIAL_GLASS_BLACK_PANE },
)
}

View File

@ -0,0 +1,58 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.client.gui.screens.MenuScreens
import net.minecraft.world.inventory.MenuType
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.screen.*
import ru.dbotthepony.mc.otm.menu.*
object MMenus {
private val registry = DeferredRegister.create(ForgeRegistries.CONTAINERS, OverdriveThatMatters.MOD_ID)
val ANDROID_STATION: MenuType<*> by registry.register(MNames.ANDROID_STATION) { MenuType(::AndroidStationMenu) }
val BATTERY_BANK: MenuType<*> by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu) }
val MATTER_DECOMPOSER: MenuType<*> by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu) }
val MATTER_CAPACITOR_BANK: MenuType<*> by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu) }
val PATTERN_STORAGE: MenuType<*> by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu) }
val MATTER_SCANNER: MenuType<*> by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu) }
val MATTER_PANEL: MenuType<*> by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu) }
val MATTER_REPLICATOR: MenuType<*> by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu) }
val MATTER_BOTTLER: MenuType<*> by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu) }
val DRIVE_VIEWER: MenuType<*> by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu) }
val CARGO_CRATE: MenuType<*> by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu) }
val DRIVE_RACK: MenuType<*> by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu) }
val ITEM_MONITOR: MenuType<*> by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu) }
val ENERGY_COUNTER: MenuType<*> by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu) }
val CHEMICAL_GENERATOR: MenuType<*> by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu) }
val PLATE_PRESS: MenuType<*> by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu) }
val MATTER_RECYCLER: MenuType<*> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) }
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
FMLJavaModLoadingContext.get().modEventBus.addListener(this::registerClient)
}
private fun registerClient(event: FMLClientSetupEvent) {
MenuScreens.register(ANDROID_STATION as MenuType<AndroidStationMenu>, ::AndroidStationScreen)
MenuScreens.register(BATTERY_BANK as MenuType<BatteryBankMenu>, ::BatteryBankScreen)
MenuScreens.register(MATTER_DECOMPOSER as MenuType<MatterDecomposerMenu>, ::MatterDecomposerScreen)
MenuScreens.register(MATTER_CAPACITOR_BANK as MenuType<MatterCapacitorBankMenu>, ::MatterCapacitorBankScreen)
MenuScreens.register(PATTERN_STORAGE as MenuType<PatternStorageMenu>, ::PatternStorageScreen)
MenuScreens.register(MATTER_SCANNER as MenuType<MatterScannerMenu>, ::MatterScannerScreen)
MenuScreens.register(MATTER_PANEL as MenuType<MatterPanelMenu>, ::MatterPanelScreen)
MenuScreens.register(MATTER_REPLICATOR as MenuType<MatterReplicatorMenu>, ::MatterReplicatorScreen)
MenuScreens.register(MATTER_BOTTLER as MenuType<MatterBottlerMenu>, ::MatterBottlerScreen)
MenuScreens.register(DRIVE_VIEWER as MenuType<DriveViewerMenu>, ::DriveViewerScreen)
MenuScreens.register(CARGO_CRATE as MenuType<CargoCrateMenu>, ::CargoCrateScreen)
MenuScreens.register(DRIVE_RACK as MenuType<DriveRackMenu>, ::DriveRackScreen)
MenuScreens.register(ITEM_MONITOR as MenuType<ItemMonitorMenu>, ::ItemMonitorScreen)
MenuScreens.register(ENERGY_COUNTER as MenuType<EnergyCounterMenu>, ::EnergyCounterScreen)
MenuScreens.register(CHEMICAL_GENERATOR as MenuType<ChemicalGeneratorMenu>, ::ChemicalGeneratorScreen)
MenuScreens.register(PLATE_PRESS as MenuType<PlatePressMenu>, ::PlatePressScreen)
MenuScreens.register(MATTER_RECYCLER as MenuType<MatterRecyclerMenu>, ::MatterRecyclerScreen)
}
}

View File

@ -0,0 +1,178 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters
object MNames {
// blocks
const val ANDROID_STATION = "android_station" // без рецепта
const val BATTERY_BANK = "battery_bank" // нужен рецепт
const val MATTER_DECOMPOSER = "matter_decomposer" // есть рецепт
const val MATTER_CAPACITOR_BANK = "matter_capacitor_bank" // есть рецепт
const val MATTER_CABLE = "matter_cable" // есть рецепт
const val PATTERN_STORAGE = "pattern_storage" // есть рецепт
const val MATTER_SCANNER = "matter_scanner" // есть рецепт
const val MATTER_PANEL = "matter_panel" // есть рецепт
const val MATTER_REPLICATOR = "matter_replicator" // есть рецепт
const val MATTER_BOTTLER = "matter_bottler" // есть рецепт
const val DRIVE_VIEWER = "drive_viewer" // есть рецепт
const val DRIVE_RACK = "drive_rack" // нужен рецепт (после улучшений)
const val ITEM_MONITOR = "item_monitor" // нужен рецепт (после улучшений)
const val ENERGY_COUNTER = "energy_counter" // есть рецепт
const val CHEMICAL_GENERATOR = "chemical_generator" // есть рецепт
const val PLATE_PRESS = "plate_press" // есть рецепт
const val MATTER_RECYCLER = "matter_recycler" // нужен рецепт
const val DEBUG_EXPLOSION_SMALL = "debug_explosion_small"
const val DEBUG_SPHERE_POINTS = "debug_sphere_points"
const val BLACK_HOLE = "black_hole"
const val GRAVITATION_STABILIZER = "gravitation_stabilizer" // нужен рецепт
const val GRAVITATION_STABILIZER_LENS = "gravitation_stabilizer_lens"
const val CARGO_CRATE = "cargo_crate" // нужен рецепт?
// building blocks
const val TRITANIUM_BLOCK = "tritanium_block"
const val TRITANIUM_STRIPED_BLOCK = "tritanium_striped_block"
const val CARBON_FIBRE_BLOCK = "carbon_fibre_block"
// capabilities
const val ANDROID_CAPABILITY = "android_capability"
val ANDROID_CAPABILITY_RS = ResourceLocation(OverdriveThatMatters.MOD_ID, ANDROID_CAPABILITY)
// items
const val GRAVITATIONAL_DISRUPTOR = "gravitational_disruptor"
const val MATTER_DUST = "matter_dust"
const val PILL_ANDROID = "pill_android"
const val PILL_HUMANE = "pill_humane"
const val PILL_OBLIVION = "pill_oblivion"
const val PILL_HEAL = "pill_heal"
const val BATTERY_CRUDE = "battery_crude"
const val BATTERY_BASIC = "battery_basic"
const val BATTERY_NORMAL = "battery_normal"
const val BATTERY_DENSE = "battery_dense"
const val BATTERY_CAPACITOR = "battery_capacitor"
const val BATTERY_CREATIVE = "battery_creative"
const val MATTER_CAPACITOR_PARTS = "matter_capacitor_parts"
const val MATTER_CAPACITOR_BASIC = "matter_capacitor_basic"
const val MATTER_CAPACITOR_NORMAL = "matter_capacitor_normal"
const val MATTER_CAPACITOR_DENSE = "matter_capacitor_dense"
const val MATTER_CAPACITOR_CREATIVE = "matter_capacitor_creative"
const val PATTERN_DRIVE_NORMAL = "pattern_drive_normal"
const val PATTERN_DRIVE_CREATIVE = "pattern_drive_creative"
const val NUTRIENT_PASTE = "nutrient_paste"
const val PORTABLE_CONDENSATION_DRIVE = "portable_condensation_drive"
const val PORTABLE_DENSE_CONDENSATION_DRIVE = "portable_dense_condensation_drive"
const val BLACK_HOLE_SCANNER = "black_hole_scanner"
const val GRAVITATION_FIELD_LIMITER = "gravitation_field_limiter"
const val GRAVITATION_FIELD_SENSOR = "graivtation_field_sensor"
const val PORTABLE_GRAVITATION_STABILIZER = "portable_gravitation_stabilizer"
// armor
const val TRITANIUM_HELMET = "tritanium_helmet"
const val TRITANIUM_CHESTPLATE = "tritanium_chestplate"
const val TRITANIUM_PANTS = "tritanium_pants"
const val TRITANIUM_BOOTS = "tritanium_boots"
// tools
const val TRITANIUM_SWORD = "tritanium_sword"
const val TRITANIUM_AXE = "tritanium_axe"
const val TRITANIUM_PICKAXE = "tritanium_pickaxe"
const val TRITANIUM_SHOVEL = "tritanium_shovel"
const val TRITANIUM_HOE = "tritanium_hoe"
const val ENERGY_SWORD = "energy_sword"
// items: crafting components
const val TRITANIUM_INGOT = "tritanium_ingot"
const val MATTER_IO_PORT = "matter_io_port"
const val MATTER_TRANSFORM_MATRIX = "matter_transform_matrix"
const val ENERGY_BUS = "energy_bus"
const val ELECTRIC_PARTS = "electric_parts"
const val MACHINE_FRAME = "machine_frame"
const val TRITANIUM_PLATE = "tritanium_plate"
const val IRON_PLATE = "iron_plate"
const val COPPER_WIRING = "copper_wiring"
const val GOLD_WIRING = "gold_wiring"
const val PORTABLE_CONDENSATION_DRIVE_CASING = "portable_condensation_drive_casing"
const val PORTABLE_DENSE_CONDENSATION_DRIVE_CASING = "portable_dense_condensation_drive_casing"
const val CIRCUIT_PLATING = "circuit_plating"
const val BASIC_CONTROL_CIRCUIT = "basic_control_circuit"
const val ADVANCED_CONTROL_CIRCUIT = "advanced_control_circuit"
const val TRITANIUM_ORE = "tritanium_ore"
const val DEEPSLATE_TRITANIUM_ORE = "deepslate_tritanium_ore"
const val TRITANIUM_RAW_BLOCK = "tritanium_raw_block"
const val TRITANIUM_ORE_CLUMP = "tritanium_ore_clump"
// android features and research
const val AIR_BAGS = "air_bags"
const val LIMB_OVERCLOCKING = "limb_overclocking"
const val LIMB_OVERCLOCKING_1 = "limb_overclocking_1"
const val LIMB_OVERCLOCKING_2 = "limb_overclocking_2"
const val LIMB_OVERCLOCKING_3 = "limb_overclocking_3"
const val LIMB_OVERCLOCKING_4 = "limb_overclocking_4"
val LIMB_OVERCLOCKING_LIST = listOf(LIMB_OVERCLOCKING_1, LIMB_OVERCLOCKING_2, LIMB_OVERCLOCKING_3, LIMB_OVERCLOCKING_4)
const val NANOBOTS = "nanobots"
const val NANOBOTS_REGENERATION = "nanobots_regeneration"
const val NANOBOTS_REGENERATION_1 = "nanobots_regeneration_1"
const val NANOBOTS_REGENERATION_2 = "nanobots_regeneration_2"
const val NANOBOTS_REGENERATION_3 = "nanobots_regeneration_3"
const val NANOBOTS_REGENERATION_4 = "nanobots_regeneration_4"
val NANOBOTS_REGENERATION_LIST = listOf(NANOBOTS_REGENERATION_1, NANOBOTS_REGENERATION_2, NANOBOTS_REGENERATION_3, NANOBOTS_REGENERATION_4)
const val NANOBOTS_ARMOR = "nanobots_armor"
const val NANOBOTS_ARMOR_STRENGTH_1 = "nanobots_armor_strength_1"
const val NANOBOTS_ARMOR_STRENGTH_2 = "nanobots_armor_strength_2"
const val NANOBOTS_ARMOR_STRENGTH_3 = "nanobots_armor_strength_3"
val NANOBOTS_ARMOR_STRENGTH_LIST = listOf(
NANOBOTS_ARMOR_STRENGTH_1,
NANOBOTS_ARMOR_STRENGTH_2,
NANOBOTS_ARMOR_STRENGTH_3,
)
const val NANOBOTS_ARMOR_SPEED_1 = "nanobots_armor_speed_1"
const val NANOBOTS_ARMOR_SPEED_2 = "nanobots_armor_speed_2"
const val NANOBOTS_ARMOR_SPEED_3 = "nanobots_armor_speed_3"
val NANOBOTS_ARMOR_SPEED_LIST = listOf(
NANOBOTS_ARMOR_SPEED_1,
NANOBOTS_ARMOR_SPEED_2,
NANOBOTS_ARMOR_SPEED_3,
)
const val HYDRAULICS_OVERLOAD = "hydraulics_overload"
const val HYDRAULICS_OVERLOAD_1 = "hydraulics_overload_1"
const val HYDRAULICS_OVERLOAD_2 = "hydraulics_overload_2"
const val HYDRAULICS_OVERLOAD_3 = "hydraulics_overload_3"
const val EXTENDED_REACH = "extended_reach"
// stats
const val DAMAGE_ABSORBED = "damage_absorbed"
const val HEALTH_REGENERATED = "health_regenerated"
const val POWER_CONSUMED = "power_consumed"
}
object StatNames {
val DAMAGE_ABSORBED = ResourceLocation(OverdriveThatMatters.MOD_ID, MNames.DAMAGE_ABSORBED)
val HEALTH_REGENERATED = ResourceLocation(OverdriveThatMatters.MOD_ID, MNames.HEALTH_REGENERATED)
val POWER_CONSUMED = ResourceLocation(OverdriveThatMatters.MOD_ID, MNames.POWER_CONSUMED)
}

View File

@ -0,0 +1,189 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.core.BlockPos
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.*
import net.minecraft.world.level.block.state.BlockBehaviour
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Material
import net.minecraft.world.level.material.MaterialColor
import net.minecraftforge.event.RegistryEvent
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.ForgeRegistry
import net.minecraftforge.registries.RegistryBuilder
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.android.AndroidResearchType
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
class CrateProperties(val color: MaterialColor, val name: String) {
fun makeBlock(): Block {
return Block(BlockBehaviour.Properties.of(Material.METAL, color)
.sound(SoundType.METAL)
.requiresCorrectToolForDrops()
.strength(5.0F, 6.0F))
}
}
class IndustrialGlassProperties(val color: DyeColor?, val name: String, val namePane: String) {
constructor(color: DyeColor?) : this(color, "industrial_glass${color?.let { "_$it" } ?: ""}", "industrial_glass_pane${color?.let { "_$it" } ?: ""}")
fun makeBlock(): Block {
val properties = BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
.strength(1.5f, 5.0f)
.requiresCorrectToolForDrops()
.sound(SoundType.GLASS)
.noOcclusion()
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false }
.isRedstoneConductor { _: BlockState, _: BlockGetter, _: BlockPos -> false }
.isSuffocating { _: BlockState, _: BlockGetter, _: BlockPos -> false }
.isViewBlocking { _: BlockState, _: BlockGetter, _: BlockPos -> false }
if (color != null) {
return StainedGlassBlock(color, properties)
}
return GlassBlock(properties)
}
fun makePaneBlock(): Block {
val properties = BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
.strength(1.25f, 5.0f)
.requiresCorrectToolForDrops()
.sound(SoundType.GLASS)
.noOcclusion()
if (color != null) {
return StainedGlassPaneBlock(color, properties)
}
return IronBarsBlock(properties)
}
}
private class WriteOnceReadMany<T, V> : ReadOnlyProperty<T, V> {
private var value: V? = null
override fun getValue(thisRef: T, property: KProperty<*>): V {
return value ?: throw IllegalStateException("Tried to access uninitialized property ${property.name}")
}
fun write(value: V) {
if (this.value != null) {
throw IllegalStateException("Already have value written")
}
this.value = value
}
}
object MRegistry {
private val features = WriteOnceReadMany<MRegistry, ForgeRegistry<AndroidFeatureType<*>>>()
private val research = WriteOnceReadMany<MRegistry, ForgeRegistry<AndroidResearchType<*>>>()
val ANDROID_FEATURES by features
val ANDROID_RESEARCH by research
fun initialize(context: FMLJavaModLoadingContext) {
context.modEventBus.addListener(this::register)
context.modEventBus.register(MStats)
context.modEventBus.register(LootModifiers)
MBlocks.register()
MBlockEntities.register()
MMenus.register()
MItems.register()
AndroidFeatures.register()
AndroidResearch.register()
}
internal fun register(event: RegistryEvent.NewRegistry) {
features.write(RegistryBuilder<AndroidFeatureType<*>>().let {
it.setName(ResourceLocation(OverdriveThatMatters.MOD_ID, "android_features"))
it.type = AndroidFeatureType::class.java
it.create() as ForgeRegistry<AndroidFeatureType<*>>
})
research.write(RegistryBuilder<AndroidResearchType<*>>().let {
it.setName(ResourceLocation(OverdriveThatMatters.MOD_ID, "android_research"))
it.type = AndroidResearchType::class.java
it.create() as ForgeRegistry<AndroidResearchType<*>>
})
}
val DAMAGE_BECOME_ANDROID = DamageSource("otm_become_android")
val DAMAGE_BECOME_HUMANE = DamageSource("otm_become_humane")
val DAMAGE_EVENT_HORIZON = DamageSource("otm_event_horizon")
val DAMAGE_HAWKING_RADIATION = DamageSource("otm_hawking_radiation")
const val DAMAGE_EMP_NAME = "otm_emp"
val DAMAGE_EMP: DamageSource = EMPDamageSource()
init {
DAMAGE_BECOME_ANDROID.bypassArmor().bypassInvul().bypassMagic()
DAMAGE_BECOME_HUMANE.bypassArmor().bypassInvul().bypassMagic()
DAMAGE_EVENT_HORIZON.bypassMagic().bypassArmor()
DAMAGE_EMP.bypassMagic().bypassArmor()
// DAMAGE_HAWKING_RADIATION.bypassMagic().bypassArmor();
}
val CRATE_RED = CrateProperties(MaterialColor.COLOR_RED, "crate_red")
val CRATE_BLUE = CrateProperties(MaterialColor.COLOR_BLUE, "crate_blue")
val CRATE_YELLOW = CrateProperties(MaterialColor.COLOR_YELLOW, "crate_yellow")
val CRATE_GREEN = CrateProperties(MaterialColor.COLOR_GREEN, "crate_green")
val CRATE_BLACK = CrateProperties(MaterialColor.COLOR_BLACK, "crate_black")
val CRATE_PINK = CrateProperties(MaterialColor.COLOR_PINK, "crate_pink")
val CRATE_PURPLE = CrateProperties(MaterialColor.COLOR_PURPLE, "crate_purple")
val CRATE_LIST = listOf(
CRATE_RED,
CRATE_BLUE,
CRATE_YELLOW,
CRATE_GREEN,
CRATE_BLACK,
CRATE_PINK,
CRATE_PURPLE,
)
val INDUSTRIAL_GLASS = IndustrialGlassProperties(null)
val INDUSTRIAL_GLASS_WHITE = IndustrialGlassProperties(DyeColor.WHITE)
val INDUSTRIAL_GLASS_ORANGE = IndustrialGlassProperties(DyeColor.ORANGE)
val INDUSTRIAL_GLASS_MAGENTA = IndustrialGlassProperties(DyeColor.MAGENTA)
val INDUSTRIAL_GLASS_LIGHT_BLUE = IndustrialGlassProperties(DyeColor.LIGHT_BLUE)
val INDUSTRIAL_GLASS_YELLOW = IndustrialGlassProperties(DyeColor.YELLOW)
val INDUSTRIAL_GLASS_LIME = IndustrialGlassProperties(DyeColor.LIME)
val INDUSTRIAL_GLASS_PINK = IndustrialGlassProperties(DyeColor.PINK)
val INDUSTRIAL_GLASS_GRAY = IndustrialGlassProperties(DyeColor.GRAY)
val INDUSTRIAL_GLASS_LIGHT_GRAY = IndustrialGlassProperties(DyeColor.LIGHT_GRAY)
val INDUSTRIAL_GLASS_CYAN = IndustrialGlassProperties(DyeColor.CYAN)
val INDUSTRIAL_GLASS_PURPLE = IndustrialGlassProperties(DyeColor.PURPLE)
val INDUSTRIAL_GLASS_BLUE = IndustrialGlassProperties(DyeColor.BLUE)
val INDUSTRIAL_GLASS_BROWN = IndustrialGlassProperties(DyeColor.BROWN)
val INDUSTRIAL_GLASS_GREEN = IndustrialGlassProperties(DyeColor.GREEN)
val INDUSTRIAL_GLASS_RED = IndustrialGlassProperties(DyeColor.RED)
val INDUSTRIAL_GLASS_BLACK = IndustrialGlassProperties(DyeColor.BLACK)
val INDUSTRIAL_GLASS_LIST = listOf(
INDUSTRIAL_GLASS,
INDUSTRIAL_GLASS_WHITE,
INDUSTRIAL_GLASS_ORANGE,
INDUSTRIAL_GLASS_MAGENTA,
INDUSTRIAL_GLASS_LIGHT_BLUE,
INDUSTRIAL_GLASS_YELLOW,
INDUSTRIAL_GLASS_LIME,
INDUSTRIAL_GLASS_PINK,
INDUSTRIAL_GLASS_GRAY,
INDUSTRIAL_GLASS_LIGHT_GRAY,
INDUSTRIAL_GLASS_CYAN,
INDUSTRIAL_GLASS_PURPLE,
INDUSTRIAL_GLASS_BLUE,
INDUSTRIAL_GLASS_BROWN,
INDUSTRIAL_GLASS_GREEN,
INDUSTRIAL_GLASS_RED,
INDUSTRIAL_GLASS_BLACK,
)
}

View File

@ -0,0 +1,23 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.core.Registry
import net.minecraft.stats.StatFormatter
import net.minecraft.stats.Stats
import net.minecraftforge.eventbus.api.SubscribeEvent
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
import ru.dbotthepony.mc.otm.registry.StatNames.DAMAGE_ABSORBED
import ru.dbotthepony.mc.otm.registry.StatNames.HEALTH_REGENERATED
import ru.dbotthepony.mc.otm.registry.StatNames.POWER_CONSUMED
object MStats {
@SubscribeEvent
@Suppress("unused")
fun registerVanilla(event: FMLCommonSetupEvent) {
Registry.register(Registry.CUSTOM_STAT, DAMAGE_ABSORBED, DAMAGE_ABSORBED)
Registry.register(Registry.CUSTOM_STAT, HEALTH_REGENERATED, HEALTH_REGENERATED)
Registry.register(Registry.CUSTOM_STAT, POWER_CONSUMED, POWER_CONSUMED)
Stats.CUSTOM[DAMAGE_ABSORBED, StatFormatter.DIVIDE_BY_TEN]
Stats.CUSTOM[HEALTH_REGENERATED, StatFormatter.DIVIDE_BY_TEN]
Stats.CUSTOM[POWER_CONSUMED, StatFormatter.DIVIDE_BY_TEN]
}
}

View File

@ -0,0 +1,9 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraftforge.registries.IForgeRegistryEntry
import net.minecraftforge.registries.RegistryObject
import kotlin.reflect.KProperty
operator fun <T : IForgeRegistryEntry<T>> RegistryObject<T>.getValue(mItems: Any, property: KProperty<*>): T {
return get()
}