Split registry file into multiple files

This commit is contained in:
DBotThePony 2022-01-30 19:59:27 +07:00
parent c62836fa04
commit bb606f3c8d
Signed by: DBot
GPG Key ID: DCC23B5715498507
89 changed files with 1809 additions and 1722 deletions

View File

@ -4,7 +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.ItemTags
import net.minecraft.tags.Tag import net.minecraft.tags.Tag
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
@ -15,9 +14,9 @@ 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 import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.Registry.Blocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.Registry.Items import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.block.BlockDriveViewer import ru.dbotthepony.mc.otm.block.BlockDriveViewer
import ru.dbotthepony.mc.otm.block.BlockEnergyCounter import ru.dbotthepony.mc.otm.block.BlockEnergyCounter
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
@ -32,6 +31,7 @@ import ru.dbotthepony.mc.otm.datagen.loot.TileNbtCopy
import ru.dbotthepony.mc.otm.datagen.models.BlockMatteryModelProvider import ru.dbotthepony.mc.otm.datagen.models.BlockMatteryModelProvider
import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider
import ru.dbotthepony.mc.otm.datagen.recipes.has import ru.dbotthepony.mc.otm.datagen.recipes.has
import ru.dbotthepony.mc.otm.registry.MTags
@Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
object DataGen { object DataGen {
@ -119,19 +119,19 @@ object DataGen {
event.generator.addProvider(BatteryBankProvider(event)) event.generator.addProvider(BatteryBankProvider(event))
event.generator.addProvider(lootTableProvider) event.generator.addProvider(lootTableProvider)
decorativeCubeAll(*Blocks.CRATES) decorativeCubeAll(*MBlocks.CRATES)
decorativeCubeAll(Blocks.CARBON_FIBRE_BLOCK) decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK)
decorativeCubeAll(Blocks.TRITANIUM_BLOCK) decorativeCubeAll(MBlocks.TRITANIUM_BLOCK)
for (glass in Registry.INDUSTRIAL_GLASS_LIST) { for (glass in Registry.INDUSTRIAL_GLASS_LIST) {
decorativeCubeAll(glass.block) decorativeCubeAll(glass.block)
} }
blockModelProvider.resourceCubeAll(Blocks.TRITANIUM_ORE) blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_ORE)
blockModelProvider.resourceCubeAll(Blocks.TRITANIUM_RAW_BLOCK) blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_RAW_BLOCK)
blockModelProvider.resourceCubeAll(Blocks.DEEPSLATE_TRITANIUM_ORE) blockModelProvider.resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
decorativeColumn(Blocks.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 (glass in Registry.INDUSTRIAL_GLASS_LIST) {
val name = glass.block.registryName?.path ?: throw IllegalStateException("Invalid state of glass block ${glass.block}") val name = glass.block.registryName?.path ?: throw IllegalStateException("Invalid state of glass block ${glass.block}")
@ -168,80 +168,80 @@ object DataGen {
} }
with(blockStateProvider) { with(blockStateProvider) {
block(Blocks.BLACK_HOLE) block(MBlocks.BLACK_HOLE)
block(Blocks.ANDROID_STATION) block(MBlocks.ANDROID_STATION)
ore(Blocks.DEEPSLATE_TRITANIUM_ORE) ore(MBlocks.DEEPSLATE_TRITANIUM_ORE)
ore(Blocks.TRITANIUM_ORE) ore(MBlocks.TRITANIUM_ORE)
ore(Blocks.TRITANIUM_RAW_BLOCK) ore(MBlocks.TRITANIUM_RAW_BLOCK)
block(Blocks.CHEMICAL_GENERATOR) block(MBlocks.CHEMICAL_GENERATOR)
block(Blocks.MATTER_SCANNER) block(MBlocks.MATTER_SCANNER)
block(Blocks.ITEM_MONITOR) block(MBlocks.ITEM_MONITOR)
block(Blocks.MATTER_BOTTLER) block(MBlocks.MATTER_BOTTLER)
block(Blocks.MATTER_DECOMPOSER) block(MBlocks.MATTER_DECOMPOSER)
block(Blocks.MATTER_REPLICATOR) block(MBlocks.MATTER_REPLICATOR)
block(Blocks.PLATE_PRESS) block(MBlocks.PLATE_PRESS)
block(Blocks.GRAVITATION_STABILIZER) block(MBlocks.GRAVITATION_STABILIZER)
block(Blocks.GRAVITATION_STABILIZER_LENS) block(MBlocks.GRAVITATION_STABILIZER_LENS)
} }
with(itemModelProvider) { with(itemModelProvider) {
block(Items.ANDROID_STATION) block(MItems.ANDROID_STATION)
block(Items.BATTERY_BANK) block(MItems.BATTERY_BANK)
block(Items.MATTER_CAPACITOR_BANK) block(MItems.MATTER_CAPACITOR_BANK)
block(Items.PATTERN_STORAGE) block(MItems.PATTERN_STORAGE)
block(Items.BLACK_HOLE) block(MItems.BLACK_HOLE)
block(Items.CARBON_FIBRE_BLOCK) block(MItems.CARBON_FIBRE_BLOCK)
block(Items.DEEPSLATE_TRITANIUM_ORE) block(MItems.DEEPSLATE_TRITANIUM_ORE)
block(Items.TRITANIUM_ORE) block(MItems.TRITANIUM_ORE)
block(Items.TRITANIUM_STRIPED_BLOCK) block(MItems.TRITANIUM_STRIPED_BLOCK)
block(Items.TRITANIUM_RAW_BLOCK) block(MItems.TRITANIUM_RAW_BLOCK)
block(Items.ITEM_MONITOR) block(MItems.ITEM_MONITOR)
block(Items.TRITANIUM_BLOCK) block(MItems.TRITANIUM_BLOCK)
for (glass in Registry.INDUSTRIAL_GLASS_LIST) { for (glass in Registry.INDUSTRIAL_GLASS_LIST) {
block(glass.item) block(glass.item)
generated(glass.paneItem, ResourceLocation(MOD_ID, "block/decorative/${glass.item.registryName!!.path}")) generated(glass.paneItem, ResourceLocation(MOD_ID, "block/decorative/${glass.item.registryName!!.path}"))
} }
blocks(*Items.CRATES) blocks(*MItems.CRATES)
components(*Items.DATAGEN_COMPONENTS) components(*MItems.DATAGEN_COMPONENTS)
generated(Items.PILL_ANDROID) generated(MItems.PILL_ANDROID)
generated(Items.PILL_HUMANE) generated(MItems.PILL_HUMANE)
generated(Items.PILL_OBLIVION) generated(MItems.PILL_OBLIVION)
generated(Items.PILL_HEAL) generated(MItems.PILL_HEAL)
generated(Items.NUTRIENT_PASTE) generated(MItems.NUTRIENT_PASTE)
component(Items.TRITANIUM_INGOT) component(MItems.TRITANIUM_INGOT)
resource(Items.TRITANIUM_ORE_CLUMP) resource(MItems.TRITANIUM_ORE_CLUMP)
handheld(*Items.TRITANIUM_TOOLS) handheld(*MItems.TRITANIUM_TOOLS)
generated(*Items.TRITANIUM_ARMOR) generated(*MItems.TRITANIUM_ARMOR)
generatedTiered(Items.BATTERIES, "battery_tier") generatedTiered(MItems.BATTERIES, "battery_tier")
generated(Items.BATTERY_CREATIVE) generated(MItems.BATTERY_CREATIVE)
generated(Items.MATTER_CAPACITOR_BASIC, ResourceLocation(MOD_ID, "item/matter_capacitor_tier1")) generated(MItems.MATTER_CAPACITOR_BASIC, ResourceLocation(MOD_ID, "item/matter_capacitor_tier1"))
generated(Items.MATTER_CAPACITOR_NORMAL, ResourceLocation(MOD_ID, "item/matter_capacitor_tier2")) generated(MItems.MATTER_CAPACITOR_NORMAL, ResourceLocation(MOD_ID, "item/matter_capacitor_tier2"))
generated(Items.MATTER_CAPACITOR_DENSE, ResourceLocation(MOD_ID, "item/matter_capacitor_tier3")) generated(MItems.MATTER_CAPACITOR_DENSE, ResourceLocation(MOD_ID, "item/matter_capacitor_tier3"))
generated(Items.MATTER_CAPACITOR_CREATIVE) generated(MItems.MATTER_CAPACITOR_CREATIVE)
generated(Items.PATTERN_DRIVE_CREATIVE) generated(MItems.PATTERN_DRIVE_CREATIVE)
block(Items.CARGO_CRATE, "cargo_crate_closed") block(MItems.CARGO_CRATE, "cargo_crate_closed")
block(Items.CHEMICAL_GENERATOR, "chemical_generator_working") block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")
block(Items.ENERGY_COUNTER, "energy_counter_down") block(MItems.ENERGY_COUNTER, "energy_counter_down")
block(Items.MATTER_BOTTLER, "matter_bottler_working") block(MItems.MATTER_BOTTLER, "matter_bottler_working")
block(Items.MATTER_CABLE, "matter_cable_core") block(MItems.MATTER_CABLE, "matter_cable_core")
block(Items.MATTER_DECOMPOSER, "matter_decomposer_working") block(MItems.MATTER_DECOMPOSER, "matter_decomposer_working")
block(Items.PLATE_PRESS, "plate_press_idle") block(MItems.PLATE_PRESS, "plate_press_idle")
} }
blockStateProvider.lambda { provider -> blockStateProvider.lambda { provider ->
with(provider.getMultipartBuilder(Blocks.DRIVE_VIEWER)) { with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
for (facing in BlockMatteryRotatable.FACING.possibleValues) { for (facing in BlockMatteryRotatable.FACING.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part"))) .modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part")))
@ -261,7 +261,7 @@ object DataGen {
} }
} }
with(provider.getMultipartBuilder(Blocks.PATTERN_STORAGE)) { with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
for (facing in BlockMatteryRotatable.FACING.possibleValues) { for (facing in BlockMatteryRotatable.FACING.possibleValues) {
for (i in 0 .. 7) { for (i in 0 .. 7) {
part() part()
@ -280,7 +280,7 @@ object DataGen {
} }
} }
with(provider.getMultipartBuilder(Blocks.ENERGY_COUNTER)) { with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) {
// даваааййй // даваааййй
val up = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_up")) val up = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_up"))
val down = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_down")) val down = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_down"))
@ -332,32 +332,32 @@ object DataGen {
) )
with(lootTableProvider) { with(lootTableProvider) {
simpleBlocks(*Blocks.CRATES) simpleBlocks(*MBlocks.CRATES)
simpleBlock(Blocks.CARGO_CRATE) simpleBlock(MBlocks.CARGO_CRATE)
simpleBlock(Blocks.CARBON_FIBRE_BLOCK) simpleBlock(MBlocks.CARBON_FIBRE_BLOCK)
simpleBlock(Blocks.TRITANIUM_RAW_BLOCK) simpleBlock(MBlocks.TRITANIUM_RAW_BLOCK)
simpleBlock(Blocks.TRITANIUM_BLOCK) simpleBlock(MBlocks.TRITANIUM_BLOCK)
simpleBlock(Blocks.TRITANIUM_STRIPED_BLOCK) simpleBlock(MBlocks.TRITANIUM_STRIPED_BLOCK)
simpleBlock(Blocks.MATTER_CABLE) simpleBlock(MBlocks.MATTER_CABLE)
simpleBlock(Blocks.GRAVITATION_STABILIZER) simpleBlock(MBlocks.GRAVITATION_STABILIZER)
tile(Blocks.ENERGY_COUNTER, TileNbtCopy("passed"), TileNbtCopy("history"), TileNbtCopy("history_tick")) tile(MBlocks.ENERGY_COUNTER, TileNbtCopy("passed"), TileNbtCopy("history"), TileNbtCopy("history_tick"))
tile(Blocks.CHEMICAL_GENERATOR, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("working_ticks"), TileNbtCopy("working_ticks_total")) tile(MBlocks.CHEMICAL_GENERATOR, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("working_ticks"), TileNbtCopy("working_ticks_total"))
tile(Blocks.ANDROID_STATION, TileNbtCopy("energy"), TileNbtCopy("battery_container")) tile(MBlocks.ANDROID_STATION, TileNbtCopy("energy"), TileNbtCopy("battery_container"))
tile(Blocks.BATTERY_BANK, TileNbtCopy("container")) tile(MBlocks.BATTERY_BANK, TileNbtCopy("container"))
tile(Blocks.DRIVE_VIEWER, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("battery_container")) tile(MBlocks.DRIVE_VIEWER, TileNbtCopy("energy"), TileNbtCopy("container"), TileNbtCopy("battery_container"))
tile(Blocks.MATTER_DECOMPOSER, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags) tile(MBlocks.MATTER_DECOMPOSER, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags)
tile(Blocks.MATTER_REPLICATOR, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags) tile(MBlocks.MATTER_REPLICATOR, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags)
tile(Blocks.MATTER_RECYCLER, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags) tile(MBlocks.MATTER_RECYCLER, TileNbtCopy("container"), TileNbtCopy("matter"), *workerTags)
tile(Blocks.MATTER_SCANNER, TileNbtCopy("container"), *workerTags) tile(MBlocks.MATTER_SCANNER, TileNbtCopy("container"), *workerTags)
tile(Blocks.PLATE_PRESS, TileNbtCopy("container"), *workerTags) tile(MBlocks.PLATE_PRESS, TileNbtCopy("container"), *workerTags)
tile(Blocks.MATTER_PANEL, TileNbtCopy("tasks")) tile(MBlocks.MATTER_PANEL, TileNbtCopy("tasks"))
tile(Blocks.PATTERN_STORAGE, TileNbtCopy("patterns")) tile(MBlocks.PATTERN_STORAGE, TileNbtCopy("patterns"))
tile(Blocks.MATTER_CAPACITOR_BANK, TileNbtCopy("container")) tile(MBlocks.MATTER_CAPACITOR_BANK, TileNbtCopy("container"))
tile(Blocks.MATTER_BOTTLER, TileNbtCopy("energy"), TileNbtCopy("battery_container"), TileNbtCopy("work_slots"), TileNbtCopy("work_flow"), TileNbtCopy("matter")) tile(MBlocks.MATTER_BOTTLER, TileNbtCopy("energy"), TileNbtCopy("battery_container"), TileNbtCopy("work_slots"), TileNbtCopy("work_flow"), TileNbtCopy("matter"))
} }
with(recipeProvider) { with(recipeProvider) {
@ -380,8 +380,8 @@ object DataGen {
lambda { _, consumer -> lambda { _, consumer ->
ShapelessRecipeBuilder(Registry.INDUSTRIAL_GLASS.item, 8) ShapelessRecipeBuilder(Registry.INDUSTRIAL_GLASS.item, 8)
.requires(net.minecraft.world.item.Items.GLASS, 8) .requires(net.minecraft.world.item.Items.GLASS, 8)
.requires(Registry.Tags.Items.PLATE_TRITANIUM) .requires(MTags.Items.PLATE_TRITANIUM)
.unlockedBy("has_plate", has(Registry.Tags.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)

View File

@ -4,11 +4,11 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraftforge.client.model.generators.BlockStateProvider import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockBatteryBank import ru.dbotthepony.mc.otm.block.BlockBatteryBank
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate
import ru.dbotthepony.mc.otm.registry.MBlocks
private fun nothingOrNumber(input: Int): String { private fun nothingOrNumber(input: Int): String {
if (input == 0) if (input == 0)
@ -20,7 +20,7 @@ private fun nothingOrNumber(input: Int): String {
open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) { open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
protected var block = "battery_bank" protected var block = "battery_bank"
protected var batteryPath = "block/battery/battery" protected var batteryPath = "block/battery/battery"
protected var registry: Block = Registry.Blocks.BATTERY_BANK protected var registry: Block = MBlocks.BATTERY_BANK
override fun registerStatesAndModels() { override fun registerStatesAndModels() {
with(getMultipartBuilder(registry)) { with(getMultipartBuilder(registry)) {
@ -46,6 +46,6 @@ class MatterBankProvider(event: GatherDataEvent) : BatteryBankProvider(event) {
init { init {
block = "matter_capacitor_bank" block = "matter_capacitor_bank"
batteryPath = "block/battery/matter_capacitor" batteryPath = "block/battery/matter_capacitor"
registry = Registry.Blocks.MATTER_CAPACITOR_BANK registry = MBlocks.MATTER_CAPACITOR_BANK
} }
} }

View File

@ -31,6 +31,7 @@ import ru.dbotthepony.mc.otm.item.ItemPortableCondensationDrive;
import ru.dbotthepony.mc.otm.matter.MatterDataKt; import ru.dbotthepony.mc.otm.matter.MatterDataKt;
import ru.dbotthepony.mc.otm.matter.MatterRegistryKt; import ru.dbotthepony.mc.otm.matter.MatterRegistryKt;
import ru.dbotthepony.mc.otm.network.MatteryNetworking; import ru.dbotthepony.mc.otm.network.MatteryNetworking;
import ru.dbotthepony.mc.otm.registry.*;
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper; import ru.dbotthepony.mc.otm.storage.ItemStackWrapper;
import ru.dbotthepony.mc.otm.storage.StorageObjectRegistry; import ru.dbotthepony.mc.otm.storage.StorageObjectRegistry;
import ru.dbotthepony.mc.otm.storage.StorageObjectTuple; import ru.dbotthepony.mc.otm.storage.StorageObjectTuple;
@ -123,7 +124,7 @@ public class OverdriveThatMatters {
CREATIVE_TAB = new CreativeModeTab("otm") { CREATIVE_TAB = new CreativeModeTab("otm") {
@Override @Override
public ItemStack makeIcon() { public ItemStack makeIcon() {
return new ItemStack(Registry.Items.BATTERY_CREATIVE, 1); return new ItemStack(MItems.BATTERY_CREATIVE, 1);
} }
}; };
@ -141,14 +142,14 @@ public class OverdriveThatMatters {
FMLJavaModLoadingContext.get().getModEventBus().register(MatteryCapability.class); FMLJavaModLoadingContext.get().getModEventBus().register(MatteryCapability.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.Items.class); FMLJavaModLoadingContext.get().getModEventBus().register(MItems.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.Blocks.class); FMLJavaModLoadingContext.get().getModEventBus().register(MBlocks.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.BlockEntities.class); FMLJavaModLoadingContext.get().getModEventBus().register(MBlockEntities.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.Menus.class); FMLJavaModLoadingContext.get().getModEventBus().register(MMenus.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.AndroidFeatures.class); FMLJavaModLoadingContext.get().getModEventBus().register(AndroidFeatures.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.AndroidResearch.class); FMLJavaModLoadingContext.get().getModEventBus().register(AndroidResearch.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.Stats.class); FMLJavaModLoadingContext.get().getModEventBus().register(MStats.class);
FMLJavaModLoadingContext.get().getModEventBus().register(Registry.Recipes.class); FMLJavaModLoadingContext.get().getModEventBus().register(MRecipes.class);
MinecraftForge.EVENT_BUS.register(DrivePool.INSTANCE); MinecraftForge.EVENT_BUS.register(DrivePool.INSTANCE);
MinecraftForge.EVENT_BUS.register(ItemPortableCondensationDrive.Companion); MinecraftForge.EVENT_BUS.register(ItemPortableCondensationDrive.Companion);

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ 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; import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.client.render.SkinElement; import ru.dbotthepony.mc.otm.client.render.SkinElement;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -3,7 +3,7 @@ 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; import ru.dbotthepony.mc.otm.registry.Registry;
import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.android.AndroidCapabilityPlayer;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,12 +1,10 @@
package ru.dbotthepony.mc.otm.android.feature; package ru.dbotthepony.mc.otm.android.feature;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeMod;
import ru.dbotthepony.mc.otm.Registry;
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.capability.android.IAndroidCapability; import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import java.util.UUID; import java.util.UUID;
@ -14,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(Registry.AndroidFeatures.EXTENDED_REACH, capability); super(AndroidFeatures.EXTENDED_REACH, capability);
} }
@Override @Override

View File

@ -2,10 +2,9 @@ package ru.dbotthepony.mc.otm.android.feature;
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import ru.dbotthepony.mc.otm.Registry;
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.capability.android.IAndroidCapability; import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import java.util.UUID; import java.util.UUID;
@ -13,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(Registry.AndroidFeatures.LIMB_OVERCLOCKING, capability); super(AndroidFeatures.LIMB_OVERCLOCKING, capability);
} }
@Override @Override

View File

@ -3,19 +3,15 @@ package ru.dbotthepony.mc.otm.android.feature;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent;
import ru.dbotthepony.mc.otm.Registry;
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.capability.android.IAndroidCapability; import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.core.Fraction;
import ru.dbotthepony.mc.otm.core.ImpreciseFraction; import ru.dbotthepony.mc.otm.core.ImpreciseFraction;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import java.math.BigDecimal; import ru.dbotthepony.mc.otm.registry.MNames;
public class AndroidNanobotsArmor extends AndroidFeature { public class AndroidNanobotsArmor extends AndroidFeature {
public AndroidNanobotsArmor(IAndroidCapability capability) { public AndroidNanobotsArmor(IAndroidCapability capability) {
super(Registry.AndroidFeatures.NANOBOTS_ARMOR, capability); super(AndroidFeatures.NANOBOTS_ARMOR, capability);
} }
public int getStrength() { public int getStrength() {
@ -85,7 +81,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(Registry.Names.DAMAGE_ABSORBED, Math.round(real_absorbed * 10f)); ply.awardStat(MNames.DAMAGE_ABSORBED, Math.round(real_absorbed * 10f));
} }
layers--; layers--;

View File

@ -3,19 +3,15 @@ package ru.dbotthepony.mc.otm.android.feature;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent;
import ru.dbotthepony.mc.otm.Registry;
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.capability.android.IAndroidCapability; import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability;
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.core.Fraction;
import ru.dbotthepony.mc.otm.core.ImpreciseFraction; import ru.dbotthepony.mc.otm.core.ImpreciseFraction;
import ru.dbotthepony.mc.otm.registry.AndroidFeatures;
import java.math.BigDecimal; import ru.dbotthepony.mc.otm.registry.MNames;
public class AndroidNanobotsRegeneration extends AndroidFeature { public class AndroidNanobotsRegeneration extends AndroidFeature {
public AndroidNanobotsRegeneration(IAndroidCapability capability) { public AndroidNanobotsRegeneration(IAndroidCapability capability) {
super(Registry.AndroidFeatures.NANOBOTS_REGENERATION, capability); super(AndroidFeatures.NANOBOTS_REGENERATION, capability);
} }
protected int ticks_passed = 0; protected int ticks_passed = 0;
@ -49,7 +45,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(Registry.Names.HEALTH_REGENERATED, Math.round(heal * 10f)); ply.awardStat(MNames.HEALTH_REGENERATED, Math.round(heal * 10f));
} }
ticks_passed = 0; ticks_passed = 0;

View File

@ -2,9 +2,9 @@ package ru.dbotthepony.mc.otm.client;
import net.minecraftforge.client.event.MovementInputUpdateEvent; import net.minecraftforge.client.event.MovementInputUpdateEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import ru.dbotthepony.mc.otm.Registry;
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.AndroidFeatures;
public class EventHandler { public class EventHandler {
@SubscribeEvent @SubscribeEvent
@ -16,7 +16,7 @@ public class EventHandler {
if (!(_cap instanceof AndroidCapabilityPlayer cap)) if (!(_cap instanceof AndroidCapabilityPlayer cap))
return; return;
if (cap.hasFeature(Registry.AndroidFeatures.AIR_BAGS)) if (cap.hasFeature(AndroidFeatures.AIR_BAGS))
return; return;
if (ply.getAbilities().mayfly) { if (ply.getAbilities().mayfly) {

View File

@ -5,10 +5,10 @@ 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.Registry; import ru.dbotthepony.mc.otm.registry.MNames;
public class GravitationStabilizerModel { public class GravitationStabilizerModel {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(Registry.Names.PORTABLE_GRAVITATION_STABILIZER, "main"); public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(MNames.PORTABLE_GRAVITATION_STABILIZER, "main");
private static HumanoidModel<?> model; private static HumanoidModel<?> model;
private static LayerDefinition def; private static LayerDefinition def;

View File

@ -5,7 +5,7 @@ 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; 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;

View File

@ -6,7 +6,7 @@ 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; 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;

View File

@ -3,7 +3,7 @@ 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; 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;

View File

@ -0,0 +1,36 @@
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

@ -0,0 +1,247 @@
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

@ -0,0 +1,105 @@
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.BlockEntityBlackHole;
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<BlockEntityAndroidStation> ANDROID_STATION = BlockEntityType.Builder.of(BlockEntityAndroidStation::new, MBlocks.ANDROID_STATION).build(null);
public static final BlockEntityType<BlockEntityBatteryBank> BATTERY_BANK = BlockEntityType.Builder.of(BlockEntityBatteryBank::new, MBlocks.BATTERY_BANK).build(null);
public static final BlockEntityType<BlockEntityMatterDecomposer> MATTER_DECOMPOSER = BlockEntityType.Builder.of(BlockEntityMatterDecomposer::new, MBlocks.MATTER_DECOMPOSER).build(null);
public static final BlockEntityType<BlockEntityMatterCapacitorBank> MATTER_CAPACITOR_BANK = BlockEntityType.Builder.of(BlockEntityMatterCapacitorBank::new, MBlocks.MATTER_CAPACITOR_BANK).build(null);
public static final BlockEntityType<BlockEntityMatterCable> MATTER_CABLE = BlockEntityType.Builder.of(BlockEntityMatterCable::new, MBlocks.MATTER_CABLE).build(null);
public static final BlockEntityType<BlockEntityPatternStorage> PATTERN_STORAGE = BlockEntityType.Builder.of(BlockEntityPatternStorage::new, MBlocks.PATTERN_STORAGE).build(null);
public static final BlockEntityType<BlockEntityMatterScanner> MATTER_SCANNER = BlockEntityType.Builder.of(BlockEntityMatterScanner::new, MBlocks.MATTER_SCANNER).build(null);
public static final BlockEntityType<BlockEntityMatterPanel> MATTER_PANEL = BlockEntityType.Builder.of(BlockEntityMatterPanel::new, MBlocks.MATTER_PANEL).build(null);
public static final BlockEntityType<BlockEntityMatterReplicator> MATTER_REPLICATOR = BlockEntityType.Builder.of(BlockEntityMatterReplicator::new, MBlocks.MATTER_REPLICATOR).build(null);
public static final BlockEntityType<BlockEntityMatterBottler> MATTER_BOTTLER = BlockEntityType.Builder.of(BlockEntityMatterBottler::new, MBlocks.MATTER_BOTTLER).build(null);
public static final BlockEntityType<BlockEntityDriveViewer> DRIVE_VIEWER = BlockEntityType.Builder.of(BlockEntityDriveViewer::new, MBlocks.DRIVE_VIEWER).build(null);
public static final BlockEntityType<BlockEntityBlackHole> BLACK_HOLE = BlockEntityType.Builder.of(BlockEntityBlackHole::new, MBlocks.BLACK_HOLE).build(null);
public static final BlockEntityType<BlockEntityCargoCrate> CARGO_CRATE = BlockEntityType.Builder.of(BlockEntityCargoCrate::new, MBlocks.CARGO_CRATE).build(null);
public static final BlockEntityType<BlockEntityDriveRack> DRIVE_RACK = BlockEntityType.Builder.of(BlockEntityDriveRack::new, MBlocks.DRIVE_RACK).build(null);
public static final BlockEntityType<BlockEntityItemMonitor> ITEM_MONITOR = BlockEntityType.Builder.of(BlockEntityItemMonitor::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<BlockEntityChemicalGenerator> CHEMICAL_GENERATOR = BlockEntityType.Builder.of(BlockEntityChemicalGenerator::new, MBlocks.CHEMICAL_GENERATOR).build(null);
public static final BlockEntityType<BlockEntityPlatePress> PLATE_PRESS = BlockEntityType.Builder.of(BlockEntityPlatePress::new, MBlocks.PLATE_PRESS).build(null);
public static final BlockEntityType<BlockEntityGravitationStabilizer> GRAVITATION_STABILIZER = BlockEntityType.Builder.of(BlockEntityGravitationStabilizer::new, MBlocks.GRAVITATION_STABILIZER).build(null);
public static final BlockEntityType<BlockEntityMatterRecycler> MATTER_RECYCLER = BlockEntityType.Builder.of(BlockEntityMatterRecycler::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

@ -0,0 +1,190 @@
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 BlockAndroidStation ANDROID_STATION = new BlockAndroidStation();
public static final BlockBatteryBank BATTERY_BANK = new BlockBatteryBank();
public static final BlockMatterDecomposer MATTER_DECOMPOSER = new BlockMatterDecomposer();
public static final BlockMatterCapacitorBank MATTER_CAPACITOR_BANK = new BlockMatterCapacitorBank();
public static final BlockMatterCable MATTER_CABLE = new BlockMatterCable();
public static final BlockPatternStorage PATTERN_STORAGE = new BlockPatternStorage();
public static final BlockMatterScanner MATTER_SCANNER = new BlockMatterScanner();
public static final BlockMatterPanel MATTER_PANEL = new BlockMatterPanel();
public static final BlockMatterReplicator MATTER_REPLICATOR = new BlockMatterReplicator();
public static final BlockMatterBottler MATTER_BOTTLER = new BlockMatterBottler();
public static final BlockDriveViewer DRIVE_VIEWER = new BlockDriveViewer();
public static final BlockCargoCrate CARGO_CRATE = new BlockCargoCrate();
public static final BlockDriveRack DRIVE_RACK = new BlockDriveRack();
public static final BlockItemMonitor ITEM_MONITOR = new BlockItemMonitor();
public static final BlockEnergyCounter ENERGY_COUNTER = new BlockEnergyCounter();
public static final BlockChemicalGenerator CHEMICAL_GENERATOR = new BlockChemicalGenerator();
public static final BlockPlatePress PLATE_PRESS = new BlockPlatePress();
public static final BlockMatterRecycler MATTER_RECYCLER = new BlockMatterRecycler();
public static final BlockExplosionDebugger DEBUG_EXPLOSION_SMALL = new BlockExplosionDebugger();
public static final BlockSphereDebugger DEBUG_SPHERE_POINTS = new BlockSphereDebugger();
public static final BlockBlackHole BLACK_HOLE = new BlockBlackHole();
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

@ -0,0 +1,407 @@
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.CREATIVE_TAB == 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.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 ItemMatterDust MATTER_DUST = new ItemMatterDust();
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.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 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 ItemGravitationalDisruptor GRAVITATIONAL_DISRUPTOR = new ItemGravitationalDisruptor();
public static final ItemPill PILL_ANDROID = new ItemPill(PillType.BECOME_ANDROID);
public static final ItemPill PILL_HUMANE = new ItemPill(PillType.BECOME_HUMANE);
public static final ItemPill PILL_OBLIVION = new ItemPill(PillType.OBLIVION);
public static final ItemPillHeal PILL_HEAL = new ItemPillHeal();
public static final ItemBattery BATTERY_CRUDE = new ItemBattery(new ImpreciseFraction(30_000), new ImpreciseFraction(150), new ImpreciseFraction(150));
public static final ItemBattery BATTERY_BASIC = new ItemBattery(new ImpreciseFraction(60_000), new ImpreciseFraction(300), new ImpreciseFraction(300));
public static final ItemBattery BATTERY_NORMAL = new ItemBattery(new ImpreciseFraction(250_000), new ImpreciseFraction(1000), new ImpreciseFraction(1000));
public static final ItemBattery BATTERY_DENSE = new ItemBattery(new ImpreciseFraction(1_000_000), new ImpreciseFraction(2000), new ImpreciseFraction(2000));
public static final ItemBattery BATTERY_CAPACITOR = new ItemBattery(new ImpreciseFraction(150_000), new ImpreciseFraction(15000), new ImpreciseFraction(15000));
public static final ItemBattery BATTERY_CREATIVE = new ItemBattery();
public static final ItemBattery[] 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.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 ItemMatterCapacitor MATTER_CAPACITOR_BASIC = new ItemMatterCapacitor(new ImpreciseFraction("4"));
public static final ItemMatterCapacitor MATTER_CAPACITOR_NORMAL = new ItemMatterCapacitor(new ImpreciseFraction("10"));
public static final ItemMatterCapacitor MATTER_CAPACITOR_DENSE = new ItemMatterCapacitor(new ImpreciseFraction("40"));
public static final ItemMatterCapacitor MATTER_CAPACITOR_CREATIVE = new ItemMatterCapacitor();
public static final ItemPatternStorage PATTERN_DRIVE_NORMAL = new ItemPatternStorage(4);
public static final ItemPatternStorage PATTERN_DRIVE_CREATIVE = new ItemPatternStorage();
public static final ItemPortableCondensationDrive PORTABLE_CONDENSATION_DRIVE = new ItemPortableCondensationDrive(4000);
public static final ItemPortableCondensationDrive PORTABLE_DENSE_CONDENSATION_DRIVE = new ItemPortableCondensationDrive(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.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.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);
}
@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);
// OverdriveThatMatters.LOGGER.info("Registered items");
}
}

View File

@ -0,0 +1,97 @@
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<MenuBatteryBank> BATTERY_BANK = new MenuType<>(MenuBatteryBank::new);
public static final MenuType<MenuMatterDecomposer> MATTER_DECOMPOSER = new MenuType<>(MenuMatterDecomposer::new);
public static final MenuType<MenuMatterCapacitor> MATTER_CAPACITOR_BANK = new MenuType<>(MenuMatterCapacitor::new);
public static final MenuType<MenuPatternStorage> PATTERN_STORAGE = new MenuType<>(MenuPatternStorage::new);
public static final MenuType<MenuMatterScanner> MATTER_SCANNER = new MenuType<>(MenuMatterScanner::new);
public static final MenuType<MenuMatterPanel> MATTER_PANEL = new MenuType<>(MenuMatterPanel::new);
public static final MenuType<MenuMatterReplicator> MATTER_REPLICATOR = new MenuType<>(MenuMatterReplicator::new);
public static final MenuType<MenuMatterBottler> MATTER_BOTTLER = new MenuType<>(MenuMatterBottler::new);
public static final MenuType<MenuDriveViewer> DRIVE_VIEWER = new MenuType<>(MenuDriveViewer::new);
public static final MenuType<MenuCargoCrate> CARGO_CRATE = new MenuType<>(MenuCargoCrate::new);
public static final MenuType<MenuDriveRack> DRIVE_RACK = new MenuType<>(MenuDriveRack::new);
public static final MenuType<MenuItemMonitor> ITEM_MONITOR = new MenuType<>(MenuItemMonitor::new);
public static final MenuType<MenuEnergyCounter> ENERGY_COUNTER = new MenuType<>(MenuEnergyCounter::new);
public static final MenuType<MenuChemicalGenerator> CHEMICAL_GENERATOR = new MenuType<>(MenuChemicalGenerator::new);
public static final MenuType<MenuPlatePress> PLATE_PRESS = new MenuType<>(MenuPlatePress::new);
public static final MenuType<MenuMatterRecycler> MATTER_RECYCLER = new MenuType<>(MenuMatterRecycler::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, ScreenAndroidStation::new);
MenuScreens.register(BATTERY_BANK, ScreenBatteryBank::new);
MenuScreens.register(MATTER_DECOMPOSER, ScreenMatterDecomposer::new);
MenuScreens.register(MATTER_CAPACITOR_BANK, ScreenMatterCapacitorBank::new);
MenuScreens.register(PATTERN_STORAGE, ScreenPatternStorage::new);
MenuScreens.register(MATTER_SCANNER, ScreenMatterScanner::new);
MenuScreens.register(MATTER_PANEL, MatterPanelScreen::new);
MenuScreens.register(MATTER_REPLICATOR, ScreenMatterReplicator::new);
MenuScreens.register(MATTER_BOTTLER, ScreenMatterBottler::new);
MenuScreens.register(DRIVE_VIEWER, ScreenDriveViewer::new);
MenuScreens.register(CARGO_CRATE, ScreenCargoCrate::new);
MenuScreens.register(DRIVE_RACK, ScreenDriveRack::new);
MenuScreens.register(ITEM_MONITOR, ScreenItemMonitor::new);
MenuScreens.register(ENERGY_COUNTER, ScreenEnergyCounter::new);
MenuScreens.register(CHEMICAL_GENERATOR, ScreenChemicalGenerator::new);
MenuScreens.register(PLATE_PRESS, ScreenPlatePress::new);
MenuScreens.register(MATTER_RECYCLER, ScreenMatterRecycler::new);
// OverdriveThatMatters.LOGGER.info("Registered screens");
}
}

View File

@ -0,0 +1,173 @@
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");
// 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

@ -0,0 +1,44 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe;
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipeFactory;
public class MRecipes {
public static class MatteryRecipeType<T extends Recipe<?>> implements RecipeType<T> {
public final ResourceLocation name;
private MatteryRecipeType(ResourceLocation name) {
this.name = name;
}
private void register() {
net.minecraft.core.Registry.register(net.minecraft.core.Registry.RECIPE_TYPE, name, this);
}
@Override
public String toString() {
return name.toString();
}
}
public static final MatteryRecipeType<PlatePressRecipe> PLATE_PRESS = new MatteryRecipeType<>(MNames.PLATE_PRESS);
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final FMLCommonSetupEvent event) {
PLATE_PRESS.register();
}
@SubscribeEvent
@SuppressWarnings("unused")
public static void register(final RegistryEvent.Register<RecipeSerializer<?>> event) {
event.getRegistry().register(PlatePressRecipeFactory.INSTANCE);
}
}

View File

@ -0,0 +1,19 @@
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

@ -0,0 +1,15 @@
package ru.dbotthepony.mc.otm.registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.Tags;
import java.util.Set;
public class MTags {
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> PLATE_TRITANIUM = ItemTags.createOptional(new ResourceLocation("forge", "plates/tritanium"), Set.of(() -> MItems.TRITANIUM_PLATE));
}
}

View File

@ -0,0 +1,207 @@
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.CREATIVE_TAB == 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");
static {
DAMAGE_BECOME_ANDROID.bypassArmor().bypassInvul().bypassMagic();
DAMAGE_BECOME_HUMANE.bypassArmor().bypassInvul().bypassMagic();
DAMAGE_EVENT_HORIZON.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.CREATIVE_TAB).stacksTo(64)),
new BlockItem(pane, new Item.Properties().tab(OverdriveThatMatters.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

@ -14,11 +14,10 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.BlockHitResult import net.minecraft.world.phys.BlockHitResult
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityAndroidStation import ru.dbotthepony.mc.otm.block.entity.BlockEntityAndroidStation
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability
import ru.dbotthepony.mc.otm.orNull import ru.dbotthepony.mc.otm.orNull
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockAndroidStation : BlockMattery(), EntityBlock { class BlockAndroidStation : BlockMattery(), EntityBlock {
@ -56,7 +55,7 @@ class BlockAndroidStation : BlockMattery(), EntityBlock {
state: BlockState, state: BlockState,
type: BlockEntityType<T> type: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (level.isClientSide || type !== Registry.BlockEntities.ANDROID_STATION) if (level.isClientSide || type !== MBlockEntities.ANDROID_STATION)
return null return null
return BlockEntityTicker { _, _, _, t -> if (t is BlockEntityAndroidStation) t.tick() } return BlockEntityTicker { _, _, _, t -> if (t is BlockEntityAndroidStation) t.tick() }

View File

@ -2,12 +2,10 @@ package ru.dbotthepony.mc.otm.block
import net.minecraft.MethodsReturnNonnullByDefault import net.minecraft.MethodsReturnNonnullByDefault
import javax.annotation.ParametersAreNonnullByDefault import javax.annotation.ParametersAreNonnullByDefault
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.item.context.BlockPlaceContext import net.minecraft.world.item.context.BlockPlaceContext
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.properties.BooleanProperty import net.minecraft.world.level.block.state.properties.BooleanProperty
import ru.dbotthepony.mc.otm.block.BlockBatteryBank
import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.entity.BlockEntityTicker import net.minecraft.world.level.block.entity.BlockEntityTicker
@ -20,7 +18,7 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
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.Registry import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ -40,7 +38,7 @@ class BlockBatteryBank : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
type: BlockEntityType<T> type: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (level.isClientSide || type !== Registry.BlockEntities.BATTERY_BANK) if (level.isClientSide || type !== MBlockEntities.BATTERY_BANK)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityBatteryBank) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityBatteryBank) tile.tick() }

View File

@ -10,11 +10,10 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Material import net.minecraft.world.level.material.Material
import net.minecraft.world.level.material.MaterialColor
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.Registry
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockBlackHole : class BlockBlackHole :
@ -37,7 +36,7 @@ class BlockBlackHole :
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153214_ !== Registry.BlockEntities.BLACK_HOLE) return null if (p_153214_ !== MBlockEntities.BLACK_HOLE) return null
if (p_153212_.isClientSide) { if (p_153212_.isClientSide) {
return BlockEntityTicker { _, _, _, t -> if (t is BlockEntityBlackHole) t.clientTick() } return BlockEntityTicker { _, _, _, t -> if (t is BlockEntityBlackHole) t.clientTick() }

View File

@ -15,9 +15,9 @@ import net.minecraft.world.level.block.state.StateDefinition
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.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityChemicalGenerator import ru.dbotthepony.mc.otm.block.entity.BlockEntityChemicalGenerator
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockChemicalGenerator : BlockMatteryRotatable(), EntityBlock { class BlockChemicalGenerator : BlockMatteryRotatable(), EntityBlock {
@ -30,7 +30,7 @@ class BlockChemicalGenerator : BlockMatteryRotatable(), EntityBlock {
state: BlockState, state: BlockState,
type: BlockEntityType<T> type: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (level.isClientSide || type != Registry.BlockEntities.CHEMICAL_GENERATOR) if (level.isClientSide || type != MBlockEntities.CHEMICAL_GENERATOR)
return null return null
return BlockEntityTicker<T> { _, _, _, tile -> if (tile is BlockEntityChemicalGenerator) tile.tick() } return BlockEntityTicker<T> { _, _, _, tile -> if (tile is BlockEntityChemicalGenerator) tile.tick() }

View File

@ -11,8 +11,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockDriveRack : BlockMatteryRotatable(), EntityBlock { class BlockDriveRack : BlockMatteryRotatable(), EntityBlock {
@ -25,7 +25,7 @@ class BlockDriveRack : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153214_ != Registry.BlockEntities.DRIVE_RACK || p_153212_.isClientSide) if (p_153214_ != MBlockEntities.DRIVE_RACK || p_153212_.isClientSide)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityDriveRack) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityDriveRack) tile.tick() }

View File

@ -11,9 +11,9 @@ import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BooleanProperty import net.minecraft.world.level.block.state.properties.BooleanProperty
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockDriveViewer : BlockMatteryRotatable(), EntityBlock { class BlockDriveViewer : BlockMatteryRotatable(), EntityBlock {
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity { override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
@ -25,7 +25,7 @@ class BlockDriveViewer : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.DRIVE_VIEWER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.DRIVE_VIEWER)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityDriveViewer) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityDriveViewer) tile.tick() }

View File

@ -15,8 +15,8 @@ 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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockEnergyCounter : BlockMattery(), EntityBlock { class BlockEnergyCounter : BlockMattery(), EntityBlock {
@ -29,7 +29,7 @@ class BlockEnergyCounter : BlockMattery(), EntityBlock {
blockState: BlockState, blockState: BlockState,
blockEntityType: BlockEntityType<T> blockEntityType: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (blockEntityType !== Registry.BlockEntities.ENERGY_COUNTER) if (blockEntityType !== MBlockEntities.ENERGY_COUNTER)
return null return null
if (level.isClientSide) if (level.isClientSide)

View File

@ -9,9 +9,9 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Material import net.minecraft.world.level.material.Material
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockExplosionDebugger : Block(Properties.of(Material.STONE)), EntityBlock { class BlockExplosionDebugger : Block(Properties.of(Material.STONE)), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
@ -23,7 +23,7 @@ class BlockExplosionDebugger : Block(Properties.of(Material.STONE)), EntityBlock
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (!p_153212_.isClientSide && p_153214_ === Registry.BlockEntities.DEBUG_EXPLOSION_SMALL) { if (!p_153212_.isClientSide && p_153214_ === MBlockEntities.DEBUG_EXPLOSION_SMALL) {
return BlockEntityTicker {_, _, _, t -> if (t is BlockEntityExplosionDebugger) t.tick()} return BlockEntityTicker {_, _, _, t -> if (t is BlockEntityExplosionDebugger) t.tick()}
} }
@ -41,7 +41,7 @@ class BlockSphereDebugger : Block(Properties.of(Material.STONE)), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (!p_153212_.isClientSide && p_153214_ === Registry.BlockEntities.DEBUG_SPHERE_POINTS) { if (!p_153212_.isClientSide && p_153214_ === MBlockEntities.DEBUG_SPHERE_POINTS) {
return BlockEntityTicker {_, _, _, t -> if (t is BlockEntitySphereDebugger) t.tick()} return BlockEntityTicker {_, _, _, t -> if (t is BlockEntitySphereDebugger) t.tick()}
} }

View File

@ -23,12 +23,13 @@ import net.minecraft.world.level.material.PushReaction
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.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.core.times import ru.dbotthepony.mc.otm.core.times
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
import kotlin.math.PI import kotlin.math.PI
@ -44,7 +45,7 @@ class BlockGravitationStabilizer : BlockMatteryRotatable(props), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.GRAVITATION_STABILIZER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.GRAVITATION_STABILIZER)
return null return null
return BlockEntityTicker { level, _, _, tile -> if (tile is BlockEntityGravitationStabilizer) tile.tick(level) } return BlockEntityTicker { level, _, _, tile -> if (tile is BlockEntityGravitationStabilizer) tile.tick(level) }
@ -98,7 +99,7 @@ class BlockGravitationStabilizer : BlockMatteryRotatable(props), EntityBlock {
if (!level.isClientSide) { if (!level.isClientSide) {
val bbPos = blockPos + blockState.getValue(FACING_FULL).normal val bbPos = blockPos + blockState.getValue(FACING_FULL).normal
val newState = Registry.Blocks.GRAVITATION_STABILIZER_LENS.defaultBlockState() val newState = MBlocks.GRAVITATION_STABILIZER_LENS.defaultBlockState()
.setValue(FACING_FULL, blockState.getValue(FACING_FULL)) .setValue(FACING_FULL, blockState.getValue(FACING_FULL))
level.setBlock(bbPos, newState, UPDATE_ALL) level.setBlock(bbPos, newState, UPDATE_ALL)

View File

@ -11,9 +11,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack
import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockItemMonitor : BlockMatteryRotatable(), EntityBlock { class BlockItemMonitor : BlockMatteryRotatable(), EntityBlock {
@ -26,7 +25,7 @@ class BlockItemMonitor : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153214_ != Registry.BlockEntities.ITEM_MONITOR || p_153212_.isClientSide) if (p_153214_ != MBlockEntities.ITEM_MONITOR || p_153212_.isClientSide)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityItemMonitor) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityItemMonitor) tile.tick() }

View File

@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.block
import net.minecraft.MethodsReturnNonnullByDefault import net.minecraft.MethodsReturnNonnullByDefault
import javax.annotation.ParametersAreNonnullByDefault import javax.annotation.ParametersAreNonnullByDefault
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.core.Direction import net.minecraft.core.Direction
@ -19,8 +18,8 @@ import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BooleanProperty import net.minecraft.world.level.block.state.properties.BooleanProperty
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.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ -35,7 +34,7 @@ class BlockMatterBottler : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.MATTER_BOTTLER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_BOTTLER)
return null return null
return BlockEntityTicker {_, _, _, tile -> if (tile is BlockEntityMatterBottler) tile.tick()} return BlockEntityTicker {_, _, _, tile -> if (tile is BlockEntityMatterBottler) tile.tick()}

View File

@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.block
import net.minecraft.MethodsReturnNonnullByDefault import net.minecraft.MethodsReturnNonnullByDefault
import javax.annotation.ParametersAreNonnullByDefault import javax.annotation.ParametersAreNonnullByDefault
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.core.Direction import net.minecraft.core.Direction
@ -17,9 +16,8 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
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.Registry
import ru.dbotthepony.mc.otm.block.BlockMatterDecomposer
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ -34,7 +32,7 @@ class BlockMatterDecomposer : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.MATTER_DECOMPOSER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_DECOMPOSER)
return null return null
return BlockEntityTicker {_, _, _, t -> if (t is BlockEntityMatterDecomposer) t.tick()} return BlockEntityTicker {_, _, _, t -> if (t is BlockEntityMatterDecomposer) t.tick()}

View File

@ -7,8 +7,8 @@ import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityTicker import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterRecycler import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterRecycler
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockMatterRecycler : BlockMatteryRotatable(), EntityBlock { class BlockMatterRecycler : BlockMatteryRotatable(), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
@ -20,7 +20,7 @@ class BlockMatterRecycler : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.MATTER_RECYCLER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_RECYCLER)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterRecycler) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterRecycler) tile.tick() }

View File

@ -13,9 +13,9 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.StateDefinition
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterReplicator import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterReplicator
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockMatterReplicator : BlockMatteryRotatable(), EntityBlock { class BlockMatterReplicator : BlockMatteryRotatable(), EntityBlock {
@ -28,7 +28,7 @@ class BlockMatterReplicator : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.MATTER_REPLICATOR) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_REPLICATOR)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterReplicator) tile.basicTicker() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterReplicator) tile.basicTicker() }

View File

@ -13,9 +13,9 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.StateDefinition
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterScanner import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterScanner
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockMatterScanner : BlockMatteryRotatable(), EntityBlock { class BlockMatterScanner : BlockMatteryRotatable(), EntityBlock {
@ -28,7 +28,7 @@ class BlockMatterScanner : BlockMatteryRotatable(), EntityBlock {
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.MATTER_SCANNER) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_SCANNER)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterScanner) tile.basicTicker() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityMatterScanner) tile.basicTicker() }

View File

@ -13,9 +13,9 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.level.block.state.StateDefinition
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.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.shapes.BlockShapes
class BlockPlatePress(properties: Properties = DEFAULT_PROPERTIES) : BlockMatteryRotatable(properties), EntityBlock { class BlockPlatePress(properties: Properties = DEFAULT_PROPERTIES) : BlockMatteryRotatable(properties), EntityBlock {
@ -28,7 +28,7 @@ class BlockPlatePress(properties: Properties = DEFAULT_PROPERTIES) : BlockMatter
p_153213_: BlockState, p_153213_: BlockState,
p_153214_: BlockEntityType<T> p_153214_: BlockEntityType<T>
): BlockEntityTicker<T>? { ): BlockEntityTicker<T>? {
if (p_153212_.isClientSide || p_153214_ !== Registry.BlockEntities.PLATE_PRESS) if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.PLATE_PRESS)
return null return null
return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityPlatePress) tile.basicTicker() } return BlockEntityTicker { _, _, _, tile -> if (tile is BlockEntityPlatePress) tile.basicTicker() }

View File

@ -10,14 +10,14 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.AABB import net.minecraft.world.phys.AABB
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.AndroidStationMenu import ru.dbotthepony.mc.otm.menu.AndroidStationMenu
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockEntityAndroidStation(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityAndroidStation(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryPowered(Registry.BlockEntities.ANDROID_STATION, p_155229_, p_155230_), MenuProvider { BlockEntityMatteryPowered(MBlockEntities.ANDROID_STATION, p_155229_, p_155230_), MenuProvider {
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu { override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
return AndroidStationMenu(containerID, inventory, this) return AndroidStationMenu(containerID, inventory, this)

View File

@ -19,7 +19,6 @@ import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.energy.CapabilityEnergy import net.minecraftforge.energy.CapabilityEnergy
import net.minecraftforge.energy.IEnergyStorage import net.minecraftforge.energy.IEnergyStorage
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockBatteryBank import ru.dbotthepony.mc.otm.block.BlockBatteryBank
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage
@ -27,16 +26,16 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability
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.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.MenuBatteryBank import ru.dbotthepony.mc.otm.menu.MenuBatteryBank
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import ru.dbotthepony.mc.otm.unaryMinus import ru.dbotthepony.mc.otm.unaryMinus
import javax.annotation.ParametersAreNonnullByDefault import javax.annotation.ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
class BlockEntityBatteryBank(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(Registry.BlockEntities.BATTERY_BANK, p_155229_, p_155230_) { class BlockEntityBatteryBank(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(MBlockEntities.BATTERY_BANK, p_155229_, p_155230_) {
// 6 на 2 // 6 на 2
val container: MatteryContainer = object : MatteryContainer(this::setChanged, CAPACITY) { val container: MatteryContainer = object : MatteryContainer(this::setChanged, CAPACITY) {
override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) {

View File

@ -13,17 +13,17 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockCargoCrate import ru.dbotthepony.mc.otm.block.BlockCargoCrate
import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.ifHas import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.menu.MenuCargoCrate import ru.dbotthepony.mc.otm.menu.MenuCargoCrate
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
class BlockEntityCargoCrate( class BlockEntityCargoCrate(
p_155229_: BlockPos, p_155229_: BlockPos,
p_155230_: BlockState p_155230_: BlockState
) : BlockEntityMattery(Registry.BlockEntities.CARGO_CRATE, p_155229_, p_155230_) { ) : BlockEntityMattery(MBlockEntities.CARGO_CRATE, p_155229_, p_155230_) {
val container = MatteryContainer(this::setChanged, CAPACITY) val container = MatteryContainer(this::setChanged, CAPACITY)
private var interactingPlayers = 0 private var interactingPlayers = 0
val handler = container.handler() val handler = container.handler()

View File

@ -25,13 +25,13 @@ import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.capability.* import ru.dbotthepony.mc.otm.capability.*
import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.menu.MenuChemicalGenerator import ru.dbotthepony.mc.otm.menu.MenuChemicalGenerator
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEntityMattery(Registry.BlockEntities.CHEMICAL_GENERATOR, pos, state) { class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEntityMattery(MBlockEntities.CHEMICAL_GENERATOR, pos, state) {
override fun getDefaultDisplayName(): Component { override fun getDefaultDisplayName(): Component {
return NAME return NAME
} }

View File

@ -14,7 +14,6 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage
@ -24,10 +23,11 @@ import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.menu.MenuDriveRack import ru.dbotthepony.mc.otm.menu.MenuDriveRack
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent
class BlockEntityDriveRack(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityDriveRack(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryPowered(Registry.BlockEntities.DRIVE_RACK, p_155229_, p_155230_) { BlockEntityMatteryPowered(MBlockEntities.DRIVE_RACK, p_155229_, p_155230_) {
override val energy = WorkerEnergyStorage(this, STORAGE) override val energy = WorkerEnergyStorage(this, STORAGE)
@JvmField @JvmField

View File

@ -12,20 +12,19 @@ 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.state.BlockState import net.minecraft.world.level.block.state.BlockState
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockDriveViewer import ru.dbotthepony.mc.otm.block.BlockDriveViewer
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage 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.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.MenuDriveViewer import ru.dbotthepony.mc.otm.menu.MenuDriveViewer
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
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
class BlockEntityDriveViewer(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMatteryPowered(Registry.BlockEntities.DRIVE_VIEWER, p_155229_, p_155230_) { class BlockEntityDriveViewer(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMatteryPowered(MBlockEntities.DRIVE_VIEWER, p_155229_, p_155230_) {
override fun setChanged() { override fun setChanged() {
super.setChanged() super.setChanged()

View File

@ -28,10 +28,10 @@ import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
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.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.menu.MenuEnergyCounter import ru.dbotthepony.mc.otm.menu.MenuEnergyCounter
import ru.dbotthepony.mc.otm.network.MatteryNetworking import ru.dbotthepony.mc.otm.network.MatteryNetworking
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import java.util.function.Supplier import java.util.function.Supplier
@ -71,7 +71,7 @@ data class EnergyCounterPacket(val pos: BlockPos, val thisTick: ImpreciseFractio
} }
} }
class BlockEntityEnergyCounter(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(Registry.BlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) { class BlockEntityEnergyCounter(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(MBlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) {
var passed = ImpreciseFraction.ZERO var passed = ImpreciseFraction.ZERO
internal set internal set

View File

@ -9,18 +9,17 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.AABB import net.minecraft.world.phys.AABB
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizer import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizer
import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizerLens import ru.dbotthepony.mc.otm.block.BlockGravitationStabilizerLens
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.core.minus
import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.core.times import ru.dbotthepony.mc.otm.core.times
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockEntityGravitationStabilizer(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(Registry.BlockEntities.GRAVITATION_STABILIZER, p_155229_, p_155230_) { class BlockEntityGravitationStabilizer(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMattery(
MBlockEntities.GRAVITATION_STABILIZER, p_155229_, p_155230_) {
override fun getDefaultDisplayName() = NAME override fun getDefaultDisplayName() = NAME
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player) = null override fun createMenu(containerID: Int, inventory: Inventory, ply: Player) = null

View File

@ -12,16 +12,15 @@ import net.minecraft.world.level.Level
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode
import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph
import ru.dbotthepony.mc.otm.menu.MenuItemMonitor import ru.dbotthepony.mc.otm.menu.MenuItemMonitor
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockEntityItemMonitor(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityItemMonitor(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryPowered(Registry.BlockEntities.ITEM_MONITOR, p_155229_, p_155230_) { BlockEntityMatteryPowered(MBlockEntities.ITEM_MONITOR, p_155229_, p_155230_) {
@JvmField @JvmField
val cell = BasicStorageGraphNode() val cell = BasicStorageGraphNode()

View File

@ -16,7 +16,6 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockMatterBottler import ru.dbotthepony.mc.otm.block.BlockMatterBottler
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
@ -32,10 +31,11 @@ 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.menu.MenuMatterBottler import ru.dbotthepony.mc.otm.menu.MenuMatterBottler
import ru.dbotthepony.mc.otm.orNull import ru.dbotthepony.mc.otm.orNull
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
class BlockEntityMatterBottler(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterBottler(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryPowered(Registry.BlockEntities.MATTER_BOTTLER, p_155229_, p_155230_), IMatterGraphNode { BlockEntityMatteryPowered(MBlockEntities.MATTER_BOTTLER, p_155229_, p_155230_), IMatterGraphNode {
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }

View File

@ -9,16 +9,16 @@ import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockMatterCable import ru.dbotthepony.mc.otm.block.BlockMatterCable
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.Graph6Node
import ru.dbotthepony.mc.otm.graph.GraphNodeListener import ru.dbotthepony.mc.otm.graph.GraphNodeListener
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.registry.MBlockEntities
class BlockEntityMatterCable(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterCable(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntity(Registry.BlockEntities.MATTER_CABLE, p_155229_, p_155230_), IMatterGraphNode, GraphNodeListener { BlockEntity(MBlockEntities.MATTER_CABLE, p_155229_, p_155230_), IMatterGraphNode, GraphNodeListener {
private var valid = true private var valid = true
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)

View File

@ -16,7 +16,6 @@ import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockBatteryBank import ru.dbotthepony.mc.otm.block.BlockBatteryBank
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler
@ -27,13 +26,14 @@ 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.MenuMatterCapacitor import ru.dbotthepony.mc.otm.menu.MenuMatterCapacitor
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
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterCapacitorBank(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMattery(Registry.BlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler { BlockEntityMattery(MBlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler {
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }

View File

@ -16,7 +16,6 @@ import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import net.minecraftforge.items.IItemHandler import net.minecraftforge.items.IItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus
@ -35,11 +34,13 @@ 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
import ru.dbotthepony.mc.otm.menu.MenuMatterDecomposer import ru.dbotthepony.mc.otm.menu.MenuMatterDecomposer
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.set 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 = Registry.Items.MATTER_DUST val item = MItems.MATTER_DUST
while (matterValue > ImpreciseFraction.ZERO) { while (matterValue > ImpreciseFraction.ZERO) {
val stack = container[OUTPUT_DUST_MAIN] val stack = container[OUTPUT_DUST_MAIN]
@ -91,7 +92,7 @@ fun moveMatterAsDustIntoContainer(_matterValue: ImpreciseFraction, container: Ma
} }
class BlockEntityMatterDecomposer(pos: BlockPos, state: BlockState) class BlockEntityMatterDecomposer(pos: BlockPos, state: BlockState)
: BlockEntityMatteryWorker(Registry.BlockEntities.MATTER_DECOMPOSER, pos, state), IMatterGraphNode { : BlockEntityMatteryWorker(MBlockEntities.MATTER_DECOMPOSER, pos, state), IMatterGraphNode {
override val energy = WorkerEnergyStorage(this, ENERGY_STORAGE, MAX_IO) override val energy = WorkerEnergyStorage(this, ENERGY_STORAGE, MAX_IO)
private var valid = true private var valid = true

View File

@ -1,7 +1,5 @@
package ru.dbotthepony.mc.otm.block.entity package ru.dbotthepony.mc.otm.block.entity
import net.minecraft.MethodsReturnNonnullByDefault
import javax.annotation.ParametersAreNonnullByDefault
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.core.Direction import net.minecraft.core.Direction
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
@ -26,15 +24,15 @@ import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerLevel
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import ru.dbotthepony.mc.otm.Registry
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.registry.MBlockEntities
import java.util.ArrayList import java.util.ArrayList
import java.util.List import java.util.List
class BlockEntityMatterPanel(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterPanel(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMattery(Registry.BlockEntities.MATTER_PANEL, p_155229_, p_155230_), IMatterGraphNode, IMatterTaskProvider { BlockEntityMattery(MBlockEntities.MATTER_PANEL, p_155229_, p_155230_), IMatterGraphNode, IMatterTaskProvider {
private val listeners = ArrayList<MenuMatterPanel>() private val listeners = ArrayList<MenuMatterPanel>()
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)

View File

@ -14,7 +14,6 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus
@ -33,10 +32,11 @@ 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.ItemMatterDust import ru.dbotthepony.mc.otm.item.ItemMatterDust
import ru.dbotthepony.mc.otm.menu.MenuMatterRecycler import ru.dbotthepony.mc.otm.menu.MenuMatterRecycler
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
class BlockEntityMatterRecycler(blockPos: BlockPos, blockState: BlockState) class BlockEntityMatterRecycler(blockPos: BlockPos, blockState: BlockState)
: BlockEntityMatteryWorker(Registry.BlockEntities.MATTER_RECYCLER, blockPos, blockState), IMatterGraphNode { : BlockEntityMatteryWorker(MBlockEntities.MATTER_RECYCLER, blockPos, blockState), IMatterGraphNode {
val matter = MatterHandlerImpl( val matter = MatterHandlerImpl(
this::setChangedLight, this::setChangedLight,
MatterDirection.EXTRACT, MatterDirection.EXTRACT,

View File

@ -9,13 +9,11 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus
@ -24,7 +22,6 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.capability.matter.* import ru.dbotthepony.mc.otm.capability.matter.*
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.MatteryContainerFilterOnlyOut import ru.dbotthepony.mc.otm.container.MatteryContainerFilterOnlyOut
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.Graph6Node
@ -34,11 +31,11 @@ import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.matter.baselineComplexityReplicateTicks import ru.dbotthepony.mc.otm.matter.baselineComplexityReplicateTicks
import ru.dbotthepony.mc.otm.matter.getMatterValue import ru.dbotthepony.mc.otm.matter.getMatterValue
import ru.dbotthepony.mc.otm.menu.MenuMatterReplicator import ru.dbotthepony.mc.otm.menu.MenuMatterReplicator
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import kotlin.math.pow
class BlockEntityMatterReplicator(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterReplicator(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryWorker(Registry.BlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_), IMatterGraphNode { BlockEntityMatteryWorker(MBlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_), IMatterGraphNode {
override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO) override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO)
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)

View File

@ -15,7 +15,6 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus
@ -29,10 +28,11 @@ 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.matter.* import ru.dbotthepony.mc.otm.matter.*
import ru.dbotthepony.mc.otm.menu.MenuMatterScanner import ru.dbotthepony.mc.otm.menu.MenuMatterScanner
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import java.util.* import java.util.*
class BlockEntityMatterScanner(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityMatterScanner(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMatteryWorker(Registry.BlockEntities.MATTER_SCANNER, p_155229_, p_155230_), IMatterGraphNode { BlockEntityMatteryWorker(MBlockEntities.MATTER_SCANNER, p_155229_, p_155230_), IMatterGraphNode {
val container = MatteryContainer(this::setChanged, 1) val container = MatteryContainer(this::setChanged, 1)
override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO) override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO)

View File

@ -22,19 +22,19 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.capability.matter.* import ru.dbotthepony.mc.otm.capability.matter.*
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.ifHas import ru.dbotthepony.mc.otm.ifHas
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import java.util.ArrayList import java.util.ArrayList
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
class BlockEntityPatternStorage(p_155229_: BlockPos, p_155230_: BlockState) : class BlockEntityPatternStorage(p_155229_: BlockPos, p_155230_: BlockState) :
BlockEntityMattery(Registry.BlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IMatterGraphNode, IPatternStorage { BlockEntityMattery(MBlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IMatterGraphNode, IPatternStorage {
private val node = Graph6Node<IMatterGraphNode>(this) private val node = Graph6Node<IMatterGraphNode>(this)
private val resolverPatterns = LazyOptional.of { this } private val resolverPatterns = LazyOptional.of { this }

View File

@ -12,7 +12,6 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.common.util.LazyOptional import net.minecraftforge.common.util.LazyOptional
import net.minecraftforge.items.CapabilityItemHandler import net.minecraftforge.items.CapabilityItemHandler
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker import ru.dbotthepony.mc.otm.block.entity.worker.BlockEntityMatteryWorker
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJob
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus import ru.dbotthepony.mc.otm.block.entity.worker.WorkerJobStatus
@ -21,9 +20,11 @@ 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.MenuPlatePress
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.registry.MRecipes
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
class BlockEntityPlatePress(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMatteryWorker(Registry.BlockEntities.PLATE_PRESS, p_155229_, p_155230_) { class BlockEntityPlatePress(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntityMatteryWorker(MBlockEntities.PLATE_PRESS, p_155229_, p_155230_) {
val container = MatteryContainer(this::setChangedLight, 2) val container = MatteryContainer(this::setChangedLight, 2)
override val energy = WorkerEnergyStorage(this::setChangedLight) override val energy = WorkerEnergyStorage(this::setChangedLight)
@ -86,7 +87,7 @@ class BlockEntityPlatePress(p_155229_: BlockPos, p_155230_: BlockState) : BlockE
override fun computeNextJob(): WorkerJob? { override fun computeNextJob(): WorkerJob? {
val level = level ?: return null val level = level ?: return null
val recipe = level.recipeManager.getRecipeFor(Registry.Recipes.PLATE_PRESS, container, level).orElse(null) ?: return null val recipe = level.recipeManager.getRecipeFor(MRecipes.PLATE_PRESS, container, level).orElse(null) ?: return null
val copy = container[SLOT_INPUT].copy() val copy = container[SLOT_INPUT].copy()
container[SLOT_INPUT].shrink(1) container[SLOT_INPUT].shrink(1)

View File

@ -21,18 +21,20 @@ 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 import ru.dbotthepony.mc.otm.registry.Registry
import ru.dbotthepony.mc.otm.block.BlockBlackHole import ru.dbotthepony.mc.otm.block.BlockBlackHole
import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer
import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.core.plus 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.MItems
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
class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(Registry.BlockEntities.BLACK_HOLE, p_155229_, p_155230_) { class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(MBlockEntities.BLACK_HOLE, p_155229_, p_155230_) {
var mass = BASELINE_MASS var mass = BASELINE_MASS
set(mass) { set(mass) {
if (mass <= ImpreciseFraction.ZERO) { if (mass <= ImpreciseFraction.ZERO) {
@ -275,7 +277,7 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
if (distance < gravitationStrength + 1) { if (distance < gravitationStrength + 1) {
if (item.hurt(Registry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) { if (item.hurt(Registry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) {
if (item.item.item === Registry.Items.GRAVITATIONAL_DISRUPTOR) { if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) {
collapse() collapse()
} else { } else {
val mass = getMatterValue(item.item) val mass = getMatterValue(item.item)

View File

@ -7,11 +7,11 @@ import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.core.times import ru.dbotthepony.mc.otm.core.times
import ru.dbotthepony.mc.otm.registry.MBlockEntities
class BlockEntityExplosionDebugger(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(Registry.BlockEntities.DEBUG_EXPLOSION_SMALL, p_155229_, p_155230_) { class BlockEntityExplosionDebugger(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(MBlockEntities.DEBUG_EXPLOSION_SMALL, p_155229_, p_155230_) {
private var hive: ExplosionRayHive? = null private var hive: ExplosionRayHive? = null
fun tick() { fun tick() {
@ -33,7 +33,7 @@ class BlockEntityExplosionDebugger(p_155229_: BlockPos, p_155230_: BlockState) :
} }
} }
class BlockEntitySphereDebugger(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(Registry.BlockEntities.DEBUG_SPHERE_POINTS, p_155229_, p_155230_) { class BlockEntitySphereDebugger(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(MBlockEntities.DEBUG_SPHERE_POINTS, p_155229_, p_155230_) {
private var placed = false private var placed = false
fun tick() { fun tick() {

View File

@ -19,7 +19,7 @@ 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 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

View File

@ -31,13 +31,13 @@ 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 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.Fraction
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.set import ru.dbotthepony.mc.otm.set
import java.util.* import java.util.*
@ -324,7 +324,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(Registry.Names.POWER_CONSUMED, drained.toInt() * 10) ent.awardStat(MNames.POWER_CONSUMED, drained.toInt() * 10)
} }
return drained return drained
@ -338,7 +338,7 @@ open class AndroidCapability(@JvmField protected val ent: LivingEntity) : ICapab
battery = new battery = new
if (ent is ServerPlayer) { if (ent is ServerPlayer) {
ent.awardStat(Registry.Names.POWER_CONSUMED, drained.toInt() * 10) ent.awardStat(MNames.POWER_CONSUMED, drained.toInt() * 10)
} }
} }

View File

@ -13,14 +13,15 @@ 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 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.core.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.network.android.AndroidResearchPacket 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.MNames
import ru.dbotthepony.mc.otm.set import ru.dbotthepony.mc.otm.set
import java.util.* import java.util.*
@ -221,7 +222,7 @@ class AndroidCapabilityPlayer(@JvmField val ply: Player) : AndroidCapability(ply
// TODO: Maybe passive drain? // TODO: Maybe passive drain?
// extractEnergyInner(BigDecimal.valueOf(new Random().nextDouble()), false); // extractEnergyInner(BigDecimal.valueOf(new Random().nextDouble()), false);
if (ply.isSwimming && !hasFeature(Registry.AndroidFeatures.AIR_BAGS)) { if (ply.isSwimming && !hasFeature(AndroidFeatures.AIR_BAGS)) {
ply.isSwimming = false ply.isSwimming = false
} }
@ -259,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(Registry.Names.ANDROID_CAPABILITY, AndroidCapabilityPlayer(ent)) event.addCapability(MNames.ANDROID_CAPABILITY, AndroidCapabilityPlayer(ent))
} }
} }

View File

@ -12,12 +12,12 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
import net.minecraft.network.chat.TranslatableComponent import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
import org.lwjgl.opengl.GL30 import org.lwjgl.opengl.GL30
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.menu.FormattingHelper import ru.dbotthepony.mc.otm.menu.FormattingHelper
import ru.dbotthepony.mc.otm.registry.MItems
import kotlin.math.PI import kotlin.math.PI
private const val BEAM_WIDTH = 0.2 private const val BEAM_WIDTH = 0.2
@ -112,7 +112,7 @@ class BlackHoleRenderer(private val context: BlockEntityRendererProvider.Context
val ply = Minecraft.getInstance().player val ply = Minecraft.getInstance().player
if (ply != null) { if (ply != null) {
if (ply.mainHandItem.item == Registry.Items.GRAVITATION_STABILIZER || ply.offhandItem.item == Registry.Items.GRAVITATION_STABILIZER) { if (ply.mainHandItem.item == MItems.GRAVITATION_STABILIZER || ply.offhandItem.item == MItems.GRAVITATION_STABILIZER) {
RenderSystem.setShader(GameRenderer::getPositionTexShader) RenderSystem.setShader(GameRenderer::getPositionTexShader)
RenderSystem.setShaderTexture(0, BeaconRenderer.BEAM_LOCATION) RenderSystem.setShaderTexture(0, BeaconRenderer.BEAM_LOCATION)
RenderSystem.disableCull() RenderSystem.disableCull()
@ -143,7 +143,7 @@ class BlackHoleRenderer(private val context: BlockEntityRendererProvider.Context
} }
if (!Minecraft.getInstance().options.hideGui && ( if (!Minecraft.getInstance().options.hideGui && (
(ply.mainHandItem.item == Registry.Items.BLACK_HOLE_SCANNER || ply.offhandItem.item == Registry.Items.BLACK_HOLE_SCANNER) && (ply.mainHandItem.item == MItems.BLACK_HOLE_SCANNER || ply.offhandItem.item == MItems.BLACK_HOLE_SCANNER) &&
poseStack.translation().length() < tile.gravitationStrength * 64.0 || poseStack.translation().length() < tile.gravitationStrength * 64.0 ||
(ply.abilities.instabuild || ply.abilities.invulnerable || (ply.abilities.instabuild || ply.abilities.invulnerable ||
ply.getCapability(MatteryCapability.ANDROID).isPresent && ply.getCapability(MatteryCapability.ANDROID).isPresent &&

View File

@ -6,7 +6,7 @@ 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 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

View File

@ -7,7 +7,7 @@ import mezz.jei.api.registration.IRecipeCatalystRegistration
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry import ru.dbotthepony.mc.otm.registry.MBlocks
@JeiPlugin @JeiPlugin
class JEIPlugin : IModPlugin { class JEIPlugin : IModPlugin {
@ -20,6 +20,6 @@ class JEIPlugin : IModPlugin {
} }
override fun registerRecipeCatalysts(registration: IRecipeCatalystRegistration) { override fun registerRecipeCatalysts(registration: IRecipeCatalystRegistration) {
registration.addRecipeCatalyst(ItemStack(Registry.Blocks.CHEMICAL_GENERATOR), VanillaRecipeCategoryUid.FUEL) registration.addRecipeCatalyst(ItemStack(MBlocks.CHEMICAL_GENERATOR), VanillaRecipeCategoryUid.FUEL)
} }
} }

View File

@ -1,11 +1,6 @@
package ru.dbotthepony.mc.otm.item package ru.dbotthepony.mc.otm.item
import net.minecraft.client.model.HumanoidModel import net.minecraft.client.model.HumanoidModel
import net.minecraft.client.model.geom.PartPose
import net.minecraft.client.model.geom.builders.CubeDeformation
import net.minecraft.client.model.geom.builders.CubeListBuilder
import net.minecraft.client.model.geom.builders.LayerDefinition
import net.minecraft.client.model.geom.builders.MeshDefinition
import net.minecraft.sounds.SoundEvent import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.Entity import net.minecraft.world.entity.Entity
@ -18,8 +13,8 @@ import net.minecraft.world.item.Rarity
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraftforge.client.IItemRenderProperties import net.minecraftforge.client.IItemRenderProperties
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel
import ru.dbotthepony.mc.otm.registry.MTags
import java.util.function.Consumer import java.util.function.Consumer
@ -48,7 +43,7 @@ private object TritaniumArmorMaterial : ArmorMaterial {
override fun getEnchantmentValue() = 9 override fun getEnchantmentValue() = 9
override fun getEquipSound(): SoundEvent = SoundEvents.ARMOR_EQUIP_GENERIC override fun getEquipSound(): SoundEvent = SoundEvents.ARMOR_EQUIP_GENERIC
override fun getRepairIngredient(): Ingredient = Ingredient.of(Registry.Tags.Items.INGOT_TRITANIUM) override fun getRepairIngredient(): Ingredient = Ingredient.of(MTags.Items.INGOT_TRITANIUM)
const val ID = "${OverdriveThatMatters.MOD_ID}:tritanium_armor" const val ID = "${OverdriveThatMatters.MOD_ID}:tritanium_armor"

View File

@ -9,8 +9,9 @@ import net.minecraft.world.item.crafting.RecipeType
import net.minecraftforge.event.server.ServerStartedEvent import net.minecraftforge.event.server.ServerStartedEvent
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
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRecipes
/** /**
* baselineComplexityReplicateTicks * complexity = replicate ticks * baselineComplexityReplicateTicks * complexity = replicate ticks
@ -139,7 +140,7 @@ fun serverStartData(event: ServerStartedEvent) {
floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.BLASTING)) floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.BLASTING))
floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.SMOKING)) floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.SMOKING))
floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.STONECUTTING)) floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.STONECUTTING))
floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(Registry.Recipes.PLATE_PRESS)) floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(MRecipes.PLATE_PRESS))
floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.CRAFTING)) floodRecipeCategory(event.server.recipeManager.getAllRecipesFor(RecipeType.CRAFTING))
for (item in mappedInputs.keys) { for (item in mappedInputs.keys) {
@ -341,7 +342,7 @@ private fun registerRoots() {
make(Items.AMETHYST_SHARD, AMETHYST) make(Items.AMETHYST_SHARD, AMETHYST)
make(Items.DIAMOND, DIAMOND) make(Items.DIAMOND, DIAMOND)
make(Items.IRON_INGOT, IRON) make(Items.IRON_INGOT, IRON)
make(Registry.Items.TRITANIUM_INGOT, TRITANIUM) make(MItems.TRITANIUM_INGOT, TRITANIUM)
make(Items.COPPER_INGOT, COPPER) make(Items.COPPER_INGOT, COPPER)
make(Items.LAPIS_LAZULI, LAPIS) make(Items.LAPIS_LAZULI, LAPIS)
make(Items.REDSTONE, REDSTONE) make(Items.REDSTONE, REDSTONE)

View File

@ -4,10 +4,10 @@ import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityAndroidStation import ru.dbotthepony.mc.otm.block.entity.BlockEntityAndroidStation
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability
import ru.dbotthepony.mc.otm.registry.MMenus
private class AndroidStationContainer(val player: Player) : SimpleContainer(1) { private class AndroidStationContainer(val player: Player) : SimpleContainer(1) {
var android: IAndroidCapability? = null var android: IAndroidCapability? = null
@ -33,7 +33,7 @@ class AndroidStationMenu @JvmOverloads constructor(
containerID: Int, containerID: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityAndroidStation? = null tile: BlockEntityAndroidStation? = null
) : MenuMatteryPowered(Registry.Menus.ANDROID_STATION, containerID, inventory, tile) { ) : MenuMatteryPowered(MMenus.ANDROID_STATION, containerID, inventory, tile) {
val androidBattery: MatterySlot = AndroidBatterySlot(AndroidStationContainer(inventory.player), 0) val androidBattery: MatterySlot = AndroidBatterySlot(AndroidStationContainer(inventory.player), 0)
init { init {

View File

@ -5,16 +5,16 @@ import kotlin.jvm.JvmOverloads
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.BlockEntityBatteryBank import ru.dbotthepony.mc.otm.block.entity.BlockEntityBatteryBank
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.orNull import ru.dbotthepony.mc.otm.orNull
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuBatteryBank @JvmOverloads constructor( class MenuBatteryBank @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityBatteryBank? = null, tile: BlockEntityBatteryBank? = null,
) : MatteryMenu(Registry.Menus.BATTERY_BANK, p_38852_, inventory, tile) { ) : MatteryMenu(MMenus.BATTERY_BANK, p_38852_, inventory, tile) {
val powerLevel: LevelGaugeWidget val powerLevel: LevelGaugeWidget
val containerSlots: Array<BatterySlot> val containerSlots: Array<BatterySlot>

View File

@ -3,14 +3,14 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityCargoCrate import ru.dbotthepony.mc.otm.block.entity.BlockEntityCargoCrate
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuCargoCrate @JvmOverloads constructor( class MenuCargoCrate @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityCargoCrate? = null tile: BlockEntityCargoCrate? = null
) : MatteryMenu(Registry.Menus.CARGO_CRATE, p_38852_, inventory, tile) { ) : MatteryMenu(MMenus.CARGO_CRATE, p_38852_, inventory, tile) {
val crateSlots: Array<MatterySlot> val crateSlots: Array<MatterySlot>
init { init {

View File

@ -5,14 +5,14 @@ import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraftforge.common.ForgeHooks import net.minecraftforge.common.ForgeHooks
import net.minecraftforge.energy.CapabilityEnergy import net.minecraftforge.energy.CapabilityEnergy
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityChemicalGenerator import ru.dbotthepony.mc.otm.block.entity.BlockEntityChemicalGenerator
import ru.dbotthepony.mc.otm.menu.data.IntDataContainer import ru.dbotthepony.mc.otm.menu.data.IntDataContainer
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuChemicalGenerator @JvmOverloads constructor(id: Int, inv: Inventory, tile: BlockEntityChemicalGenerator? = null) class MenuChemicalGenerator @JvmOverloads constructor(id: Int, inv: Inventory, tile: BlockEntityChemicalGenerator? = null)
: MatteryMenu(Registry.Menus.CHEMICAL_GENERATOR, id, inv, tile) { : MatteryMenu(MMenus.CHEMICAL_GENERATOR, id, inv, tile) {
val container = tile?.container ?: SimpleContainer(3) val container = tile?.container ?: SimpleContainer(3)

View File

@ -2,14 +2,14 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuDriveRack @JvmOverloads constructor( class MenuDriveRack @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityDriveRack? = null tile: BlockEntityDriveRack? = null
) : MenuMatteryPowered(Registry.Menus.DRIVE_RACK, p_38852_, inventory, tile) { ) : MenuMatteryPowered(MMenus.DRIVE_RACK, p_38852_, inventory, tile) {
val drives = arrayOfNulls<MatterySlot>(4) val drives = arrayOfNulls<MatterySlot>(4)
init { init {

View File

@ -7,7 +7,6 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraftforge.energy.CapabilityEnergy import net.minecraftforge.energy.CapabilityEnergy
import net.minecraftforge.network.NetworkEvent import net.minecraftforge.network.NetworkEvent
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive
@ -15,6 +14,7 @@ import ru.dbotthepony.mc.otm.item.ItemPortableCondensationDrive
import ru.dbotthepony.mc.otm.item.ItemPortableCondensationDrive.FilterSettings import ru.dbotthepony.mc.otm.item.ItemPortableCondensationDrive.FilterSettings
import ru.dbotthepony.mc.otm.menu.data.INetworkedItemViewSupplier import ru.dbotthepony.mc.otm.menu.data.INetworkedItemViewSupplier
import ru.dbotthepony.mc.otm.menu.data.NetworkedItemView import ru.dbotthepony.mc.otm.menu.data.NetworkedItemView
import ru.dbotthepony.mc.otm.registry.MMenus
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent
import java.util.function.Supplier import java.util.function.Supplier
@ -24,7 +24,7 @@ class MenuDriveViewer @JvmOverloads constructor(
inventory: Inventory, inventory: Inventory,
tile: BlockEntityDriveViewer? = null tile: BlockEntityDriveViewer? = null
) : MenuMatteryPowered( ) : MenuMatteryPowered(
Registry.Menus.DRIVE_VIEWER, containerID, inventory, tile MMenus.DRIVE_VIEWER, containerID, inventory, tile
), INetworkedItemViewSupplier { ), INetworkedItemViewSupplier {
@JvmField val view: NetworkedItemView @JvmField val view: NetworkedItemView
private val powered: PoweredVirtualComponent<ItemStackWrapper>? private val powered: PoweredVirtualComponent<ItemStackWrapper>?

View File

@ -2,16 +2,15 @@ package ru.dbotthepony.mc.otm.menu
import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmOverloads
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter import ru.dbotthepony.mc.otm.block.entity.BlockEntityEnergyCounter
import ru.dbotthepony.mc.otm.menu.data.FractionDataContainer
import ru.dbotthepony.mc.otm.menu.data.ImpreciseFractionDataContainer import ru.dbotthepony.mc.otm.menu.data.ImpreciseFractionDataContainer
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuEnergyCounter @JvmOverloads constructor( class MenuEnergyCounter @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityEnergyCounter? = null tile: BlockEntityEnergyCounter? = null
) : MatteryMenu(Registry.Menus.ENERGY_COUNTER, p_38852_, inventory, tile) { ) : MatteryMenu(MMenus.ENERGY_COUNTER, p_38852_, inventory, tile) {
@JvmField val passed = ImpreciseFractionDataContainer() @JvmField val passed = ImpreciseFractionDataContainer()
@JvmField val average = ImpreciseFractionDataContainer() @JvmField val average = ImpreciseFractionDataContainer()
@JvmField val last20Ticks = ImpreciseFractionDataContainer() @JvmField val last20Ticks = ImpreciseFractionDataContainer()

View File

@ -3,11 +3,11 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.menu.data.INetworkedItemViewSupplier import ru.dbotthepony.mc.otm.menu.data.INetworkedItemViewSupplier
import ru.dbotthepony.mc.otm.menu.data.NetworkedItemView import ru.dbotthepony.mc.otm.menu.data.NetworkedItemView
import ru.dbotthepony.mc.otm.registry.MMenus
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent import ru.dbotthepony.mc.otm.storage.PoweredVirtualComponent
import ru.dbotthepony.mc.otm.storage.VirtualComponent import ru.dbotthepony.mc.otm.storage.VirtualComponent
@ -16,7 +16,7 @@ class MenuItemMonitor @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityItemMonitor? = null tile: BlockEntityItemMonitor? = null
) : MenuMatteryPowered(Registry.Menus.ITEM_MONITOR, p_38852_, inventory, tile), INetworkedItemViewSupplier { ) : MenuMatteryPowered(MMenus.ITEM_MONITOR, p_38852_, inventory, tile), INetworkedItemViewSupplier {
@JvmField @JvmField
val view = NetworkedItemView(inventory.player, this, tile == null) val view = NetworkedItemView(inventory.player, this, tile == null)
private val subscribed: VirtualComponent<ItemStackWrapper>? private val subscribed: VirtualComponent<ItemStackWrapper>?

View File

@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterBottler import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterBottler
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.matter.MatterDirection import ru.dbotthepony.mc.otm.capability.matter.MatterDirection
@ -12,13 +11,14 @@ import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.network.MatterBottlerSwitchPacket import ru.dbotthepony.mc.otm.network.MatterBottlerSwitchPacket
import ru.dbotthepony.mc.otm.network.MatteryNetworking import ru.dbotthepony.mc.otm.network.MatteryNetworking
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuMatterBottler @JvmOverloads constructor( class MenuMatterBottler @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterBottler? = null tile: BlockEntityMatterBottler? = null
) : MenuMatteryPowered( ) : MenuMatteryPowered(
Registry.Menus.MATTER_BOTTLER, p_38852_, inventory, tile MMenus.MATTER_BOTTLER, p_38852_, inventory, tile
) { ) {
var workFlow = BooleanDataContainer() var workFlow = BooleanDataContainer()

View File

@ -2,19 +2,18 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCapacitorBank import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCapacitorBank
import ru.dbotthepony.mc.otm.core.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph 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
class MenuMatterCapacitor @JvmOverloads constructor( class MenuMatterCapacitor @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterCapacitorBank? = null tile: BlockEntityMatterCapacitorBank? = null
) : MatteryMenu( ) : MatteryMenu(
Registry.Menus.MATTER_CAPACITOR_BANK, p_38852_, inventory, tile MMenus.MATTER_CAPACITOR_BANK, p_38852_, inventory, tile
) { ) {
val matterGauge: LevelGaugeWidget val matterGauge: LevelGaugeWidget
val totalMatterGauge: LevelGaugeWidget val totalMatterGauge: LevelGaugeWidget

View File

@ -7,16 +7,16 @@ import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.matter.canDecompose import ru.dbotthepony.mc.otm.matter.canDecompose
import ru.dbotthepony.mc.otm.orNull import ru.dbotthepony.mc.otm.orNull
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuMatterDecomposer @JvmOverloads constructor( class MenuMatterDecomposer @JvmOverloads constructor(
containerID: Int, containerID: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterDecomposer? = null tile: BlockEntityMatterDecomposer? = null
) : MenuMatteryPowered(Registry.Menus.MATTER_DECOMPOSER, containerID, inventory, tile) { ) : MenuMatteryPowered(MMenus.MATTER_DECOMPOSER, containerID, inventory, tile) {
val input: MatterySlot val input: MatterySlot
val outputMain: MachineOutputSlot val outputMain: MachineOutputSlot
val outputStacking: MachineOutputSlot val outputStacking: MachineOutputSlot

View File

@ -5,7 +5,6 @@ import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraftforge.network.PacketDistributor import net.minecraftforge.network.PacketDistributor
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterPanel import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterPanel
import ru.dbotthepony.mc.otm.capability.matter.MatterTask import ru.dbotthepony.mc.otm.capability.matter.MatterTask
import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.capability.matter.PatternState
@ -15,6 +14,7 @@ import ru.dbotthepony.mc.otm.network.CancelMatterTaskPacket
import ru.dbotthepony.mc.otm.network.MatterTaskPacket import ru.dbotthepony.mc.otm.network.MatterTaskPacket
import ru.dbotthepony.mc.otm.network.MatteryNetworking import ru.dbotthepony.mc.otm.network.MatteryNetworking
import ru.dbotthepony.mc.otm.network.PatternGridPacket import ru.dbotthepony.mc.otm.network.PatternGridPacket
import ru.dbotthepony.mc.otm.registry.MMenus
import java.util.* import java.util.*
import java.util.function.Consumer import java.util.function.Consumer
@ -22,7 +22,7 @@ class MenuMatterPanel @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterPanel? = null tile: BlockEntityMatterPanel? = null
) : MatteryMenu(Registry.Menus.MATTER_PANEL, p_38852_, inventory, tile), IMatterGraphListener { ) : MatteryMenu(MMenus.MATTER_PANEL, p_38852_, inventory, tile), IMatterGraphListener {
fun taskUpdated(task: MatterTask) { fun taskUpdated(task: MatterTask) {
sendNetwork(MatterTaskPacket(true, listOf(task))) sendNetwork(MatterTaskPacket(true, listOf(task)))
} }

View File

@ -3,17 +3,17 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterRecycler import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterRecycler
import ru.dbotthepony.mc.otm.item.ItemMatterDust import ru.dbotthepony.mc.otm.item.ItemMatterDust
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuMatterRecycler @JvmOverloads constructor( class MenuMatterRecycler @JvmOverloads constructor(
containerID: Int, containerID: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterRecycler? = null tile: BlockEntityMatterRecycler? = null
) : MenuMatteryPowered(Registry.Menus.MATTER_RECYCLER, containerID, inventory, tile) { ) : MenuMatteryPowered(MMenus.MATTER_RECYCLER, containerID, inventory, tile) {
val input: MatterySlot val input: MatterySlot
val progress: ProgressGaugeWidget val progress: ProgressGaugeWidget
val matter = LevelGaugeWidget(this, tile?.matter) val matter = LevelGaugeWidget(this, tile?.matter)

View File

@ -6,14 +6,14 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterReplicator
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import ru.dbotthepony.mc.otm.Registry import ru.dbotthepony.mc.otm.registry.MMenus
class MenuMatterReplicator @JvmOverloads constructor( class MenuMatterReplicator @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterReplicator? = null tile: BlockEntityMatterReplicator? = null
) : MenuMatteryPowered( ) : MenuMatteryPowered(
Registry.Menus.MATTER_REPLICATOR, p_38852_, inventory, tile MMenus.MATTER_REPLICATOR, p_38852_, inventory, tile
) { ) {
val matter: LevelGaugeWidget val matter: LevelGaugeWidget
val progress: ProgressGaugeWidget val progress: ProgressGaugeWidget

View File

@ -7,9 +7,9 @@ import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.matter.canDecompose import ru.dbotthepony.mc.otm.matter.canDecompose
import ru.dbotthepony.mc.otm.registry.MMenus
import java.math.BigInteger import java.math.BigInteger
class MenuMatterScanner @JvmOverloads constructor( class MenuMatterScanner @JvmOverloads constructor(
@ -17,7 +17,7 @@ class MenuMatterScanner @JvmOverloads constructor(
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatterScanner? = null tile: BlockEntityMatterScanner? = null
) : MenuMatteryPowered( ) : MenuMatteryPowered(
Registry.Menus.MATTER_SCANNER, p_38852_, inventory, tile MMenus.MATTER_SCANNER, p_38852_, inventory, tile
) { ) {
val input: MatterySlot val input: MatterySlot
val progress: ProgressGaugeWidget val progress: ProgressGaugeWidget

View File

@ -2,19 +2,18 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPatternStorage import ru.dbotthepony.mc.otm.block.entity.BlockEntityPatternStorage
import ru.dbotthepony.mc.otm.core.Fraction
import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ImpreciseFraction
import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph 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
class MenuPatternStorage @JvmOverloads constructor( class MenuPatternStorage @JvmOverloads constructor(
p_38852_: Int, p_38852_: Int,
inventory: Inventory?, inventory: Inventory?,
tile: BlockEntityPatternStorage? = null tile: BlockEntityPatternStorage? = null
) : MatteryMenu( ) : MatteryMenu(
Registry.Menus.PATTERN_STORAGE, p_38852_, inventory!!, tile MMenus.PATTERN_STORAGE, p_38852_, inventory!!, tile
) { ) {
val pattern_slots = arrayOfNulls<PatternSlot>(2 * 4) val pattern_slots = arrayOfNulls<PatternSlot>(2 * 4)
val stored_this: LevelGaugeWidget val stored_this: LevelGaugeWidget

View File

@ -2,15 +2,15 @@ package ru.dbotthepony.mc.otm.menu
import net.minecraft.world.SimpleContainer import net.minecraft.world.SimpleContainer
import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus
class MenuPlatePress @JvmOverloads constructor( class MenuPlatePress @JvmOverloads constructor(
containerID: Int, containerID: Int,
inventory: Inventory, inventory: Inventory,
tile: BlockEntityPlatePress? = null tile: BlockEntityPlatePress? = null
) : MenuMatteryPowered(Registry.Menus.PLATE_PRESS, containerID, inventory, tile) { ) : MenuMatteryPowered(MMenus.PLATE_PRESS, containerID, inventory, tile) {
val container = tile?.container ?: SimpleContainer(2) val container = tile?.container ?: SimpleContainer(2)
val inputSlot = MatterySlot(container, BlockEntityPlatePress.SLOT_INPUT) val inputSlot = MatterySlot(container, BlockEntityPlatePress.SLOT_INPUT)

View File

@ -15,9 +15,10 @@ import net.minecraft.world.level.Level
import net.minecraftforge.registries.ForgeRegistryEntry import net.minecraftforge.registries.ForgeRegistryEntry
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress
import ru.dbotthepony.mc.otm.get import ru.dbotthepony.mc.otm.get
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRecipes
class PlatePressRecipe( class PlatePressRecipe(
private val id: ResourceLocation, private val id: ResourceLocation,
@ -78,7 +79,7 @@ class PlatePressRecipe(
return PlatePressRecipeFactory return PlatePressRecipeFactory
} }
override fun getType(): RecipeType<PlatePressRecipe> = Registry.Recipes.PLATE_PRESS override fun getType(): RecipeType<PlatePressRecipe> = MRecipes.PLATE_PRESS
} }
object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), RecipeSerializer<PlatePressRecipe> { object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), RecipeSerializer<PlatePressRecipe> {
@ -86,7 +87,7 @@ object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), Reci
private val LOGGER = LogManager.getLogger() private val LOGGER = LogManager.getLogger()
init { init {
registryName = Registry.Names.PLATE_PRESS registryName = MNames.PLATE_PRESS
} }
override fun fromJson(loc: ResourceLocation, obj: JsonObject): PlatePressRecipe { override fun fromJson(loc: ResourceLocation, obj: JsonObject): PlatePressRecipe {