Creative tabs updated
This commit is contained in:
parent
9be9e9756b
commit
30929fc7e6
@ -71,20 +71,6 @@ public final class OverdriveThatMatters {
|
||||
return new ResourceLocation(MOD_ID, path);
|
||||
}
|
||||
|
||||
public final CreativeModeTab CREATIVE_TAB = new CreativeModeTab("otm") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(MItems.INSTANCE.getBATTERY_CREATIVE(), 1);
|
||||
}
|
||||
};
|
||||
|
||||
public final CreativeModeTab CREATIVE_TAB_DECORATIVE = new CreativeModeTab("otm_decorative") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(MRegistry.INSTANCE.getVENT().getItem(), 1);
|
||||
}
|
||||
};
|
||||
|
||||
private static void checkIfKotlinIsInstalled() {
|
||||
if (!KotlinVersion.CURRENT.isAtLeast(1, 6, 10)) {
|
||||
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.6.10 is required.");
|
||||
@ -132,6 +118,7 @@ public final class OverdriveThatMatters {
|
||||
modBus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
|
||||
modBus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
|
||||
modBus.addListener(EventPriority.NORMAL, WidgetAtlasHolder::register);
|
||||
modBus.addListener(EventPriority.NORMAL, MCreativeTabs.INSTANCE::populate);
|
||||
});
|
||||
|
||||
ClientConfig.INSTANCE.register();
|
||||
|
@ -825,21 +825,18 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
||||
|
||||
fun onPlayerCloneEvent(event: PlayerEvent.Clone) {
|
||||
val it = event.entity.matteryPlayer ?: return
|
||||
var original = event.original.matteryPlayer
|
||||
|
||||
var resolver = event.original.getCapability(MatteryCapability.MATTERY_PLAYER)
|
||||
|
||||
if (!resolver.isPresent || resolver.resolve().isEmpty) {
|
||||
if (original == null) {
|
||||
event.original.reviveCaps()
|
||||
resolver = event.original.getCapability(MatteryCapability.MATTERY_PLAYER)
|
||||
original = event.original.matteryPlayer
|
||||
}
|
||||
|
||||
if (!resolver.isPresent || resolver.resolve().isEmpty) {
|
||||
if (original == null) {
|
||||
event.original.invalidateCaps()
|
||||
return
|
||||
}
|
||||
|
||||
val original = resolver.resolve().get()
|
||||
|
||||
if (original.willBecomeAndroid && event.isWasDeath) {
|
||||
original.becomeAndroid()
|
||||
|
||||
|
@ -59,7 +59,7 @@ fun getSweepingDamageRatioHook(ply: LivingEntity): Float? {
|
||||
return null
|
||||
}
|
||||
|
||||
class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)), Vanishable {
|
||||
class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vanishable {
|
||||
val chargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||
val dischargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||
|
||||
|
@ -68,7 +68,7 @@ private object TritaniumArmorRenderProperties : IClientItemExtensions {
|
||||
}
|
||||
}
|
||||
|
||||
class ItemTritaniumArmor(slot: EquipmentSlot) : ArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) {
|
||||
class ItemTritaniumArmor(slot: EquipmentSlot) : ArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
|
||||
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
||||
super.initializeClient(consumer)
|
||||
consumer.accept(TritaniumArmorRenderProperties)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ru.dbotthepony.mc.otm.item.weapon
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.math.Vector3f
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.model.HumanoidModel
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms
|
||||
@ -131,8 +130,7 @@ open class WeaponDataTable(val tag: CompoundTag) {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, rarity: Rarity = Rarity.UNCOMMON) : Item(
|
||||
Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(1).rarity(rarity)) {
|
||||
abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, properties: Properties = Properties().stacksTo(1).rarity(Rarity.RARE)) : Item(properties) {
|
||||
fun makeDataTable(tag: CompoundTag) = tables.primaryConstructor!!.call(tag)
|
||||
|
||||
/**
|
||||
|
161
src/main/kotlin/ru/dbotthepony/mc/otm/registry/CreativeTabs.kt
Normal file
161
src/main/kotlin/ru/dbotthepony/mc/otm/registry/CreativeTabs.kt
Normal file
@ -0,0 +1,161 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.world.item.CreativeModeTab
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.Item
|
||||
|
||||
private fun CreativeModeTab.Output.accept(values: Collection<Item>) {
|
||||
for (item in values) {
|
||||
accept(item)
|
||||
}
|
||||
}
|
||||
|
||||
private fun CreativeModeTab.Output.base(values: Map<DyeColor?, Item>) {
|
||||
accept(values[null]!!)
|
||||
}
|
||||
|
||||
private val colorOrder = listOf(
|
||||
null,
|
||||
DyeColor.WHITE,
|
||||
DyeColor.ORANGE,
|
||||
DyeColor.MAGENTA,
|
||||
DyeColor.LIGHT_BLUE,
|
||||
DyeColor.YELLOW,
|
||||
DyeColor.LIME,
|
||||
DyeColor.PINK,
|
||||
DyeColor.GRAY,
|
||||
DyeColor.LIGHT_GRAY,
|
||||
DyeColor.CYAN,
|
||||
DyeColor.PURPLE,
|
||||
DyeColor.BLUE,
|
||||
DyeColor.BROWN,
|
||||
DyeColor.GREEN,
|
||||
DyeColor.RED,
|
||||
DyeColor.BLACK,
|
||||
)
|
||||
|
||||
private fun CreativeModeTab.Output.colored(values: Map<out DyeColor?, Item>) {
|
||||
accept(values[DyeColor.WHITE]!!)
|
||||
accept(values[DyeColor.ORANGE]!!)
|
||||
accept(values[DyeColor.MAGENTA]!!)
|
||||
accept(values[DyeColor.LIGHT_BLUE]!!)
|
||||
accept(values[DyeColor.YELLOW]!!)
|
||||
accept(values[DyeColor.LIME]!!)
|
||||
accept(values[DyeColor.PINK]!!)
|
||||
accept(values[DyeColor.GRAY]!!)
|
||||
accept(values[DyeColor.LIGHT_GRAY]!!)
|
||||
accept(values[DyeColor.CYAN]!!)
|
||||
accept(values[DyeColor.PURPLE]!!)
|
||||
accept(values[DyeColor.BLUE]!!)
|
||||
accept(values[DyeColor.BROWN]!!)
|
||||
accept(values[DyeColor.GREEN]!!)
|
||||
accept(values[DyeColor.RED]!!)
|
||||
accept(values[DyeColor.BLACK]!!)
|
||||
}
|
||||
|
||||
private fun CreativeModeTab.Output.all(values: Map<DyeColor?, Item>) {
|
||||
base(values)
|
||||
colored(values)
|
||||
}
|
||||
|
||||
internal fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
|
||||
with(consumer) {
|
||||
accept(MItems.MACHINES)
|
||||
|
||||
accept(MRegistry.CARGO_CRATES.item)
|
||||
|
||||
base(MItems.TRITANIUM_DOOR)
|
||||
base(MItems.TRITANIUM_TRAPDOOR)
|
||||
|
||||
accept(MItems.MATTER_DUST)
|
||||
|
||||
accept(MItems.TRITANIUM_ORE_CLUMP)
|
||||
accept(MItems.TRITANIUM_DUST)
|
||||
accept(MItems.TRITANIUM_INGOT)
|
||||
accept(MItems.TRITANIUM_INGOT_BLOCK)
|
||||
|
||||
accept(MItems.TRITANIUM_TOOLS)
|
||||
accept(MItems.TRITANIUM_ARMOR)
|
||||
|
||||
accept(MItems.ENERGY_SWORD)
|
||||
accept(MItems.PLASMA_RIFLE)
|
||||
|
||||
accept(MItems.BLACK_HOLE_SCANNER)
|
||||
accept(MItems.GRAVITATION_FIELD_LIMITER)
|
||||
accept(MItems.GRAVITATION_FIELD_SENSOR)
|
||||
accept(MItems.PORTABLE_GRAVITATION_STABILIZER)
|
||||
accept(MItems.BLACK_HOLE)
|
||||
accept(MItems.GRAVITATIONAL_DISRUPTOR)
|
||||
|
||||
accept(MItems.ALL_BATTERIES)
|
||||
accept(MItems.MATTER_CAPACITORS)
|
||||
|
||||
base(MItems.CARGO_CRATE_MINECARTS)
|
||||
|
||||
accept(MItems.NUTRIENT_PASTE)
|
||||
|
||||
// exo
|
||||
accept(MItems.EXOPACK_PROBE)
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE)
|
||||
accept(MItems.ExopackUpgrades.CRAFTING_UPGRADE)
|
||||
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADE_BIG)
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADE_HUGE)
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER)
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON)
|
||||
|
||||
accept(MItems.ExopackUpgrades.INVENTORY_UPGRADES)
|
||||
// /exo
|
||||
|
||||
accept(MItems.PILLS)
|
||||
|
||||
accept(MItems.COMPONENTS)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
|
||||
with(consumer) {
|
||||
accept(MItems.LABORATORY_LAMP)
|
||||
accept(MItems.LABORATORY_LAMP_INVERTED)
|
||||
accept(MItems.DANGER_STRIPE_BLOCK)
|
||||
accept(MItems.METAL_BEAM)
|
||||
|
||||
accept(MItems.TRITANIUM_STRIPED_BLOCK)
|
||||
accept(MItems.TRITANIUM_STRIPED_STAIRS)
|
||||
accept(MItems.TRITANIUM_STRIPED_SLAB)
|
||||
accept(MItems.TRITANIUM_STRIPED_WALL)
|
||||
accept(MItems.CARBON_FIBRE_BLOCK)
|
||||
|
||||
colored(MItems.TRITANIUM_DOOR)
|
||||
colored(MItems.TRITANIUM_TRAPDOOR)
|
||||
|
||||
colored(MRegistry.CARGO_CRATES.items)
|
||||
|
||||
colored(MItems.CARGO_CRATE_MINECARTS)
|
||||
|
||||
all(MRegistry.DECORATIVE_CRATE.allItems)
|
||||
|
||||
for (color in colorOrder) {
|
||||
accept(MRegistry.TRITANIUM_BLOCK.allItems[color]!!)
|
||||
accept(MRegistry.TRITANIUM_STAIRS.allItems[color]!!)
|
||||
accept(MRegistry.TRITANIUM_SLAB.allItems[color]!!)
|
||||
accept(MRegistry.TRITANIUM_WALL.allItems[color]!!)
|
||||
}
|
||||
|
||||
all(MRegistry.INDUSTRIAL_GLASS.allItems)
|
||||
all(MRegistry.INDUSTRIAL_GLASS_PANE.allItems)
|
||||
|
||||
colored(MRegistry.UNREFINED_FLOOR_TILES.items)
|
||||
colored(MRegistry.FLOOR_TILES.items)
|
||||
colored(MRegistry.FLOOR_TILES_STAIRS.items)
|
||||
colored(MRegistry.FLOOR_TILES_SLAB.items)
|
||||
|
||||
all(MRegistry.VENT.allItems)
|
||||
all(MRegistry.VENT_ALTERNATIVE.allItems)
|
||||
|
||||
accept(MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems)
|
||||
accept(MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems)
|
||||
accept(MRegistry.TRITANIUM_STRIPED_SLAB.flatItems)
|
||||
accept(MRegistry.TRITANIUM_STRIPED_WALL.flatItems)
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import com.google.common.collect.Iterators
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.CreativeModeTab
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.event.CreativeModeTabEvent
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.WriteOnce
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.registry.MItems.BATTERY_CREATIVE
|
||||
|
||||
object MCreativeTabs {
|
||||
var MAIN by WriteOnce<CreativeModeTab>()
|
||||
private set
|
||||
var DECORATIVE by WriteOnce<CreativeModeTab>()
|
||||
private set
|
||||
|
||||
internal fun register(event: CreativeModeTabEvent.Register) {
|
||||
MAIN = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "otm")) {
|
||||
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
||||
|
||||
it.displayItems { features, consumer, flag ->
|
||||
addMainCreativeTabItems(consumer)
|
||||
}
|
||||
}
|
||||
|
||||
DECORATIVE = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "otm_decorative")) {
|
||||
it.icon { ItemStack(MRegistry.VENT.item, 1) }
|
||||
|
||||
it.displayItems { features, consumer, flag ->
|
||||
addDecorativeTabItems(consumer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,8 +21,7 @@ import ru.dbotthepony.mc.otm.item.*
|
||||
import ru.dbotthepony.mc.otm.item.weapon.PlasmaRifleItem
|
||||
|
||||
object MItems {
|
||||
private val DEFAULT_PROPERTIES = Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
||||
private val DEFAULT_PROPERTIES_DECORATIVE = Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE)
|
||||
private val DEFAULT_PROPERTIES = Item.Properties()
|
||||
private val registry: DeferredRegister<Item> = DeferredRegister.create(ForgeRegistries.ITEMS, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
@ -134,7 +133,7 @@ object MItems {
|
||||
BlockTags.NEEDS_IRON_TOOL
|
||||
) { Ingredient.of(TRITANIUM_INGOT) }
|
||||
|
||||
private val TOOLS_PROPRTIES = Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
||||
private val TOOLS_PROPRTIES = Item.Properties()
|
||||
|
||||
val TRITANIUM_SWORD: Item by registry.register(MNames.TRITANIUM_SWORD) { SwordItem(TRITANIUM_COMPONENT, 4, -2.7f, TOOLS_PROPRTIES) }
|
||||
val TRITANIUM_SHOVEL: Item by registry.register(MNames.TRITANIUM_SHOVEL) { ShovelItem(TRITANIUM_COMPONENT, 1.5f, -2.4f, TOOLS_PROPRTIES) }
|
||||
@ -193,6 +192,13 @@ object MItems {
|
||||
val PILL_OBLIVION: Item by registry.register(MNames.PILL_OBLIVION) { PillItem(PillType.OBLIVION) }
|
||||
val PILL_HEAL: Item by registry.register(MNames.PILL_HEAL) { HealPillItem() }
|
||||
|
||||
val PILLS = SupplierList(
|
||||
::PILL_ANDROID,
|
||||
::PILL_HUMANE,
|
||||
::PILL_OBLIVION,
|
||||
::PILL_HEAL,
|
||||
)
|
||||
|
||||
val BATTERY_CRUDE: Item by registry.register(MNames.BATTERY_CRUDE) { CrudeBatteryItem() }
|
||||
val BATTERY_BASIC: Item by registry.register(MNames.BATTERY_BASIC) { BatteryItem(ServerConfig.BATTERY_BASIC) }
|
||||
val BATTERY_NORMAL: Item by registry.register(MNames.BATTERY_NORMAL) { BatteryItem(ServerConfig.BATTERY_NORMAL) }
|
||||
@ -206,11 +212,31 @@ object MItems {
|
||||
val ZPM_BATTERY: Item by registry.register(MNames.ZPM_BATTERY) { ZPMItem() }
|
||||
|
||||
val BATTERIES = SupplierList(
|
||||
{ BATTERY_CRUDE },
|
||||
{ BATTERY_BASIC },
|
||||
{ BATTERY_NORMAL },
|
||||
{ BATTERY_DENSE },
|
||||
{ BATTERY_CAPACITOR },
|
||||
::BATTERY_CRUDE,
|
||||
::BATTERY_BASIC,
|
||||
::BATTERY_NORMAL,
|
||||
::BATTERY_DENSE,
|
||||
::BATTERY_CAPACITOR,
|
||||
)
|
||||
|
||||
val UNIQUE_BATTERIES = SupplierList(
|
||||
::QUANTUM_BATTERY,
|
||||
::QUANTUM_CAPACITOR,
|
||||
::QUANTUM_BATTERY_CREATIVE,
|
||||
::ZPM_BATTERY,
|
||||
)
|
||||
|
||||
val ALL_BATTERIES = SupplierList(
|
||||
::BATTERY_CRUDE,
|
||||
::BATTERY_BASIC,
|
||||
::BATTERY_NORMAL,
|
||||
::BATTERY_DENSE,
|
||||
::BATTERY_CAPACITOR,
|
||||
|
||||
::QUANTUM_BATTERY,
|
||||
::QUANTUM_CAPACITOR,
|
||||
::QUANTUM_BATTERY_CREATIVE,
|
||||
::ZPM_BATTERY,
|
||||
)
|
||||
|
||||
val MATTER_CAPACITOR_BASIC: Item by registry.register(MNames.MATTER_CAPACITOR_BASIC) { MatterCapacitorItem(ServerConfig::MATTER_CAPACITOR_BASIC) }
|
||||
@ -218,6 +244,13 @@ object MItems {
|
||||
val MATTER_CAPACITOR_DENSE: Item by registry.register(MNames.MATTER_CAPACITOR_DENSE) { MatterCapacitorItem(ServerConfig::MATTER_CAPACITOR_DENSE) }
|
||||
val MATTER_CAPACITOR_CREATIVE: Item by registry.register(MNames.MATTER_CAPACITOR_CREATIVE) { MatterCapacitorItem() }
|
||||
|
||||
val MATTER_CAPACITORS = SupplierList(
|
||||
::MATTER_CAPACITOR_BASIC,
|
||||
::MATTER_CAPACITOR_NORMAL,
|
||||
::MATTER_CAPACITOR_DENSE,
|
||||
::MATTER_CAPACITOR_CREATIVE,
|
||||
)
|
||||
|
||||
val PATTERN_DRIVE_NORMAL: Item by registry.register(MNames.PATTERN_DRIVE_NORMAL) { PatternStorageItem(ServerConfig::PATTERN_DRIVE_NORMAL) }
|
||||
val PATTERN_DRIVE_CREATIVE: Item by registry.register(MNames.PATTERN_DRIVE_CREATIVE) { PatternStorageItem() }
|
||||
val PATTERN_DRIVE_CREATIVE2: Item by registry.register(MNames.PATTERN_DRIVE_CREATIVE2) { CreativePatternItem() }
|
||||
@ -225,16 +258,15 @@ object MItems {
|
||||
val PORTABLE_CONDENSATION_DRIVE: Item by registry.register(MNames.PORTABLE_CONDENSATION_DRIVE) { PortableCondensationDriveItem(4000) }
|
||||
val PORTABLE_DENSE_CONDENSATION_DRIVE: Item by registry.register(MNames.PORTABLE_DENSE_CONDENSATION_DRIVE) { PortableCondensationDriveItem(25000) }
|
||||
|
||||
val NUTRIENT_PASTE: Item by registry.register(MNames.NUTRIENT_PASTE) { Item(Item.Properties().stacksTo(64).food(
|
||||
FoodProperties.Builder().meat().nutrition(8).saturationMod(0.9F).build()).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) }
|
||||
val NUTRIENT_PASTE: Item by registry.register(MNames.NUTRIENT_PASTE) { Item(Item.Properties().stacksTo(64).food(FoodProperties.Builder().meat().nutrition(8).saturationMod(0.9F).build())) }
|
||||
|
||||
val LABORATORY_LAMP: Item by registry.register(MNames.LABORATORY_LAMP) { BlockItem(MBlocks.LABORATORY_LAMP, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val LABORATORY_LAMP_INVERTED: Item by registry.register(MNames.LABORATORY_LAMP_INVERTED) { BlockItem(MBlocks.LABORATORY_LAMP_INVERTED, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val DANGER_STRIPE_BLOCK: Item by registry.register(MNames.DANGER_STRIPE_BLOCK) { BlockItem(MBlocks.DANGER_STRIPE_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val METAL_BEAM: Item by registry.register(MNames.METAL_BEAM) { BlockItem(MBlocks.METAL_BEAM, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val LABORATORY_LAMP: Item by registry.register(MNames.LABORATORY_LAMP) { BlockItem(MBlocks.LABORATORY_LAMP, DEFAULT_PROPERTIES) }
|
||||
val LABORATORY_LAMP_INVERTED: Item by registry.register(MNames.LABORATORY_LAMP_INVERTED) { BlockItem(MBlocks.LABORATORY_LAMP_INVERTED, DEFAULT_PROPERTIES) }
|
||||
val DANGER_STRIPE_BLOCK: Item by registry.register(MNames.DANGER_STRIPE_BLOCK) { BlockItem(MBlocks.DANGER_STRIPE_BLOCK, DEFAULT_PROPERTIES) }
|
||||
val METAL_BEAM: Item by registry.register(MNames.METAL_BEAM) { BlockItem(MBlocks.METAL_BEAM, DEFAULT_PROPERTIES) }
|
||||
|
||||
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ -> DoubleHighBlockItem(MBlocks.TRITANIUM_DOOR[color]!!, if (color == null) DEFAULT_PROPERTIES else DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_TRAPDOOR = registry.allColored(MNames.TRITANIUM_TRAPDOOR) { color, _ -> BlockItem(MBlocks.TRITANIUM_TRAPDOOR[color]!!, if (color == null) DEFAULT_PROPERTIES else DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ -> DoubleHighBlockItem(MBlocks.TRITANIUM_DOOR[color]!!, DEFAULT_PROPERTIES) }
|
||||
val TRITANIUM_TRAPDOOR = registry.allColored(MNames.TRITANIUM_TRAPDOOR) { color, _ -> BlockItem(MBlocks.TRITANIUM_TRAPDOOR[color]!!, DEFAULT_PROPERTIES) }
|
||||
|
||||
init {
|
||||
MRegistry.TRITANIUM_PRESSURE_PLATE.registerItems(registry)
|
||||
@ -273,24 +305,54 @@ object MItems {
|
||||
}
|
||||
} }
|
||||
|
||||
/**
|
||||
* List of components for everything else
|
||||
*/
|
||||
val COMPONENTS = SupplierList(
|
||||
::MATTER_IO_PORT,
|
||||
::MATTER_TRANSFORM_MATRIX,
|
||||
::ENERGY_BUS,
|
||||
::ELECTRIC_PARTS,
|
||||
::MACHINE_FRAME,
|
||||
::TRITANIUM_PLATE,
|
||||
::IRON_PLATE,
|
||||
::GOLD_PLATE,
|
||||
::COPPER_WIRING,
|
||||
::GOLD_WIRING,
|
||||
::PORTABLE_CONDENSATION_DRIVE_CASING,
|
||||
::PORTABLE_DENSE_CONDENSATION_DRIVE_CASING,
|
||||
::CIRCUIT_PLATING,
|
||||
::BASIC_CONTROL_CIRCUIT,
|
||||
::ADVANCED_CONTROL_CIRCUIT,
|
||||
::MATTER_CAPACITOR_PARTS,
|
||||
|
||||
::QUANTUM_TRANSCEIVER,
|
||||
::ELECTROMAGNET,
|
||||
::MIRROR_COMPOUND,
|
||||
::MIRROR,
|
||||
)
|
||||
|
||||
/**
|
||||
* List of components for datagen code
|
||||
*/
|
||||
val DATAGEN_COMPONENTS = SupplierList(
|
||||
{ ENERGY_BUS },
|
||||
{ ELECTRIC_PARTS },
|
||||
{ TRITANIUM_PLATE },
|
||||
{ IRON_PLATE },
|
||||
{ GOLD_PLATE },
|
||||
{ COPPER_WIRING },
|
||||
{ GOLD_WIRING },
|
||||
{ CIRCUIT_PLATING },
|
||||
{ BASIC_CONTROL_CIRCUIT },
|
||||
{ ADVANCED_CONTROL_CIRCUIT },
|
||||
{ MATTER_CAPACITOR_PARTS },
|
||||
{ MATTER_IO_PORT },
|
||||
{ MATTER_TRANSFORM_MATRIX },
|
||||
{ QUANTUM_TRANSCEIVER },
|
||||
{ ELECTROMAGNET },
|
||||
{ MIRROR_COMPOUND },
|
||||
{ MIRROR },
|
||||
::ENERGY_BUS,
|
||||
::ELECTRIC_PARTS,
|
||||
::TRITANIUM_PLATE,
|
||||
::IRON_PLATE,
|
||||
::GOLD_PLATE,
|
||||
::COPPER_WIRING,
|
||||
::GOLD_WIRING,
|
||||
::CIRCUIT_PLATING,
|
||||
::BASIC_CONTROL_CIRCUIT,
|
||||
::ADVANCED_CONTROL_CIRCUIT,
|
||||
::MATTER_CAPACITOR_PARTS,
|
||||
::MATTER_IO_PORT,
|
||||
::MATTER_TRANSFORM_MATRIX,
|
||||
::QUANTUM_TRANSCEIVER,
|
||||
::ELECTROMAGNET,
|
||||
::MIRROR_COMPOUND,
|
||||
::MIRROR,
|
||||
)
|
||||
|
||||
val CARGO_CRATE_MINECARTS = registry.allColored(MNames.MINECART_CARGO_CRATE) { color, _ -> MinecartCargoCrateItem(color) }
|
||||
@ -325,11 +387,11 @@ object MItems {
|
||||
MRegistry.TRITANIUM_WALL.registerItems(registry)
|
||||
}
|
||||
|
||||
val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_STRIPED_STAIRS: Item by registry.register(MNames.TRITANIUM_STRIPED_STAIRS) { BlockItem(MBlocks.TRITANIUM_STRIPED_STAIRS, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_STRIPED_SLAB: Item by registry.register(MNames.TRITANIUM_STRIPED_SLAB) { BlockItem(MBlocks.TRITANIUM_STRIPED_SLAB, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_STRIPED_WALL: Item by registry.register(MNames.TRITANIUM_STRIPED_WALL) { BlockItem(MBlocks.TRITANIUM_STRIPED_WALL, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES) }
|
||||
val TRITANIUM_STRIPED_STAIRS: Item by registry.register(MNames.TRITANIUM_STRIPED_STAIRS) { BlockItem(MBlocks.TRITANIUM_STRIPED_STAIRS, DEFAULT_PROPERTIES) }
|
||||
val TRITANIUM_STRIPED_SLAB: Item by registry.register(MNames.TRITANIUM_STRIPED_SLAB) { BlockItem(MBlocks.TRITANIUM_STRIPED_SLAB, DEFAULT_PROPERTIES) }
|
||||
val TRITANIUM_STRIPED_WALL: Item by registry.register(MNames.TRITANIUM_STRIPED_WALL) { BlockItem(MBlocks.TRITANIUM_STRIPED_WALL, DEFAULT_PROPERTIES) }
|
||||
val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES) }
|
||||
|
||||
init {
|
||||
MRegistry.INDUSTRIAL_GLASS.registerItems(registry)
|
||||
|
@ -57,83 +57,84 @@ object MRegistry {
|
||||
features.build(event)
|
||||
}
|
||||
|
||||
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock, baseItemGroup = OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
||||
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock)
|
||||
|
||||
val DECORATIVE_CRATE = DecorativeBlock.simple(MNames.DECORATIVE_CRATE, {
|
||||
val DECORATIVE_CRATE = DecorativeBlock.simple(MNames.DECORATIVE_CRATE) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.SNOW)
|
||||
.sound(SoundType.METAL)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(10f)
|
||||
.destroyTime(1f)
|
||||
})
|
||||
}
|
||||
|
||||
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK, {
|
||||
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(80f)
|
||||
.destroyTime(2.5f)
|
||||
})
|
||||
}
|
||||
|
||||
val TRITANIUM_STAIRS = DecorativeBlock(MNames.TRITANIUM_STAIRS, {
|
||||
val TRITANIUM_STAIRS = DecorativeBlock(MNames.TRITANIUM_STAIRS) {
|
||||
StairBlock(
|
||||
{ TRITANIUM_BLOCK.allBlocks[it]!!.defaultBlockState() },
|
||||
BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
val TRITANIUM_SLAB = DecorativeBlock(MNames.TRITANIUM_SLAB, {
|
||||
val TRITANIUM_SLAB = DecorativeBlock(MNames.TRITANIUM_SLAB) {
|
||||
SlabBlock(BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!))
|
||||
})
|
||||
}
|
||||
|
||||
val TRITANIUM_WALL = DecorativeBlock(MNames.TRITANIUM_WALL, {
|
||||
val TRITANIUM_WALL = DecorativeBlock(MNames.TRITANIUM_WALL) {
|
||||
WallBlock(BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!))
|
||||
})
|
||||
}
|
||||
|
||||
val TRITANIUM_PRESSURE_PLATE = DecorativeBlock(MNames.TRITANIUM_PRESSURE_PLATE, ::TritaniumPressurePlate)
|
||||
|
||||
val VENT = DecorativeBlock.simple(MNames.VENT, {
|
||||
val VENT = DecorativeBlock.simple(MNames.VENT) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(20f)
|
||||
.destroyTime(1.5f)
|
||||
})
|
||||
}
|
||||
|
||||
val VENT_ALTERNATIVE = DecorativeBlock.simple(MNames.VENT_ALTERNATIVE, {
|
||||
val VENT_ALTERNATIVE = DecorativeBlock.simple(MNames.VENT_ALTERNATIVE) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(20f)
|
||||
.destroyTime(1.5f)
|
||||
})
|
||||
}
|
||||
|
||||
val FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.FLOOR_TILES, {
|
||||
val FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.FLOOR_TILES) {
|
||||
BlockBehaviour.Properties.of(Material.STONE, it.materialColor)
|
||||
.sound(SoundType.STONE)
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(1.5f, 6f)
|
||||
})
|
||||
}
|
||||
|
||||
val FLOOR_TILES_STAIRS = ColoredDecorativeBlock(MNames.FLOOR_TILES_STAIRS, {
|
||||
val FLOOR_TILES_STAIRS = ColoredDecorativeBlock(MNames.FLOOR_TILES_STAIRS) {
|
||||
StairBlock(
|
||||
{ FLOOR_TILES.blocks[it]!!.defaultBlockState() },
|
||||
BlockBehaviour.Properties.copy(FLOOR_TILES.blocks[it]!!)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
val FLOOR_TILES_SLAB = ColoredDecorativeBlock(MNames.FLOOR_TILES_SLAB, {
|
||||
val FLOOR_TILES_SLAB = ColoredDecorativeBlock(MNames.FLOOR_TILES_SLAB) {
|
||||
SlabBlock(BlockBehaviour.Properties.copy(FLOOR_TILES.blocks[it]!!))
|
||||
})
|
||||
}
|
||||
|
||||
val UNREFINED_FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.UNREFINED_FLOOR_TILES, {
|
||||
val UNREFINED_FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.UNREFINED_FLOOR_TILES) {
|
||||
BlockBehaviour.Properties.of(Material.CLAY, it.materialColor)
|
||||
.sound(SoundType.GRAVEL)
|
||||
.strength(1f, 2f)
|
||||
})
|
||||
}
|
||||
|
||||
val INDUSTRIAL_GLASS = DecorativeBlock(MNames.INDUSTRIAL_GLASS, { color ->
|
||||
val properties = BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
||||
val INDUSTRIAL_GLASS = DecorativeBlock(MNames.INDUSTRIAL_GLASS) { color ->
|
||||
val properties =
|
||||
BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
||||
.destroyTime(1.5f)
|
||||
.explosionResistance(40f)
|
||||
.requiresCorrectToolForDrops()
|
||||
@ -149,10 +150,11 @@ object MRegistry {
|
||||
}
|
||||
|
||||
return@DecorativeBlock GlassBlock(properties)
|
||||
})
|
||||
}
|
||||
|
||||
val INDUSTRIAL_GLASS_PANE = DecorativeBlock(MNames.INDUSTRIAL_GLASS_PANE, { color ->
|
||||
val properties = BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
||||
val INDUSTRIAL_GLASS_PANE = DecorativeBlock(MNames.INDUSTRIAL_GLASS_PANE) { color ->
|
||||
val properties =
|
||||
BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
||||
.strength(1.25f, 5.0f)
|
||||
.requiresCorrectToolForDrops()
|
||||
.sound(SoundType.GLASS)
|
||||
@ -163,7 +165,7 @@ object MRegistry {
|
||||
}
|
||||
|
||||
return@DecorativeBlock IronBarsBlock(properties)
|
||||
})
|
||||
}
|
||||
|
||||
val CRATE_RED = CrateProperties(MaterialColor.COLOR_RED, "crate_red")
|
||||
val CRATE_BLUE = CrateProperties(MaterialColor.COLOR_BLUE, "crate_blue")
|
||||
@ -225,6 +227,7 @@ object MRegistry {
|
||||
bus.addListener(this::initializeClient)
|
||||
bus.addListener(this::initializeCommon)
|
||||
bus.addListener(MStats::registerVanilla)
|
||||
bus.addListener(MCreativeTabs::register)
|
||||
|
||||
MBlocks.register(bus)
|
||||
MBlockEntities.register(bus)
|
||||
|
@ -8,7 +8,6 @@ import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
import java.util.EnumMap
|
||||
|
||||
@ -19,7 +18,6 @@ import java.util.EnumMap
|
||||
open class ColoredDecorativeBlock(
|
||||
val baseName: String,
|
||||
private val provider: (DyeColor) -> Block,
|
||||
itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE
|
||||
) {
|
||||
var registeredItems = false
|
||||
private set
|
||||
@ -111,7 +109,7 @@ open class ColoredDecorativeBlock(
|
||||
registeredBlocks = true
|
||||
}
|
||||
|
||||
private val properties = Item.Properties().tab(itemGroup).stacksTo(64)
|
||||
private val properties = Item.Properties().stacksTo(64)
|
||||
|
||||
open fun registerItems(registry: DeferredRegister<Item>) {
|
||||
check(itemMap.isEmpty()) { "( ͡° ͜ʖ ͡°) No. \\(• ε •)/ ( ͠° ل͜ ͡°) ( ͠° ͟ ͟ʖ ͡°) (ง ͠° ͟ل͜ ͡°)ง ( ͡°︺͡°) ('ω')" }
|
||||
@ -138,10 +136,10 @@ open class ColoredDecorativeBlock(
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun simple(baseName: String, provider: (DyeColor) -> BlockBehaviour.Properties, itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE): ColoredDecorativeBlock {
|
||||
return ColoredDecorativeBlock(baseName, {
|
||||
fun simple(baseName: String, provider: (DyeColor) -> BlockBehaviour.Properties): ColoredDecorativeBlock {
|
||||
return ColoredDecorativeBlock(baseName) {
|
||||
Block(provider.invoke(it))
|
||||
}, itemGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
import ru.dbotthepony.mc.otm.core.WriteOnce
|
||||
import ru.dbotthepony.mc.otm.registry.MCreativeTabs
|
||||
|
||||
/**
|
||||
* Base + Colored
|
||||
@ -18,9 +18,7 @@ import ru.dbotthepony.mc.otm.core.WriteOnce
|
||||
class DecorativeBlock(
|
||||
baseName: String,
|
||||
private val provider: (DyeColor?) -> Block,
|
||||
itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE,
|
||||
val baseItemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE,
|
||||
) : ColoredDecorativeBlock(baseName, provider, itemGroup) {
|
||||
) : ColoredDecorativeBlock(baseName, provider) {
|
||||
private var _block: RegistryObject<Block> by WriteOnce()
|
||||
private var _item: RegistryObject<Item> by WriteOnce()
|
||||
|
||||
@ -43,15 +41,15 @@ class DecorativeBlock(
|
||||
}
|
||||
|
||||
override fun registerItems(registry: DeferredRegister<Item>) {
|
||||
_item = registry.register(baseName) { BlockItem(_block.get(), Item.Properties().tab(baseItemGroup).stacksTo(64)) }
|
||||
_item = registry.register(baseName) { BlockItem(_block.get(), Item.Properties().stacksTo(64)) }
|
||||
super.registerItems(registry)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun simple(baseName: String, provider: (DyeColor?) -> BlockBehaviour.Properties, itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE): DecorativeBlock {
|
||||
return DecorativeBlock(baseName, {
|
||||
fun simple(baseName: String, provider: (DyeColor?) -> BlockBehaviour.Properties): DecorativeBlock {
|
||||
return DecorativeBlock(baseName) {
|
||||
Block(provider.invoke(it))
|
||||
}, itemGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user