Make main source set compile against 1.19.2
This commit is contained in:
parent
e00f79c736
commit
11e66d50a4
@ -2,8 +2,11 @@ package ru.dbotthepony.mc.otm;
|
|||||||
|
|
||||||
import kotlin.KotlinVersion;
|
import kotlin.KotlinVersion;
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@ -84,14 +87,38 @@ public final class OverdriveThatMatters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final CreativeModeTab CREATIVE_TAB = new CreativeModeTab("otm") {
|
||||||
|
@Override
|
||||||
|
public ItemStack makeIcon() {
|
||||||
|
return new ItemStack(MItems.INSTANCE.getBATTERY_CREATIVE(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillItemList(NonNullList<ItemStack> p_40778_) {
|
||||||
|
MCreativeTabsKt.getMainTabContents().fillIn(p_40778_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public final CreativeModeTab CREATIVE_TAB_DECORATIVE = new CreativeModeTab("otm_decorative") {
|
||||||
|
@Override
|
||||||
|
public ItemStack makeIcon() {
|
||||||
|
return new ItemStack(MRegistry.INSTANCE.getVENT().getItem(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillItemList(NonNullList<ItemStack> p_40778_) {
|
||||||
|
MCreativeTabsKt.getDecorativeTabContents().fillIn(p_40778_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static OverdriveThatMatters INSTANCE;
|
public static OverdriveThatMatters INSTANCE;
|
||||||
public static ResourceLocation loc(String path) {
|
public static ResourceLocation loc(String path) {
|
||||||
return new ResourceLocation(MOD_ID, path);
|
return new ResourceLocation(MOD_ID, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkIfKotlinIsInstalled() {
|
private static void checkIfKotlinIsInstalled() {
|
||||||
if (!KotlinVersion.CURRENT.isAtLeast(1, 9, 0)) {
|
if (!KotlinVersion.CURRENT.isAtLeast(1, 8, 0)) {
|
||||||
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.9.0 is required.");
|
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.8.0 is required.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +162,6 @@ public final class OverdriveThatMatters {
|
|||||||
modBus.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::register);
|
modBus.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::register);
|
||||||
modBus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
|
modBus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
|
||||||
modBus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
|
modBus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
|
||||||
modBus.addListener(EventPriority.NORMAL, MCreativeTabs.INSTANCE::register);
|
|
||||||
|
|
||||||
modBus.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
modBus.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||||
modBus.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
modBus.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels);
|
||||||
|
@ -21,11 +21,8 @@ import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
|||||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector4f;
|
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
||||||
import ru.dbotthepony.mc.otm.network.SmokeParticlesPacket;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.mixin;
|
|||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
|
import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -29,7 +30,7 @@ public class MixinAbstractHurtingProjectile {
|
|||||||
AbstractHurtingProjectile proj = (AbstractHurtingProjectile)(Object)this;
|
AbstractHurtingProjectile proj = (AbstractHurtingProjectile)(Object)this;
|
||||||
|
|
||||||
if (cap.isAndroid() && proj.getOwner() != entity) {
|
if (cap.isAndroid() && proj.getOwner() != entity) {
|
||||||
entity.level.playSound(entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + entity.level.random.nextFloat() * 0.1f);
|
entity.level.playSound((Player) entity, proj.blockPosition(), MSoundEvents.INSTANCE.getANDROID_PROJ_PARRY(), SoundSource.PLAYERS, 1.0f, 0.95f + entity.level.random.nextFloat() * 0.1f);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.mixin;
|
package ru.dbotthepony.mc.otm.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import net.minecraft.server.packs.resources.ResourceProvider;
|
import net.minecraft.server.packs.resources.ResourceProvider;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -23,10 +24,10 @@ public class MixinGameRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "reloadShaders(Lnet/minecraft/server/packs/resources/ResourceProvider;)V",
|
method = "reloadShaders(Lnet/minecraft/server/packs/resources/ResourceManager;)V",
|
||||||
at = @At("HEAD")
|
at = @At("HEAD")
|
||||||
)
|
)
|
||||||
private void reloadShaders(ResourceProvider p_250719_, CallbackInfo ci) {
|
private void reloadShaders(ResourceManager p_250719_, CallbackInfo ci) {
|
||||||
RenderHelperKt.reloadShaders(p_250719_);
|
RenderHelperKt.reloadShaders(p_250719_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,17 @@ package ru.dbotthepony.mc.otm.core.util
|
|||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Reference2IntFunction
|
import it.unimi.dsi.fastutil.objects.Reference2IntFunction
|
||||||
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap
|
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap
|
||||||
|
import net.minecraft.core.NonNullList
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.network.chat.MutableComponent
|
import net.minecraft.network.chat.MutableComponent
|
||||||
import net.minecraft.world.item.CreativeModeTabs
|
import net.minecraft.world.item.CreativeModeTab
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraftforge.common.CreativeModeTabRegistry
|
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
|
||||||
import ru.dbotthepony.mc.otm.client.render.IGUIRenderable
|
import ru.dbotthepony.mc.otm.client.render.IGUIRenderable
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.nullsFirst
|
import ru.dbotthepony.mc.otm.core.nullsFirst
|
||||||
import ru.dbotthepony.mc.otm.core.nullsLast
|
import ru.dbotthepony.mc.otm.core.nullsLast
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
import ru.dbotthepony.mc.otm.core.suppliers
|
|
||||||
import ru.dbotthepony.mc.otm.matter.MatterManager
|
import ru.dbotthepony.mc.otm.matter.MatterManager
|
||||||
import ru.dbotthepony.mc.otm.storage.ItemStorageStack
|
import ru.dbotthepony.mc.otm.storage.ItemStorageStack
|
||||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||||
@ -42,9 +40,12 @@ object CreativeMenuItemComparator : Comparator<Item> {
|
|||||||
private fun doRebuild() {
|
private fun doRebuild() {
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
for (tab in CreativeModeTabRegistry.getSortedCreativeModeTabs()) {
|
for (tab in CreativeModeTab.TABS) {
|
||||||
for (item in tab.displayItems) {
|
val output = NonNullList.create<ItemStack>()
|
||||||
item2index.computeIfAbsent(item.item, Reference2IntFunction { i++ })
|
tab.fillItemList(output)
|
||||||
|
|
||||||
|
output.forEach {
|
||||||
|
item2index.computeIfAbsent(it.item, Reference2IntFunction { i++ })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,14 +53,6 @@ object CreativeMenuItemComparator : Comparator<Item> {
|
|||||||
private fun rebuild() {
|
private fun rebuild() {
|
||||||
if (item2index.isEmpty()) {
|
if (item2index.isEmpty()) {
|
||||||
doRebuild()
|
doRebuild()
|
||||||
|
|
||||||
if (item2index.isEmpty()) {
|
|
||||||
val player = minecraft.player ?: return
|
|
||||||
// creative tabs were not populated yet
|
|
||||||
CreativeModeTabs.tryRebuildTabContents(player.connection.enabledFeatures(), false /* operator tabs */)
|
|
||||||
|
|
||||||
doRebuild()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +1,117 @@
|
|||||||
package ru.dbotthepony.mc.otm.registry
|
package ru.dbotthepony.mc.otm.registry
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.core.NonNullList
|
||||||
import net.minecraft.world.item.CreativeModeTab
|
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
|
import net.minecraft.world.level.ItemLike
|
||||||
import net.minecraft.world.level.material.Fluids
|
import net.minecraft.world.level.material.Fluids
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||||
import net.minecraftforge.event.CreativeModeTabEvent
|
|
||||||
import net.minecraftforge.fluids.FluidStack
|
import net.minecraftforge.fluids.FluidStack
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler
|
import net.minecraftforge.fluids.capability.IFluidHandler
|
||||||
import net.minecraftforge.registries.ForgeRegistries
|
import net.minecraftforge.registries.ForgeRegistries
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.matter
|
import ru.dbotthepony.mc.otm.capability.matter.matter
|
||||||
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
|
||||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
import ru.dbotthepony.mc.otm.core.util.CreativeMenuItemComparator
|
|
||||||
import ru.dbotthepony.mc.otm.core.util.WriteOnce
|
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems.BATTERY_CREATIVE
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.accept(values: Collection<Item>) {
|
class CreativeTabOutput {
|
||||||
|
private val items = ArrayList<ItemStack>()
|
||||||
|
|
||||||
|
fun accept(value: ItemLike) {
|
||||||
|
items.add(ItemStack(value.asItem()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun accept(value: ItemStack) {
|
||||||
|
items.add(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fillIn(into: NonNullList<ItemStack>) {
|
||||||
|
items.forEach { into.add(it.copy()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun accept(values: Collection<Item>) {
|
||||||
for (item in values) {
|
for (item in values) {
|
||||||
accept(item)
|
accept(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.base(values: Map<DyeColor?, Item>) {
|
fun base(values: Map<DyeColor?, Item>) {
|
||||||
accept(values[null]!!)
|
accept(values[null]!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun 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]!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun all(values: Map<DyeColor?, Item>) {
|
||||||
|
base(values)
|
||||||
|
colored(values)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun energized(value: Item) {
|
||||||
|
accept(value)
|
||||||
|
|
||||||
|
val stack = ItemStack(value, 1)
|
||||||
|
val energy = stack.matteryEnergy ?: throw IllegalArgumentException("${value.registryName} does not implement mattery energy capability")
|
||||||
|
energy.fillBattery()
|
||||||
|
|
||||||
|
if (ItemStack(value, 1).matteryEnergy!!.batteryLevel != energy.batteryLevel)
|
||||||
|
accept(stack)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun energized(values: Iterable<Item>) {
|
||||||
|
for (value in values) {
|
||||||
|
energized(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun mattery(value: Item) {
|
||||||
|
accept(value)
|
||||||
|
|
||||||
|
val stack = ItemStack(value, 1)
|
||||||
|
val matter = stack.matter ?: throw IllegalArgumentException("${value.registryName} does not implement matter capability")
|
||||||
|
|
||||||
|
matter.fillMatter()
|
||||||
|
|
||||||
|
if (ItemStack(value, 1).matter!!.storedMatter != matter.storedMatter)
|
||||||
|
accept(stack)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun mattery(values: Iterable<Item>) {
|
||||||
|
for (value in values) {
|
||||||
|
mattery(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fluids(value: Item) {
|
||||||
|
accept(value)
|
||||||
|
|
||||||
|
for (fluid in ForgeRegistries.FLUIDS.values) {
|
||||||
|
if (fluid != Fluids.EMPTY && fluid.isSource(fluid.defaultFluidState())) {
|
||||||
|
accept(ItemStack(value, 1).also {
|
||||||
|
it.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresentK {
|
||||||
|
it.fill(FluidStack(fluid, it.getTankCapacity(0)), IFluidHandler.FluidAction.EXECUTE)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val colorOrder = listOf(
|
private val colorOrder = listOf(
|
||||||
@ -51,80 +134,7 @@ private val colorOrder = listOf(
|
|||||||
DyeColor.BLACK,
|
DyeColor.BLACK,
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.colored(values: Map<out DyeColor?, Item>) {
|
private fun addMainCreativeTabItems(consumer: CreativeTabOutput) {
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.energized(value: Item) {
|
|
||||||
accept(value)
|
|
||||||
|
|
||||||
val stack = ItemStack(value, 1)
|
|
||||||
val energy = stack.matteryEnergy ?: throw IllegalArgumentException("${value.registryName} does not implement mattery energy capability")
|
|
||||||
energy.fillBattery()
|
|
||||||
|
|
||||||
if (ItemStack(value, 1).matteryEnergy!!.batteryLevel != energy.batteryLevel)
|
|
||||||
accept(stack)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.energized(values: Iterable<Item>) {
|
|
||||||
for (value in values) {
|
|
||||||
energized(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.mattery(value: Item) {
|
|
||||||
accept(value)
|
|
||||||
|
|
||||||
val stack = ItemStack(value, 1)
|
|
||||||
val matter = stack.matter ?: throw IllegalArgumentException("${value.registryName} does not implement matter capability")
|
|
||||||
|
|
||||||
matter.fillMatter()
|
|
||||||
|
|
||||||
if (ItemStack(value, 1).matter!!.storedMatter != matter.storedMatter)
|
|
||||||
accept(stack)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.mattery(values: Iterable<Item>) {
|
|
||||||
for (value in values) {
|
|
||||||
mattery(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.fluids(value: Item) {
|
|
||||||
accept(value)
|
|
||||||
|
|
||||||
for (fluid in ForgeRegistries.FLUIDS.values) {
|
|
||||||
if (fluid != Fluids.EMPTY && fluid.isSource(fluid.defaultFluidState())) {
|
|
||||||
accept(ItemStack(value, 1).also {
|
|
||||||
it.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresentK {
|
|
||||||
it.fill(FluidStack(fluid, it.getTankCapacity(0)), IFluidHandler.FluidAction.EXECUTE)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
|
|
||||||
with(consumer) {
|
with(consumer) {
|
||||||
accept(MItems.ENERGY_CABLES.values)
|
accept(MItems.ENERGY_CABLES.values)
|
||||||
accept(MItems.MACHINES)
|
accept(MItems.MACHINES)
|
||||||
@ -211,7 +221,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
|
private fun addDecorativeTabItems(consumer: CreativeTabOutput) {
|
||||||
with(consumer) {
|
with(consumer) {
|
||||||
accept(MItems.LABORATORY_LAMP)
|
accept(MItems.LABORATORY_LAMP)
|
||||||
accept(MItems.LABORATORY_LAMP_INVERTED)
|
accept(MItems.LABORATORY_LAMP_INVERTED)
|
||||||
@ -267,31 +277,5 @@ private fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object MCreativeTabs {
|
val MainTabContents = CreativeTabOutput().also { addMainCreativeTabItems(it) }
|
||||||
var MAIN by WriteOnce<CreativeModeTab>()
|
val DecorativeTabContents = CreativeTabOutput().also { addDecorativeTabItems(it) }
|
||||||
private set
|
|
||||||
var DECORATIVE by WriteOnce<CreativeModeTab>()
|
|
||||||
private set
|
|
||||||
|
|
||||||
fun register(event: CreativeModeTabEvent.Register) {
|
|
||||||
CreativeMenuItemComparator.invalidate()
|
|
||||||
|
|
||||||
MAIN = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "main")) {
|
|
||||||
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
|
||||||
it.title(TranslatableComponent("itemGroup.otm"))
|
|
||||||
|
|
||||||
it.displayItems { _, consumer, hasPerms ->
|
|
||||||
addMainCreativeTabItems(consumer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DECORATIVE = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "decorative")) {
|
|
||||||
it.icon { ItemStack(MRegistry.VENT.item, 1) }
|
|
||||||
it.title(TranslatableComponent("itemGroup.otm_decorative"))
|
|
||||||
|
|
||||||
it.displayItems { _, consumer, hasPerms ->
|
|
||||||
addDecorativeTabItems(consumer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user