From b68b1d724af2ef3380564b1cf396433bd8891dc4 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 12 Mar 2025 19:28:54 +0700 Subject: [PATCH 01/12] Move IMatteryPlayer as well as shortcuts to player subpackage --- .../ru/dbotthepony/mc/otm/client/model/ExosuitModel.java | 2 +- .../java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java | 3 +-- .../mc/otm/mixin/MixinAbstractHurtingProjectile.java | 2 +- .../java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java | 2 +- .../ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java | 2 +- .../java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java | 4 +--- .../dbotthepony/mc/otm/android/AndroidResearchManager.kt | 3 +-- .../mc/otm/android/feature/EnderTeleporterFeature.kt | 3 +-- .../mc/otm/android/feature/LimbOverclockingFeature.kt | 2 +- .../mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt | 2 +- .../mc/otm/block/entity/tech/AndroidChargerBlockEntity.kt | 3 +-- .../mc/otm/block/entity/tech/AndroidStationBlockEntity.kt | 3 +-- .../dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt | 2 +- src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt | 5 +---- .../ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt | 1 + .../dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt | 2 +- .../ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt | 3 +-- .../ru/dbotthepony/mc/otm/client/ClientEventHandler.kt | 2 +- .../kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt | 2 +- .../ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt | 2 +- .../mc/otm/client/render/blockentity/BlackHoleRenderer.kt | 2 +- .../ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt | 2 +- .../mc/otm/client/screen/panels/EntityRendererPanel.kt | 2 +- .../mc/otm/client/screen/tech/AndroidStationScreen.kt | 4 +--- .../ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt | 2 +- .../mc/otm/compat/vanilla/ExtendedInventoryHandler.kt | 2 +- .../mc/otm/data/condition/ChanceWithPlaytimeCondition.kt | 2 +- .../mc/otm/data/condition/HasExoPackCondition.kt | 2 +- src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt | 1 + .../mc/otm/item/consumables/EssenceCapsuleItem.kt | 3 +-- .../dbotthepony/mc/otm/item/consumables/HealPillItem.kt | 2 +- .../dbotthepony/mc/otm/item/consumables/NotNormalFood.kt | 3 +-- .../dbotthepony/mc/otm/item/consumables/NotNormalPill.kt | 2 +- .../ru/dbotthepony/mc/otm/item/consumables/PillItem.kt | 2 +- .../mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt | 2 +- .../dbotthepony/mc/otm/item/exopack/ExopackProbeItem.kt | 2 +- .../dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt | 2 +- .../ru/dbotthepony/mc/otm/item/weapon/EnergySwordItem.kt | 4 +--- .../ru/dbotthepony/mc/otm/item/weapon/FallingSunItem.kt | 4 +--- src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt | 2 +- .../ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt | 2 +- .../ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt | 2 +- .../ru/dbotthepony/mc/otm/network/AndroidPackets.kt | 2 +- .../ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt | 3 +-- .../ru/dbotthepony/mc/otm/network/MenuDataPacket.kt | 5 +---- src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt | 8 ++++++++ .../mc/otm/{capability => player}/IMatteryPlayer.kt | 4 +++- .../dbotthepony/mc/otm/server/command/AndroidCommand.kt | 2 +- .../dbotthepony/mc/otm/server/command/ExopackCommand.kt | 2 +- .../dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt | 2 +- .../mc/otm/triggers/MatteryInventoryChangeTrigger.kt | 3 +-- 51 files changed, 60 insertions(+), 72 deletions(-) create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt rename src/main/kotlin/ru/dbotthepony/mc/otm/{capability => player}/IMatteryPlayer.kt (69%) diff --git a/src/main/java/ru/dbotthepony/mc/otm/client/model/ExosuitModel.java b/src/main/java/ru/dbotthepony/mc/otm/client/model/ExosuitModel.java index 5e4cc73db..74217e95d 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/client/model/ExosuitModel.java +++ b/src/main/java/ru/dbotthepony/mc/otm/client/model/ExosuitModel.java @@ -20,7 +20,7 @@ import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.client.event.RenderPlayerEvent; import ru.dbotthepony.mc.otm.OverdriveThatMatters; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import javax.annotation.Nonnull; import java.util.Set; diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java index 1033c82d5..2b00f3d4f 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java @@ -8,8 +8,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; -import ru.dbotthepony.mc.otm.capability.MatteryCapability; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; @Mixin(FoodData.class) public class FoodDataMixin { diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinAbstractHurtingProjectile.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinAbstractHurtingProjectile.java index 75c813851..21f131c1b 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinAbstractHurtingProjectile.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinAbstractHurtingProjectile.java @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import ru.dbotthepony.mc.otm.registry.game.MSoundEvents; @Mixin(AbstractHurtingProjectile.class) diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java index 96f65547a..570f2e64b 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java @@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import ru.dbotthepony.mc.otm.capability.MatteryPlayer; import java.util.function.Predicate; diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java index 74d61a685..5ddfd3c17 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinLivingEntity.java @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import ru.dbotthepony.mc.otm.config.ServerConfig; import ru.dbotthepony.mc.otm.core.util.ExperienceUtilsKt; import ru.dbotthepony.mc.otm.registry.game.MItems; diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java index 9af92c461..69723ad77 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java @@ -3,18 +3,16 @@ package ru.dbotthepony.mc.otm.mixin; import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import ru.dbotthepony.mc.otm.capability.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import ru.dbotthepony.mc.otm.capability.MatteryPlayer; import java.util.Objects; diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchManager.kt index c61ba9e47..673d400e2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchManager.kt @@ -23,8 +23,7 @@ import ru.dbotthepony.mc.otm.MINECRAFT_SERVER import ru.dbotthepony.mc.otm.NULLABLE_MINECRAFT_SERVER import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.SERVER_IS_LIVE -import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.fromJsonStrict import ru.dbotthepony.mc.otm.core.fromNetwork diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index 7668a679d..e477f34ab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -28,7 +28,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons @@ -49,7 +49,6 @@ import ru.dbotthepony.mc.otm.core.math.rotateXDegrees import ru.dbotthepony.mc.otm.core.math.rotateYDegrees import ru.dbotthepony.mc.otm.core.math.shortestDistanceBetween import ru.dbotthepony.mc.otm.core.math.times -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.milliTime import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.triggers.EnderTeleporterFallDeathTrigger diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt index e03452450..ff824723c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt @@ -7,7 +7,7 @@ import net.minecraft.world.entity.player.Player import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt index 41f92f2e7..0d6a8f427 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/ItemMonitorBlockEntity.kt @@ -23,7 +23,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets8 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidChargerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidChargerBlockEntity.kt index 59282a830..15e39b78b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidChargerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidChargerBlockEntity.kt @@ -14,10 +14,9 @@ import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.ProxiedEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.shuffle import ru.dbotthepony.mc.otm.menu.tech.AndroidChargerMenu import ru.dbotthepony.mc.otm.registry.game.MBlockEntities diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidStationBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidStationBlockEntity.kt index 11ef62a3d..4ce822966 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidStationBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/AndroidStationBlockEntity.kt @@ -13,11 +13,10 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.capability.moveEnergy import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.core.math.Decimal -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.shuffle import ru.dbotthepony.mc.otm.core.util.countingLazy import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt index 3d24e4f0b..a2838cd97 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt @@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.block.MatteryBlock import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.registry.game.MBlockEntities import ru.dbotthepony.mc.otm.shapes.BlockShapes diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt index d2ac47101..c6b6da26d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt @@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.capability import com.google.common.collect.Streams import net.minecraft.ChatFormatting import net.minecraft.network.chat.Component -import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.neoforged.neoforge.capabilities.Capabilities @@ -34,13 +33,11 @@ import ru.dbotthepony.mc.otm.core.collect.map import ru.dbotthepony.mc.otm.core.isNotEmpty import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.util.formatFluidLevel +import ru.dbotthepony.mc.otm.player.matteryPlayer import java.util.stream.Stream private val LOGGER = LogManager.getLogger() -val Player.matteryPlayer: MatteryPlayer get() = (this as IMatteryPlayer).otmPlayer -val LivingEntity.matteryPlayer: MatteryPlayer? get() = (this as? IMatteryPlayer)?.otmPlayer - /** * Does a checked energy receive, calls [IMatteryEnergyStorage.receiveEnergyChecked] if possible */ diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt index 24a237b93..7da125e94 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt @@ -99,6 +99,7 @@ import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.menu.IItemStackSortingSettings import ru.dbotthepony.mc.otm.network.* import ru.dbotthepony.mc.otm.network.SmokeParticlesPacket.Companion.makeSmoke +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.MDamageTypes import ru.dbotthepony.mc.otm.registry.game.MItems diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt index e24de2183..2cb90d1a1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt @@ -9,7 +9,7 @@ import net.neoforged.neoforge.client.settings.KeyConflictContext import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidActiveFeature -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets18 import ru.dbotthepony.mc.otm.client.render.is3DContext diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 6deaaeba9..5b6b2065e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -13,10 +13,9 @@ import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.drawArc import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.core.math.angleDifference import ru.dbotthepony.mc.otm.core.math.normalizeAngle diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index 4c54ef97e..9aa643ba2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -20,7 +20,7 @@ import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.config.ClientConfig import ru.dbotthepony.mc.otm.android.feature.JumpBoostFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets18 import ru.dbotthepony.mc.otm.client.screen.ExopackInventoryScreen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index ddc917ee3..b5acdc508 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -26,7 +26,7 @@ import net.neoforged.neoforge.common.ItemAbilities import ru.dbotthepony.mc.otm.android.feature.NanobotsArmorFeature import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.render.sprites.MatteryAtlas import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt index 14f601f8e..d5b7da71b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt @@ -12,7 +12,7 @@ import net.minecraft.world.level.levelgen.XoroshiroRandomSource import net.minecraft.world.level.material.FogType import org.joml.Matrix4f import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.linearInterpolation import ru.dbotthepony.mc.otm.milliTime diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BlackHoleRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BlackHoleRenderer.kt index 3a7cc7bd4..fbbcdcc2e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BlackHoleRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BlackHoleRenderer.kt @@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL30 import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.* diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt index dac9e5539..23e70a863 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt @@ -17,7 +17,7 @@ import net.neoforged.neoforge.common.NeoForge import org.lwjgl.opengl.GL11 import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.WidgetLocation diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index f065cc23d..62a2b0e2a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -7,7 +7,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets8 import ru.dbotthepony.mc.otm.client.render.sprites.sprite diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index 08190ec3c..18586cca3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -15,7 +15,6 @@ import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.client.CursorType import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft @@ -33,9 +32,8 @@ import ru.dbotthepony.mc.otm.client.screen.panels.util.DraggableCanvasPanel import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.kommons.math.RGBAColor -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.screen.panels.button.BooleanButtonPanel -import ru.dbotthepony.mc.otm.core.RandomSource2Generator import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu import ru.dbotthepony.mc.otm.network.AndroidResearchRequestPacket import java.util.* diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt index 1bf4ebf86..45b9341f9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt @@ -12,7 +12,7 @@ import net.neoforged.fml.ModList import net.neoforged.fml.loading.FMLEnvironment import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.kommons.math.RGBAColor -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.sprites.sprite diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt index e5bb727c2..dbd44d4bc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt @@ -19,7 +19,7 @@ import net.neoforged.neoforge.network.handling.IPayloadContext import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.menu.MatteryMenu import ru.dbotthepony.mc.otm.menu.MatterySlot diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/ChanceWithPlaytimeCondition.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/ChanceWithPlaytimeCondition.kt index c62eba451..4c2e4c0fe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/ChanceWithPlaytimeCondition.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/ChanceWithPlaytimeCondition.kt @@ -7,7 +7,7 @@ import net.minecraft.world.level.storage.loot.LootContext import net.minecraft.world.level.storage.loot.parameters.LootContextParams import net.minecraft.world.level.storage.loot.predicates.LootItemCondition import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.data.get import ru.dbotthepony.mc.otm.registry.data.MLootItemConditions diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/HasExoPackCondition.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/HasExoPackCondition.kt index 691022fb0..dab5df1b3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/HasExoPackCondition.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/data/condition/HasExoPackCondition.kt @@ -5,7 +5,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams import net.minecraft.world.level.storage.loot.predicates.InvertedLootItemCondition import net.minecraft.world.level.storage.loot.predicates.LootItemCondition import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.data.get import ru.dbotthepony.mc.otm.registry.data.MLootItemConditions diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt index d7b76d2a1..a4f9651b0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt @@ -21,6 +21,7 @@ import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.config.ItemsConfig import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.core.math.Decimal +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.registry.CapabilitiesRegisterListener import ru.dbotthepony.mc.otm.registry.MDamageTypes import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/EssenceCapsuleItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/EssenceCapsuleItem.kt index 1ae7e9fdd..df8008a1c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/EssenceCapsuleItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/EssenceCapsuleItem.kt @@ -13,11 +13,10 @@ import net.minecraft.world.item.* import net.minecraft.world.item.alchemy.PotionContents import net.minecraft.world.item.alchemy.Potions import net.minecraft.world.level.Level -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.util.getLevelFromXp import ru.dbotthepony.mc.otm.item.MatteryItem import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/HealPillItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/HealPillItem.kt index 6af3533ab..85012551a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/HealPillItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/HealPillItem.kt @@ -11,7 +11,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Rarity import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.item.MatteryItem diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalFood.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalFood.kt index e2e5a6819..130ecdfb0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalFood.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalFood.kt @@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.item.consumables import net.minecraft.ChatFormatting import net.minecraft.core.component.DataComponentMap import net.minecraft.network.chat.Component -import net.minecraft.network.chat.Style import net.minecraft.tags.TagKey import net.minecraft.world.InteractionHand import net.minecraft.world.InteractionResult @@ -18,7 +17,7 @@ import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level import net.minecraft.world.level.gameevent.GameEvent import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent.EntityInteract -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalPill.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalPill.kt index ff22e177e..bba61327c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalPill.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/NotNormalPill.kt @@ -8,7 +8,7 @@ import net.minecraft.world.entity.player.Player import net.minecraft.world.item.* import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.item.MatteryItem import ru.dbotthepony.mc.otm.registry.MDamageTypes diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/PillItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/PillItem.kt index 07ecc6c3d..ae82e1f30 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/PillItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/PillItem.kt @@ -10,7 +10,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Rarity import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.item.MatteryItem diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt index 176a77418..e9750cab0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/AbstractExopackSlotUpgradeItem.kt @@ -15,7 +15,7 @@ import net.minecraft.world.item.TooltipFlag import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.config.ServerConfig -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.isExplosion diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackProbeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackProbeItem.kt index 4be2ec216..975a54a39 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackProbeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackProbeItem.kt @@ -11,7 +11,7 @@ import net.minecraft.world.item.* import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.onceServer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.registry.MDamageTypes diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt index 2bc925cc7..f2eff31c5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt @@ -14,7 +14,7 @@ import net.minecraft.world.item.TooltipFlag import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.runIfClient diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/EnergySwordItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/EnergySwordItem.kt index 881c3d745..bd42bfb5f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/EnergySwordItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/EnergySwordItem.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.item.weapon import net.minecraft.core.BlockPos -import net.minecraft.core.component.DataComponents import net.minecraft.tags.BlockTags import net.minecraft.world.entity.EquipmentSlotGroup import net.minecraft.world.entity.LivingEntity @@ -26,14 +25,13 @@ import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.energy.getBarColor import ru.dbotthepony.mc.otm.capability.energy.getBarWidth import ru.dbotthepony.mc.otm.capability.matteryEnergy -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.DecimalConfigValue import ru.dbotthepony.mc.otm.core.math.defineDecimal import ru.dbotthepony.mc.otm.core.math.nextVariance -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.util.WriteOnce import ru.dbotthepony.mc.otm.item.MatteryItem import ru.dbotthepony.mc.otm.item.addSimpleDescription diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/FallingSunItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/FallingSunItem.kt index 23b40cd7d..c5ce968ff 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/FallingSunItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/FallingSunItem.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.item.weapon import net.minecraft.core.BlockPos -import net.minecraft.core.component.DataComponents import net.minecraft.tags.BlockTags import net.minecraft.world.entity.EquipmentSlotGroup import net.minecraft.world.entity.LivingEntity @@ -26,14 +25,13 @@ import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.energy.getBarColor import ru.dbotthepony.mc.otm.capability.energy.getBarWidth import ru.dbotthepony.mc.otm.capability.matteryEnergy -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.DecimalConfigValue import ru.dbotthepony.mc.otm.core.math.defineDecimal import ru.dbotthepony.mc.otm.core.math.nextVariance -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.util.WriteOnce import ru.dbotthepony.mc.otm.item.MatteryItem import ru.dbotthepony.mc.otm.item.addSimpleDescription diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt index 4a65058ae..8a3711faa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatteryMenu.kt @@ -34,7 +34,7 @@ import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.compat.cos.cosmeticArmorSlots import ru.dbotthepony.mc.otm.compat.curios.curiosSlots import ru.dbotthepony.mc.otm.compat.curios.isCurioSlot diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt index 027b7ed25..ba94a0e29 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/decorative/PainterMenu.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.kommons.util.ListenableDelegate import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.mc.otm.block.entity.decorative.PainterBlockEntity -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.core.addAll import ru.dbotthepony.mc.otm.core.collect.SupplierMap diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt index 974fa4823..08c56b58b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt @@ -9,7 +9,7 @@ import net.minecraft.world.item.ItemStack import net.neoforged.neoforge.capabilities.Capabilities import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu import ru.dbotthepony.mc.otm.menu.MatterySlot diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt index 2ac263b4c..68701227b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt @@ -16,7 +16,7 @@ import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.MatteryGUI import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.GlitchRenderer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt index 0fb081906..4e928e4df 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt @@ -15,7 +15,7 @@ import org.apache.logging.log4j.LogManager import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.container.get import ru.dbotthepony.mc.otm.container.set @@ -24,7 +24,6 @@ import ru.dbotthepony.mc.otm.core.math.component1 import ru.dbotthepony.mc.otm.core.math.component2 import ru.dbotthepony.mc.otm.core.math.component3 import ru.dbotthepony.mc.otm.core.math.toRadians -import ru.dbotthepony.mc.otm.core.random import ru.dbotthepony.mc.otm.core.position import ru.dbotthepony.mc.otm.core.readItem import ru.dbotthepony.mc.otm.core.writeItem diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuDataPacket.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuDataPacket.kt index f981e2442..7da35ccbb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuDataPacket.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MenuDataPacket.kt @@ -1,18 +1,15 @@ package ru.dbotthepony.mc.otm.network import it.unimi.dsi.fastutil.bytes.ByteArrayList -import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream import net.minecraft.network.FriendlyByteBuf import net.minecraft.network.codec.StreamCodec import net.minecraft.network.protocol.common.custom.CustomPacketPayload import net.neoforged.neoforge.network.handling.IPayloadContext import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.menu.MatteryMenu -import java.io.ByteArrayInputStream class MenuDataPacket(val containerId: Int, val bytes: ByteArrayList) : CustomPacketPayload { fun write(buff: FriendlyByteBuf) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt new file mode 100644 index 000000000..2b2b7ec7c --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt @@ -0,0 +1,8 @@ +package ru.dbotthepony.mc.otm.player + +import net.minecraft.world.entity.LivingEntity +import net.minecraft.world.entity.player.Player +import ru.dbotthepony.mc.otm.capability.MatteryPlayer + +val Player.matteryPlayer: MatteryPlayer get() = (this as IMatteryPlayer).otmPlayer +val LivingEntity.matteryPlayer: MatteryPlayer? get() = (this as? IMatteryPlayer)?.otmPlayer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt similarity index 69% rename from src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryPlayer.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt index 890f6385f..1789eb4f8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt @@ -1,4 +1,6 @@ -package ru.dbotthepony.mc.otm.capability +package ru.dbotthepony.mc.otm.player + +import ru.dbotthepony.mc.otm.capability.MatteryPlayer interface IMatteryPlayer { // since new capabilities dont get to live through getCapability calls by design diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt index 44a14eb34..f56e583a5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt @@ -6,7 +6,7 @@ import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.event.RegisterCommandsEvent import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer object AndroidCommand { fun register(event: RegisterCommandsEvent) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt index 943283326..b95f3e460 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt @@ -6,7 +6,7 @@ import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.event.RegisterCommandsEvent import net.neoforged.neoforge.server.command.EnumArgument import ru.dbotthepony.mc.otm.capability.MatteryPlayer.UpgradeType -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer object ExopackCommand { fun register(event: RegisterCommandsEvent) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt index e25fdc498..e7e4c8b38 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt @@ -12,7 +12,7 @@ import net.minecraft.world.entity.monster.ElderGuardian import net.neoforged.neoforge.event.entity.living.LivingDeathEvent import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.capability.MatteryPlayer -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.data.codec.SingletonCodec import ru.dbotthepony.mc.otm.registry.MRegistry diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MatteryInventoryChangeTrigger.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MatteryInventoryChangeTrigger.kt index 841b2d276..9170b5d7f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MatteryInventoryChangeTrigger.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/MatteryInventoryChangeTrigger.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.triggers -import com.google.gson.JsonObject import com.mojang.serialization.Codec import it.unimi.dsi.fastutil.objects.ObjectArrayList import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet @@ -15,7 +14,7 @@ import net.minecraft.world.Container import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.container.get import ru.dbotthepony.mc.otm.container.util.iterator import ru.dbotthepony.mc.otm.core.isNotEmpty From 05a081d9cbbc8829f4e72533fabe8cd968cf4f0f Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 12 Mar 2025 19:33:20 +0700 Subject: [PATCH 02/12] Move MatteryPlayer to player subpackage --- .../dbotthepony/mc/otm/datagen/tags/TagsProvider.kt | 2 +- .../ru/dbotthepony/mc/otm/mixin/MixinInventory.java | 2 +- .../ru/dbotthepony/mc/otm/mixin/MixinMinecraft.java | 2 +- .../java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java | 2 +- .../ru/dbotthepony/mc/otm/OverdriveThatMatters.kt | 3 +-- .../mc/otm/android/AndroidActiveFeature.kt | 2 +- .../ru/dbotthepony/mc/otm/android/AndroidFeature.kt | 2 +- .../dbotthepony/mc/otm/android/AndroidFeatureType.kt | 2 +- .../ru/dbotthepony/mc/otm/android/AndroidResearch.kt | 2 +- .../mc/otm/android/AndroidSwitchableFeature.kt | 2 +- .../mc/otm/android/feature/AttackBoostFeature.kt | 2 +- .../mc/otm/android/feature/EnderTeleporterFeature.kt | 2 +- .../mc/otm/android/feature/ExtendedReachFeature.kt | 2 +- .../mc/otm/android/feature/FallDampenersFeature.kt | 2 +- .../mc/otm/android/feature/ItemMagnetFeature.kt | 2 +- .../mc/otm/android/feature/JumpBoostFeature.kt | 2 +- .../mc/otm/android/feature/LimbOverclockingFeature.kt | 2 +- .../mc/otm/android/feature/NanobotsArmorFeature.kt | 2 +- .../android/feature/NanobotsRegenerationFeature.kt | 2 +- .../mc/otm/android/feature/NightVisionFeature.kt | 2 +- .../mc/otm/android/feature/ShockwaveFeature.kt | 2 +- .../mc/otm/android/feature/StepAssistFeature.kt | 2 +- .../mc/otm/android/feature/SwimBoostersFeature.kt | 2 +- .../dbotthepony/mc/otm/client/ClientEventHandler.kt | 2 +- .../kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt | 2 +- .../mc/otm/client/render/GlitchRenderer.kt | 2 +- .../otm/client/screen/panels/EntityRendererPanel.kt | 2 +- .../mc/otm/client/screen/tech/AndroidStationScreen.kt | 2 +- .../mc/otm/compat/vanilla/ExtendedInventoryHandler.kt | 2 +- .../mc/otm/item/exopack/ExopackUpgradeItem.kt | 2 +- .../dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt | 2 +- .../mc/otm/menu/tech/AndroidStationMenu.kt | 2 +- .../mc/otm/network/MatteryPlayerPackets.kt | 2 +- src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt | 1 - .../ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt | 2 -- .../mc/otm/{capability => player}/MatteryPlayer.kt | 6 ++++-- .../ru/dbotthepony/mc/otm/registry/game/MItems.kt | 11 +++++++---- .../mc/otm/server/command/ExopackCommand.kt | 2 +- .../mc/otm/triggers/KillAsAndroidTrigger.kt | 2 +- 39 files changed, 46 insertions(+), 45 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/{capability => player}/MatteryPlayer.kt (99%) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt index e84eeee6d..a46d37997 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt @@ -19,7 +19,7 @@ import net.minecraft.world.level.block.Block import net.neoforged.neoforge.common.Tags import net.neoforged.neoforge.data.event.GatherDataEvent import net.neoforged.neoforge.registries.NeoForgeRegistries -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.datagen.DataGen import java.util.EnumMap diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java index 570f2e64b..c41ac462c 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinInventory.java @@ -18,7 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import ru.dbotthepony.mc.otm.player.IMatteryPlayer; -import ru.dbotthepony.mc.otm.capability.MatteryPlayer; +import ru.dbotthepony.mc.otm.player.MatteryPlayer; import java.util.function.Predicate; diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinMinecraft.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinMinecraft.java index 328460fa8..2f8f0c691 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinMinecraft.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinMinecraft.java @@ -6,7 +6,7 @@ import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import ru.dbotthepony.mc.otm.capability.MatteryPlayer; +import ru.dbotthepony.mc.otm.player.MatteryPlayer; @Mixin(Minecraft.class) public class MixinMinecraft { diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java index 69723ad77..bcde0cf79 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import ru.dbotthepony.mc.otm.player.IMatteryPlayer; -import ru.dbotthepony.mc.otm.capability.MatteryPlayer; +import ru.dbotthepony.mc.otm.player.MatteryPlayer; import java.util.Objects; diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt index b020f9548..d32ffc843 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt @@ -6,7 +6,6 @@ import net.neoforged.bus.api.EventPriority import net.neoforged.fml.common.Mod import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent -import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent import ru.dbotthepony.mc.otm.android.AndroidResearchDescription import ru.dbotthepony.mc.otm.android.AndroidResearchDescriptions import ru.dbotthepony.mc.otm.android.AndroidResearchManager @@ -15,7 +14,7 @@ import ru.dbotthepony.mc.otm.android.AndroidResearchResults import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.drive.DrivePool import ru.dbotthepony.mc.otm.client.AndroidAbilityKeyMapping import ru.dbotthepony.mc.otm.client.AndroidMenuKeyMapping diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt index 0b18e6ebe..230a0cd47 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.android import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.Camera import net.neoforged.neoforge.client.event.RenderLevelStageEvent -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource abstract class AndroidActiveFeature(type: AndroidFeatureType<*>, android: MatteryPlayer) : AndroidSwitchableFeature(type, android) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt index c781b64a4..958e2ae6f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt @@ -7,7 +7,7 @@ import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.mc.otm.network.syncher.SynchableGroup import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.nbt.set abstract class AndroidFeature(val type: AndroidFeatureType<*>, val android: MatteryPlayer) : INBTSerializable { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt index 43c6d78ca..d01adc685 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt @@ -4,7 +4,7 @@ import net.minecraft.network.chat.Component import net.minecraft.network.chat.ComponentContents import net.minecraft.network.chat.MutableComponent import net.minecraft.network.chat.contents.TranslatableContents -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.getKeyNullable import ru.dbotthepony.mc.otm.registry.MRegistry diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt index 68ebb9380..3954b9f2e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt @@ -13,7 +13,7 @@ import ru.dbotthepony.mc.otm.network.syncher.SynchableGroup import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.awareItemsStream import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt index a5281e23c..df6ea10af 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt @@ -7,7 +7,7 @@ import net.minecraft.server.level.ServerPlayer import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.nbt.set diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt index fce5bb5aa..d70658560 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt @@ -4,7 +4,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index e477f34ab..501c25147 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -26,7 +26,7 @@ import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.NULLABLE_MINECRAFT_SERVER import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidActiveFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt index abd8e66be..c816e044e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt @@ -4,7 +4,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt index 817a13809..59e4e4d37 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.android.feature import net.minecraft.server.level.ServerPlayer import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.isFall import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt index 984a61986..fd4627d00 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt @@ -13,7 +13,7 @@ import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt index 4a3f5f195..b81c5b3c4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt @@ -7,7 +7,7 @@ import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt index ff824723c..061d5302e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt @@ -6,7 +6,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes import net.minecraft.world.entity.player.Player import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt index de77734b9..d80ce2a14 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt @@ -8,7 +8,7 @@ import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.core.isBypassArmor import ru.dbotthepony.mc.otm.core.math.Decimal diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt index d5ffa71ff..d2edf3af3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt @@ -7,7 +7,7 @@ import net.minecraft.world.level.GameRules import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.StatNames import ru.dbotthepony.mc.otm.core.nbt.set diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt index 23fde7109..d3b676b82 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt @@ -4,7 +4,7 @@ import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt index 786ff4cdd..c38754b02 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt @@ -8,7 +8,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.monster.warden.Warden import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt index 7c324d52c..92d048b78 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.kommons.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt index 4816f104c..35b7d952b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.neoforged.neoforge.common.NeoForgeMod import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index 9aa643ba2..fa0975202 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -19,7 +19,7 @@ import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.config.ClientConfig import ru.dbotthepony.mc.otm.android.feature.JumpBoostFeature -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets18 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index b5acdc508..20e18e1c6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -25,7 +25,7 @@ import net.neoforged.neoforge.client.gui.VanillaGuiLayers import net.neoforged.neoforge.common.ItemAbilities import ru.dbotthepony.mc.otm.android.feature.NanobotsArmorFeature import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.render.sprites.MatteryAtlas diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt index d5b7da71b..de9cd3653 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GlitchRenderer.kt @@ -11,7 +11,7 @@ import net.minecraft.client.renderer.GameRenderer import net.minecraft.world.level.levelgen.XoroshiroRandomSource import net.minecraft.world.level.material.FogType import org.joml.Matrix4f -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.linearInterpolation diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index 62a2b0e2a..9a3a55d20 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -6,7 +6,7 @@ import net.minecraft.client.gui.screens.inventory.InventoryScreen import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.network.PacketDistributor -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets8 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index 18586cca3..fee98d5b6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -14,7 +14,7 @@ import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.CursorType import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt index dbd44d4bc..5393b66bf 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/vanilla/ExtendedInventoryHandler.kt @@ -18,7 +18,7 @@ import net.minecraft.world.item.Items import net.neoforged.neoforge.network.handling.IPayloadContext import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.menu.MatteryMenu diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt index f2eff31c5..faf2b52ee 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/exopack/ExopackUpgradeItem.kt @@ -13,7 +13,7 @@ import net.minecraft.world.item.Rarity import net.minecraft.world.item.TooltipFlag import net.minecraft.world.item.UseAnim import net.minecraft.world.level.Level -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.TranslatableComponent diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt index 0d8e58e48..0eca65659 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/ExopackInventoryMenu.kt @@ -17,7 +17,7 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.inventory.TransientCraftingContainer import net.minecraft.world.item.ItemStack import net.neoforged.neoforge.network.PacketDistributor -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.compat.curios.curiosSlots import ru.dbotthepony.mc.otm.container.util.slotIterator import ru.dbotthepony.mc.otm.menu.input.InstantBooleanInput diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt index 08c56b58b..3878047bd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/AndroidStationMenu.kt @@ -8,7 +8,7 @@ import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.neoforged.neoforge.capabilities.Capabilities import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt index 4e928e4df..fbc7c2cb9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/MatteryPlayerPackets.kt @@ -14,7 +14,7 @@ import net.neoforged.neoforge.network.handling.IPayloadContext import org.apache.logging.log4j.LogManager import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.container.get diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt index 2b2b7ec7c..579ec2cfb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/Ext.kt @@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.player import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player -import ru.dbotthepony.mc.otm.capability.MatteryPlayer val Player.matteryPlayer: MatteryPlayer get() = (this as IMatteryPlayer).otmPlayer val LivingEntity.matteryPlayer: MatteryPlayer? get() = (this as? IMatteryPlayer)?.otmPlayer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt index 1789eb4f8..ea30100b0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/IMatteryPlayer.kt @@ -1,7 +1,5 @@ package ru.dbotthepony.mc.otm.player -import ru.dbotthepony.mc.otm.capability.MatteryPlayer - interface IMatteryPlayer { // since new capabilities dont get to live through getCapability calls by design // and data attachments are.... limited. diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt similarity index 99% rename from src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt index 7da125e94..c69c2a785 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.capability +package ru.dbotthepony.mc.otm.player import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.PoseStack @@ -68,11 +68,14 @@ import ru.dbotthepony.mc.otm.block.entity.ItemJob import ru.dbotthepony.mc.otm.block.entity.JobContainer import ru.dbotthepony.mc.otm.block.entity.JobStatus import ru.dbotthepony.mc.otm.block.entity.MachineJobEventLoop +import ru.dbotthepony.mc.otm.capability.IMatteryUpgrade +import ru.dbotthepony.mc.otm.capability.energy import ru.dbotthepony.mc.otm.capability.energy.BatteryBackedEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.energy.receiveEnergyExact +import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.config.ExopackConfig @@ -99,7 +102,6 @@ import ru.dbotthepony.mc.otm.menu.ExopackInventoryMenu import ru.dbotthepony.mc.otm.menu.IItemStackSortingSettings import ru.dbotthepony.mc.otm.network.* import ru.dbotthepony.mc.otm.network.SmokeParticlesPacket.Companion.makeSmoke -import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.MDamageTypes import ru.dbotthepony.mc.otm.registry.game.MItems diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt index eacba6edc..c0bc06fe3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt @@ -28,7 +28,7 @@ import net.minecraft.world.level.block.Block import net.neoforged.bus.api.IEventBus import net.neoforged.neoforge.common.SimpleTier import ru.dbotthepony.mc.otm.capability.ITieredUpgradeSet -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.UpgradeType import ru.dbotthepony.mc.otm.config.CablesConfig import ru.dbotthepony.mc.otm.config.ItemsConfig @@ -637,9 +637,12 @@ object MItems { object ExopackUpgrades { val INVENTORY_UPGRADE_CREATIVE: ExopackSlotUpgradeItem by registry.register("exosuit_inventory_upgrade_creative") { ExopackSlotUpgradeItem(null, 27, Rarity.EPIC) } - val CRAFTING_UPGRADE: ExopackUpgradeItem by registry.register("exosuit_crafting_upgrade") { ExopackUpgradeItem(MatteryPlayer.UpgradeType.CRAFTING, "crafting_upgrade", "crafting_upgraded") } - val SMELTING_UPGRADE: ExopackUpgradeItem by registry.register("exopack_smelting_upgrade") { ExopackUpgradeItem(MatteryPlayer.UpgradeType.SMELTING, "smelting_upgrade", "smelting_installed") } - val ENDER_UPGRADE: ExopackUpgradeItem by registry.register("exopack_ender_upgrade") { ExopackUpgradeItem(MatteryPlayer.UpgradeType.ENDER_ACCESS, "ender_access_upgrade", "ender_access_installed") } + val CRAFTING_UPGRADE: ExopackUpgradeItem by registry.register("exosuit_crafting_upgrade") { ExopackUpgradeItem( + MatteryPlayer.UpgradeType.CRAFTING, "crafting_upgrade", "crafting_upgraded") } + val SMELTING_UPGRADE: ExopackUpgradeItem by registry.register("exopack_smelting_upgrade") { ExopackUpgradeItem( + MatteryPlayer.UpgradeType.SMELTING, "smelting_upgrade", "smelting_installed") } + val ENDER_UPGRADE: ExopackUpgradeItem by registry.register("exopack_ender_upgrade") { ExopackUpgradeItem( + MatteryPlayer.UpgradeType.ENDER_ACCESS, "ender_access_upgrade", "ender_access_installed") } val INVENTORY_UPGRADES = SupplierList(8) { registry.register("exosuit_inventory_upgrade_$it") { ExopackSlotUpgradeItem(18, Rarity.COMMON) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt index b95f3e460..04573bf3a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/ExopackCommand.kt @@ -5,7 +5,7 @@ import net.minecraft.commands.arguments.EntityArgument import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.event.RegisterCommandsEvent import net.neoforged.neoforge.server.command.EnumArgument -import ru.dbotthepony.mc.otm.capability.MatteryPlayer.UpgradeType +import ru.dbotthepony.mc.otm.player.MatteryPlayer.UpgradeType import ru.dbotthepony.mc.otm.player.matteryPlayer object ExopackCommand { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt index e7e4c8b38..35abe1315 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/KillAsAndroidTrigger.kt @@ -11,7 +11,7 @@ import net.minecraft.util.StringRepresentable import net.minecraft.world.entity.monster.ElderGuardian import net.neoforged.neoforge.event.entity.living.LivingDeathEvent import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.capability.MatteryPlayer +import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.data.codec.SingletonCodec From 0424dd1944b4a8f2d4f57878467e2385d456056c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 12 Mar 2025 19:34:26 +0700 Subject: [PATCH 03/12] Rename mattery player reference in coremod --- src/main/resources/coremods/code_injector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/coremods/code_injector.js b/src/main/resources/coremods/code_injector.js index 3ac192f23..7e74e0071 100644 --- a/src/main/resources/coremods/code_injector.js +++ b/src/main/resources/coremods/code_injector.js @@ -585,7 +585,7 @@ function initializeCoreMod() { new VarInsnNode(opcodesRemapped.aload, 0), new MethodInsnNode( opcodesRemapped.invokestatic, - 'ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability', + 'ru/dbotthepony/mc/otm/player/MatteryPlayer', 'addEatEffectHook', '(Ljava/util/Iterator;Lnet/minecraft/world/entity/LivingEntity;)Ljava/util/Iterator;' ), From cfd6b101d8269c6862787237abdac22ae29ec959 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 12 Mar 2025 20:31:59 +0700 Subject: [PATCH 04/12] Fix addEatEffect hook --- .../kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt | 5 +++-- src/main/resources/coremods/code_injector.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt index c69c2a785..f758b929c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt @@ -29,6 +29,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.boss.wither.WitherBoss import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Player +import net.minecraft.world.food.FoodProperties import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ProjectileWeaponItem @@ -1521,14 +1522,14 @@ class MatteryPlayer(val ply: Player) { * hooked into LivingEntity through coremod script */ @JvmStatic - fun addEatEffectHook(iterator: Iterator>, entity: LivingEntity): Iterator> { + fun addEatEffectHook(iterator: Iterator, entity: LivingEntity): Iterator { if (entity !is Player) { return iterator } if (entity.matteryPlayer.isAndroid) { return iterator.filter { - it.first.effect != MobEffects.HUNGER + it.effect().effect != MobEffects.HUNGER } } diff --git a/src/main/resources/coremods/code_injector.js b/src/main/resources/coremods/code_injector.js index 7e74e0071..bd543beb8 100644 --- a/src/main/resources/coremods/code_injector.js +++ b/src/main/resources/coremods/code_injector.js @@ -576,7 +576,7 @@ function backtrack(instructions, from, opcode, skipAmount) { function initializeCoreMod() { return { - 'LivingEntity#addEatEffect patch for androids': method('net.minecraft.world.entity.LivingEntity.m_21063_(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/LivingEntity;)V', function(node) { + 'LivingEntity#addEatEffect patch for androids': method('net.minecraft.world.entity.LivingEntity.addEatEffect(Lnet/minecraft/world/food/FoodProperties;)V', function(node) { for (var i = 0; i < node.instructions.size(); i++) { var instr = node.instructions.get(i) From c3b2681e89682f879b7bbf1f165c02831adf90b5 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 12 Mar 2025 20:57:57 +0700 Subject: [PATCH 05/12] Rename AndroidConfig to PlayerConfig --- .../mc/otm/OverdriveThatMatters.kt | 4 +- .../otm/android/AndroidResearchDescription.kt | 16 +++---- .../android/feature/EnderTeleporterFeature.kt | 26 ++++++------ .../android/feature/FallDampenersFeature.kt | 6 +-- .../otm/android/feature/ItemMagnetFeature.kt | 10 ++--- .../otm/android/feature/JumpBoostFeature.kt | 8 ++-- .../feature/NanobotsRegenerationFeature.kt | 8 ++-- .../otm/android/feature/NightVisionFeature.kt | 4 +- .../otm/android/feature/ShockwaveFeature.kt | 26 ++++++------ .../android/feature/SwimBoostersFeature.kt | 4 +- .../mc/otm/client/render/ShockwaveRenderer.kt | 4 +- .../{AndroidConfig.kt => PlayerConfig.kt} | 2 +- .../mc/otm/network/AndroidPackets.kt | 4 +- .../mc/otm/player/MatteryPlayer.kt | 42 +++++++++---------- 14 files changed, 82 insertions(+), 82 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/config/{AndroidConfig.kt => PlayerConfig.kt} (99%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt index d32ffc843..b9c7345e2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt @@ -43,7 +43,7 @@ import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer import ru.dbotthepony.mc.otm.compat.curios.isCuriosLoaded import ru.dbotthepony.mc.otm.compat.curios.onCuriosSlotModifiersUpdated import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.config.CablesConfig import ru.dbotthepony.mc.otm.config.ClientConfig import ru.dbotthepony.mc.otm.config.ExopackConfig @@ -170,7 +170,7 @@ object OverdriveThatMatters { ClientConfig.register(container) ServerConfig.register(container) CablesConfig.register(container) - AndroidConfig.register(container) + PlayerConfig.register(container) ExopackConfig.register(container) ItemsConfig.register(container) MachinesConfig.register(container) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt index b34bbc302..1a53c7e37 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt @@ -9,7 +9,7 @@ import net.minecraft.network.chat.ComponentSerialization import net.neoforged.bus.api.IEventBus import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.client.ShiftPressedCond -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.util.formatPower @@ -29,14 +29,14 @@ object AndroidResearchDescriptions { val ENDER_TELEPORTER: AndroidResearchDescription.Singleton by registrar.register("ender_teleporter") { AndroidResearchDescription.singleton { - TranslatableComponent("otm.gui.power_cost_per_use", AndroidConfig.EnderTeleporter.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.EnderTeleporter.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } } val FALL_DAMPENERS: AndroidResearchDescription.Leveled by registrar.register("fall_dampeners") { AndroidResearchDescription.Leveled { _, list, level -> list.add(TranslatableComponent("otm.fall_dampeners.description", - TextComponent("%.1f".format((AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * level).toFloat().coerceIn(0f, 1f) * 100f)).withStyle(ChatFormatting.YELLOW), - TextComponent("%.1f".format((AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * level).toFloat())).withStyle(ChatFormatting.YELLOW), + TextComponent("%.1f".format((PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * level).toFloat().coerceIn(0f, 1f) * 100f)).withStyle(ChatFormatting.YELLOW), + TextComponent("%.1f".format((PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * level).toFloat())).withStyle(ChatFormatting.YELLOW), )) } } @@ -44,20 +44,20 @@ object AndroidResearchDescriptions { AndroidResearchDescription.Leveled { _, list, level -> list.add(TranslatableComponent( "android_research.overdrive_that_matters.swim_boosters.description", - TextComponent("%.1f".format(AndroidConfig.SWIM_BOOSTERS * (1 + level) * 100.0)).withStyle(ChatFormatting.YELLOW) + TextComponent("%.1f".format(PlayerConfig.SWIM_BOOSTERS * (1 + level) * 100.0)).withStyle(ChatFormatting.YELLOW) )) } } val ITEM_MAGNET: AndroidResearchDescription.Singleton by registrar.register("item_magnet") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_tick", AndroidConfig.Magnet.POWER_DRAW.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_tick", PlayerConfig.Magnet.POWER_DRAW.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } } val JUMP_BOOST: AndroidResearchDescription.Singleton by registrar.register("jump_boost") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", AndroidConfig.JumpBoost.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.JumpBoost.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } } val SHOCKWAVE: AndroidResearchDescription.Singleton by registrar.register("shockwave") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", AndroidConfig.Shockwave.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.Shockwave.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index 501c25147..35bad8f25 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -34,7 +34,7 @@ import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.client.render.linesIgnoreZRenderType import ru.dbotthepony.mc.otm.client.render.sprites.sprite -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.genericPositions import ru.dbotthepony.mc.otm.core.holder @@ -60,10 +60,10 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A private set override val maxCooldown: Int - get() = AndroidConfig.EnderTeleporter.COOLDOWN + get() = PlayerConfig.EnderTeleporter.COOLDOWN private fun canUse(): Boolean { - return !isOnCooldown && android.androidEnergy.extractEnergyExact(AndroidConfig.EnderTeleporter.ENERGY_COST, true) + return !isOnCooldown && android.androidEnergy.extractEnergyExact(PlayerConfig.EnderTeleporter.ENERGY_COST, true) } private fun isValidGround(blockPos: BlockPos): Boolean { @@ -112,14 +112,14 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A } private fun tryToPhaseThroughWall(blockPos: BlockPos, normal: Vec3i): TraceResult? { - val phasedBlocks = ArrayList(AndroidConfig.EnderTeleporter.MAX_PHASE_DISTANCE) + val phasedBlocks = ArrayList(PlayerConfig.EnderTeleporter.MAX_PHASE_DISTANCE) phasedBlocks.add(blockPos) - for (extend in 1 .. AndroidConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { + for (extend in 1 .. PlayerConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { val pos = blockPos + normal * extend if (isAirGap(pos)) { - for (y in 0 .. AndroidConfig.EnderTeleporter.MAX_PHASE_DISTANCE - extend) { + for (y in 0 .. PlayerConfig.EnderTeleporter.MAX_PHASE_DISTANCE - extend) { val newPos = BlockPos(pos.x, pos.y - y, pos.z) if (isValidPosition(newPos)) { @@ -142,7 +142,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A val result = ply.level().clip(ClipContext( headPosition, - headPosition + aimVector * (AndroidConfig.EnderTeleporter.MAX_DISTANCE * 2.0), + headPosition + aimVector * (PlayerConfig.EnderTeleporter.MAX_DISTANCE * 2.0), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, ply @@ -158,7 +158,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A !ply.isShiftKeyDown && result.direction == Direction.UP && isValidPosition(result.blockPos.above()) && - shortestDistanceBetween(testPositions, result.blockPos.above().asVector()) <= AndroidConfig.EnderTeleporter.MAX_DISTANCE + shortestDistanceBetween(testPositions, result.blockPos.above().asVector()) <= PlayerConfig.EnderTeleporter.MAX_DISTANCE ) { return TraceResult(result.blockPos.above()) } @@ -216,14 +216,14 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A if (!isAirGap(pos)) { phasedBlocks++ - if (phasedBlocks >= AndroidConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { + if (phasedBlocks >= PlayerConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { break } phasedBlocksList.add(pos) } - if (shortestDistanceBetween(testPositions, pos.asVector()) > AndroidConfig.EnderTeleporter.MAX_DISTANCE) { + if (shortestDistanceBetween(testPositions, pos.asVector()) > PlayerConfig.EnderTeleporter.MAX_DISTANCE) { break } @@ -270,14 +270,14 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A if (!isAirGap(pos)) { phasedBlocks++ - if (phasedBlocks >= AndroidConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { + if (phasedBlocks >= PlayerConfig.EnderTeleporter.MAX_PHASE_DISTANCE) { break } phasedBlocksList.add(pos) } - if (shortestDistanceBetween(testPositions, pos.asVector()) > AndroidConfig.EnderTeleporter.MAX_DISTANCE) { + if (shortestDistanceBetween(testPositions, pos.asVector()) > PlayerConfig.EnderTeleporter.MAX_DISTANCE) { break } @@ -308,7 +308,7 @@ class EnderTeleporterFeature(capability: MatteryPlayer) : AndroidActiveFeature(A putOnCooldown() lastTeleport = ply.server!!.tickCount - android.androidEnergy.extractEnergy(AndroidConfig.EnderTeleporter.ENERGY_COST, false) + android.androidEnergy.extractEnergy(PlayerConfig.EnderTeleporter.ENERGY_COST, false) ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level().random.nextFloat() * 0.4f) ply.teleportTo(event.targetX, event.targetY, event.targetZ) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt index 59e4e4d37..0ab545303 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt @@ -4,7 +4,7 @@ import net.minecraft.server.level.ServerPlayer import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.isFall import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger @@ -12,8 +12,8 @@ import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger class FallDampenersFeature(capability: MatteryPlayer) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) { override fun onHurt(event: LivingIncomingDamageEvent) { if (event.source.isFall) { - val reduction = (AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * (level + 1)).toFloat().coerceIn(0f, 1f) - val flat = (AndroidConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * (level + 1)).toFloat().coerceIn(0f, Float.MAX_VALUE) + val reduction = (PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * (level + 1)).toFloat().coerceIn(0f, 1f) + val flat = (PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * (level + 1)).toFloat().coerceIn(0f, Float.MAX_VALUE) val old = event.amount event.amount = ((event.amount - flat) * (1f - reduction)).coerceAtLeast(0f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt index fd4627d00..679f8f767 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt @@ -11,7 +11,7 @@ import net.neoforged.neoforge.network.PacketDistributor import net.neoforged.neoforge.network.handling.IPayloadContext import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact @@ -76,13 +76,13 @@ class ItemMagnetFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(An private val clientPredicate = Predicate { it is ItemEntity && (datatable[it] ?: SharedItemEntityData.EMPTY).let { !it.hasPickupDelay && (it.owner == null || it.owner != ply.uuid || it.lifespan - it.age <= 200) } } private fun doTick(server: Boolean) { - if (ply.isSpectator || server && !android.androidEnergy.extractEnergyExact(AndroidConfig.Magnet.POWER_DRAW, true)) { + if (ply.isSpectator || server && !android.androidEnergy.extractEnergyExact(PlayerConfig.Magnet.POWER_DRAW, true)) { return } val entities = ply.level().getEntitiesInEllipsoid( ply.position, - Vector(AndroidConfig.Magnet.RADIUS_HORIZONTAL, AndroidConfig.Magnet.RADIUS_VERTICAL, AndroidConfig.Magnet.RADIUS_HORIZONTAL), + Vector(PlayerConfig.Magnet.RADIUS_HORIZONTAL, PlayerConfig.Magnet.RADIUS_VERTICAL, PlayerConfig.Magnet.RADIUS_HORIZONTAL), if (server) Predicate { it is ItemEntity } else clientPredicate ) @@ -101,7 +101,7 @@ class ItemMagnetFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(An if (data.position.distanceToSqr(ent.position) < 1.0) { data.ticksSinceActivity++ } else { - if (!android.androidEnergy.extractEnergyExact(AndroidConfig.Magnet.POWER_DRAW, false)) { + if (!android.androidEnergy.extractEnergyExact(PlayerConfig.Magnet.POWER_DRAW, false)) { return } @@ -117,7 +117,7 @@ class ItemMagnetFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(An override fun tickClient() { super.tickClient() - if (!ply.isSpectator && isActive && android.androidEnergy.extractEnergyExact(AndroidConfig.Magnet.POWER_DRAW, true)) { + if (!ply.isSpectator && isActive && android.androidEnergy.extractEnergyExact(PlayerConfig.Magnet.POWER_DRAW, true)) { doTick(false) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt index b81c5b3c4..073327eda 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt @@ -11,7 +11,7 @@ import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.config.ClientConfig import ru.dbotthepony.mc.otm.core.math.Vector import ru.dbotthepony.mc.otm.core.math.plus @@ -24,7 +24,7 @@ class JumpBoostFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And private var tickCooldownClient = false override val maxCooldown: Int - get() = (AndroidConfig.JumpBoost.BASE_COOLDOWN - AndroidConfig.JumpBoost.COOLDOWN_REDUCTION * level).coerceAtLeast(0) + get() = (PlayerConfig.JumpBoost.BASE_COOLDOWN - PlayerConfig.JumpBoost.COOLDOWN_REDUCTION * level).coerceAtLeast(0) override var cooldown by syncher.int(setter = setter@{ access, value -> access.accept(value) @@ -46,8 +46,8 @@ class JumpBoostFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And val old = lastGround lastGround = ply.onGround() - if (isActive && cooldown <= 0 && old != lastGround && !lastGround && isJumping && isShifting && ply.xRot <= ClientConfig.JUMP_BOOST_LOOK_ANGLE && android.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, true)) { - ply.deltaMovement += Vector(0.0, AndroidConfig.JumpBoost.POWER * (level + 1) / 20.0, 0.0) + if (isActive && cooldown <= 0 && old != lastGround && !lastGround && isJumping && isShifting && ply.xRot <= ClientConfig.JUMP_BOOST_LOOK_ANGLE && android.androidEnergy.extractEnergyExact(PlayerConfig.JumpBoost.ENERGY_COST, true)) { + ply.deltaMovement += Vector(0.0, PlayerConfig.JumpBoost.POWER * (level + 1) / 20.0, 0.0) putOnCooldown() PacketDistributor.sendToServer(TriggerJumpBoostPacket) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt index d2edf3af3..23a06c150 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt @@ -5,7 +5,7 @@ import net.minecraft.nbt.CompoundTag import net.minecraft.server.level.ServerPlayer import net.minecraft.world.level.GameRules import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures @@ -21,16 +21,16 @@ class NanobotsRegenerationFeature(android: MatteryPlayer) : AndroidFeature(Andro if (ply.isHurt && ply.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { ticksPassed++ - val waitTime = AndroidConfig.NanobotsRegeneration.COOLDOWN.getOrElse(healTicks) { AndroidConfig.NanobotsRegeneration.COOLDOWN.last() } + val waitTime = PlayerConfig.NanobotsRegeneration.COOLDOWN.getOrElse(healTicks) { PlayerConfig.NanobotsRegeneration.COOLDOWN.last() } if (ticksPassed > waitTime) { val missingHealth = (ply.maxHealth - ply.health).coerceAtMost(2f) - val power = AndroidConfig.NanobotsRegeneration.ENERGY_PER_HITPOINT * missingHealth + val power = PlayerConfig.NanobotsRegeneration.ENERGY_PER_HITPOINT * missingHealth val extracted = android.androidEnergy.extractEnergy(power, false) if (extracted.isPositive) { healTicks = (healTicks + 1).coerceAtMost(level) - val healed = (extracted / AndroidConfig.NanobotsRegeneration.ENERGY_PER_HITPOINT).toFloat() + val healed = (extracted / PlayerConfig.NanobotsRegeneration.ENERGY_PER_HITPOINT).toFloat() ply.heal(healed) (ply as ServerPlayer?)?.awardStat(StatNames.HEALTH_REGENERATED, (healed * 10f).roundToInt()) ticksPassed = 0 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt index d3b676b82..c4c3d9df4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt @@ -8,7 +8,7 @@ import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures class NightVisionFeature(android: MatteryPlayer) : AndroidSwitchableFeature(AndroidFeatures.NIGHT_VISION, android) { @@ -19,7 +19,7 @@ class NightVisionFeature(android: MatteryPlayer) : AndroidSwitchableFeature(Andr if (isActive) { val effect = android.ply.activeEffectsMap[MobEffects.NIGHT_VISION] - if ((effect == null || effect.duration < 220) && (ply.isSpectator || android.androidEnergy.extractEnergyExact(AndroidConfig.NIGHT_VISION_POWER_DRAW, false))) { + if ((effect == null || effect.duration < 220) && (ply.isSpectator || android.androidEnergy.extractEnergyExact(PlayerConfig.NIGHT_VISION_POWER_DRAW, false))) { android.ply.addEffect(MobEffectInstance(MobEffects.NIGHT_VISION, 220, 0, false, false)) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt index c38754b02..a78b9fe14 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt @@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.damageType import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid import ru.dbotthepony.mc.otm.core.getExplosionResistance @@ -37,7 +37,7 @@ import kotlin.math.roundToInt class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(AndroidFeatures.SHOCKWAVE, capability) { override val maxCooldown: Int - get() = AndroidConfig.Shockwave.COOLDOWN + get() = PlayerConfig.Shockwave.COOLDOWN private var wasMidair = false private var highestSpeed = 0.0 @@ -52,18 +52,18 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And isActive && ply.isShiftKeyDown && !isOnCooldown && - android.androidEnergy.extractEnergyExact(AndroidConfig.Shockwave.ENERGY_COST, true) && + android.androidEnergy.extractEnergyExact(PlayerConfig.Shockwave.ENERGY_COST, true) && ply.deltaMovement.y < -0.01 && creativeFlightTicks == 0 ) { - ply.deltaMovement += Vector(0.0, -AndroidConfig.Shockwave.ACCELERATION / 20.0, 0.0) + ply.deltaMovement += Vector(0.0, -PlayerConfig.Shockwave.ACCELERATION / 20.0, 0.0) } ticker(true) } fun shockwave() { - if (ply.isSpectator || isOnCooldown || !android.androidEnergy.extractEnergyExact(AndroidConfig.Shockwave.ENERGY_COST, false)) { + if (ply.isSpectator || isOnCooldown || !android.androidEnergy.extractEnergyExact(PlayerConfig.Shockwave.ENERGY_COST, false)) { return } @@ -86,14 +86,14 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And // TODO: raycasting val entities = ply.level().getEntitiesInEllipsoid( ply.position, - Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL, AndroidConfig.Shockwave.RADIUS_VERTICAL, AndroidConfig.Shockwave.RADIUS_HORIZONTAL), + Vector(PlayerConfig.Shockwave.RADIUS_HORIZONTAL, PlayerConfig.Shockwave.RADIUS_VERTICAL, PlayerConfig.Shockwave.RADIUS_HORIZONTAL), except = ply, ) { (it !is LivingEntity || !it.isSpectator && it.isAlive) } val wardens = ply.level().getEntitiesInEllipsoid( Warden::class.java, ply.position, - Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN, AndroidConfig.Shockwave.RADIUS_VERTICAL_WARDEN, AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN), + Vector(PlayerConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN, PlayerConfig.Shockwave.RADIUS_VERTICAL_WARDEN, PlayerConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN), ) { true } val seen = ReferenceArraySet() @@ -103,7 +103,7 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And val multiplier = (1.0 - distanceMultiplier).pow(0.5) val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply) - val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat() * AndroidConfig.Shockwave.WARDEN_DAMAGE_MULT.toFloat() + val damage = multiplier.toFloat() * PlayerConfig.Shockwave.DAMAGE.toFloat() * PlayerConfig.Shockwave.WARDEN_DAMAGE_MULT.toFloat() entity.hurt(source, damage) entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0) @@ -119,7 +119,7 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And // don't hurt items, arrows, etc etc if (entity is LivingEntity) { val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply) - val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat() + val damage = multiplier.toFloat() * PlayerConfig.Shockwave.DAMAGE.toFloat() entity.hurt(source, damage) entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0) @@ -132,10 +132,10 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And } } - if (AndroidConfig.Shockwave.BREAK_BLOCKS) { + if (PlayerConfig.Shockwave.BREAK_BLOCKS) { val rounded = ply.position.roundToIntVector() - for (blockPos in getEllipsoidBlockPositions(AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_VERTICAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt())) { + for (blockPos in getEllipsoidBlockPositions(PlayerConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt(), PlayerConfig.Shockwave.RADIUS_VERTICAL.roundToInt(), PlayerConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt())) { val newBlockPos = blockPos + rounded val blockState = ply.level().getBlockState(newBlockPos) @@ -168,7 +168,7 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And !ply.isSpectator && isActive && !isOnCooldown && - android.androidEnergy.extractEnergyExact(AndroidConfig.Shockwave.ENERGY_COST, true) && + android.androidEnergy.extractEnergyExact(PlayerConfig.Shockwave.ENERGY_COST, true) && creativeFlightTicks == 0 ) { val old = wasMidair @@ -178,7 +178,7 @@ class ShockwaveFeature(capability: MatteryPlayer) : AndroidSwitchableFeature(And highestSpeed = (-ply.deltaMovement.y).coerceAtLeast(highestSpeed) } - if (old != wasMidair && !wasMidair && AndroidConfig.Shockwave.TERMINAL_VELOCITY <= (highestSpeed * 20.0) && ply.isShiftKeyDown) { + if (old != wasMidair && !wasMidair && PlayerConfig.Shockwave.TERMINAL_VELOCITY <= (highestSpeed * 20.0) && ply.isShiftKeyDown) { if (isClient) { // I HATE SELF-UPDATING PLAYERS // I HATE SELF-UPDATING PLAYERS diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt index 35b7d952b..4f9c16ceb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt @@ -6,7 +6,7 @@ import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.core.ResourceLocation @@ -20,7 +20,7 @@ class SwimBoostersFeature(android: MatteryPlayer) : AndroidSwitchableFeature(And val attr = ply.getAttribute(NeoForgeMod.SWIM_SPEED) ?: return attr.removeModifier(MODIFIER_ID) - attr.addPermanentModifier(AttributeModifier(MODIFIER_ID, (level + 1) * AndroidConfig.SWIM_BOOSTERS, AttributeModifier.Operation.ADD_VALUE)) + attr.addPermanentModifier(AttributeModifier(MODIFIER_ID, (level + 1) * PlayerConfig.SWIM_BOOSTERS, AttributeModifier.Operation.ADD_VALUE)) } override fun removeModifiers() { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ShockwaveRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ShockwaveRenderer.kt index 1c4515def..7dddcfc17 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ShockwaveRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ShockwaveRenderer.kt @@ -7,7 +7,7 @@ import com.mojang.blaze3d.vertex.VertexFormat import net.minecraft.client.renderer.GameRenderer import net.neoforged.neoforge.client.event.RenderLevelStageEvent import org.lwjgl.opengl.GL11.GL_LESS -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.math.Vector import ru.dbotthepony.mc.otm.core.math.component1 import ru.dbotthepony.mc.otm.core.math.component2 @@ -74,6 +74,6 @@ object ShockwaveRenderer { } fun handle(packet: ShockwaveEffectPacket) { - State(packet.pos, AndroidConfig.Shockwave.RADIUS_HORIZONTAL.toFloat()) + State(packet.pos, PlayerConfig.Shockwave.RADIUS_HORIZONTAL.toFloat()) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt similarity index 99% rename from src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index f49f231d9..90ca28b22 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/AndroidConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -4,7 +4,7 @@ import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.defineDecimal -object AndroidConfig : AbstractConfig("androids") { +object PlayerConfig : AbstractConfig("player") { val REGENERATE_ENERGY: Boolean by builder .comment("If (technically) hunger is above threshold, it turns into energy") .comment("This setting controls whenever to regenerate small amount of energy while eating as Android") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt index 68701227b..74a49b8e6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt @@ -20,7 +20,7 @@ import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.MatteryGUI import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.GlitchRenderer -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.readComponent import ru.dbotthepony.mc.otm.core.writeComponent @@ -366,7 +366,7 @@ object TriggerJumpBoostPacket : CustomPacketPayload { val feature = mattery.getFeature(AndroidFeatures.JUMP_BOOST) ?: return - if (feature.isActive && feature.cooldown <= 4 && mattery.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, false)) { + if (feature.isActive && feature.cooldown <= 4 && mattery.androidEnergy.extractEnergyExact(PlayerConfig.JumpBoost.ENERGY_COST, false)) { feature.putOnCooldown() context.player().level().playSound( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt index f758b929c..bde1b88f8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt @@ -78,7 +78,7 @@ import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.energy.receiveEnergyExact import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.client.minecraft -import ru.dbotthepony.mc.otm.config.AndroidConfig +import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.config.ExopackConfig import ru.dbotthepony.mc.otm.container.CombinedContainer import ru.dbotthepony.mc.otm.container.DynamicallyProxiedContainer @@ -561,7 +561,7 @@ class MatteryPlayer(val ply: Player) { /** * [IMatteryEnergyStorage] instance, representing Android' battery charge */ - val androidEnergy = BatteryBackedEnergyStorage(ply, syncher, AndroidConfig.ANDROID_MAX_ENERGY, AndroidConfig.ANDROID_MAX_ENERGY, true) + val androidEnergy = BatteryBackedEnergyStorage(ply, syncher, PlayerConfig.ANDROID_MAX_ENERGY, PlayerConfig.ANDROID_MAX_ENERGY, true) /** * [IMatteryEnergyStorage] instance, representing Exopack battery charge @@ -659,8 +659,8 @@ class MatteryPlayer(val ply: Player) { shouldPlaySound = false iteration = 0 deathLog.clear() - androidEnergy.batteryLevel = AndroidConfig.ANDROID_MAX_ENERGY - androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY + androidEnergy.batteryLevel = PlayerConfig.ANDROID_MAX_ENERGY + androidEnergy.maxBatteryLevel = PlayerConfig.ANDROID_MAX_ENERGY lastLiquidPosition = ply.position() wasInLiquid = false @@ -714,7 +714,7 @@ class MatteryPlayer(val ply: Player) { iteration = 0 deathLog.clear() androidEnergy.batteryLevel = Decimal.ZERO - androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY + androidEnergy.maxBatteryLevel = PlayerConfig.ANDROID_MAX_ENERGY dropBattery() lastLiquidPosition = ply.position() @@ -1215,26 +1215,26 @@ class MatteryPlayer(val ply: Player) { } val stats = ply.foodData - val fourTimesTheHunger = AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT * 4 + val fourTimesTheHunger = PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * 4 // истощение if (stats.exhaustionLevel > 0f) { - val extracted = androidEnergy.extractEnergy(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (stats.exhaustionLevel / 4f), false) - stats.setExhaustion(stats.exhaustionLevel - (extracted / AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat() * 4f) + val extracted = androidEnergy.extractEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (stats.exhaustionLevel / 4f), false) + stats.setExhaustion(stats.exhaustionLevel - (extracted / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat() * 4f) } // Обычный голод while ( stats.foodLevel < 18 && androidEnergy.batteryLevel >= fourTimesTheHunger && - androidEnergy.extractEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false) + androidEnergy.extractEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false) ) { stats.foodLevel++ } // "поглощение" излишек голода, как при мирном режиме, так и при поедании обычной еды - if (AndroidConfig.REGENERATE_ENERGY) { - while (stats.foodLevel > 18 && androidEnergy.receiveEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT / 2, false)) { + if (PlayerConfig.REGENERATE_ENERGY) { + while (stats.foodLevel > 18 && androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT / 2, false)) { stats.foodLevel-- } } else if (ply.level().difficulty != Difficulty.PEACEFUL) { @@ -1245,22 +1245,22 @@ class MatteryPlayer(val ply: Player) { // насыщение if (stats.saturationLevel < foodLevel && androidEnergy.batteryLevel >= fourTimesTheHunger) { - val extracted = androidEnergy.extractEnergy(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (foodLevel - stats.saturationLevel), false) - stats.setSaturation(stats.saturationLevel + (extracted / AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) + val extracted = androidEnergy.extractEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (foodLevel - stats.saturationLevel), false) + stats.setSaturation(stats.saturationLevel + (extracted / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) } if (androidEnergy.batteryLevel <= Decimal.TEN && !ply.isCreative && ply.level().difficulty != Difficulty.PEACEFUL) { if (stats.saturationLevel > 1f) { - if (androidEnergy.receiveEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { + if (androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { stats.setSaturation(stats.saturationLevel - 1f) } } else if (stats.saturationLevel > 0f) { - val received = androidEnergy.receiveEnergy(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT * stats.saturationLevel, false) - stats.setSaturation(stats.saturationLevel - (received / AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) + val received = androidEnergy.receiveEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * stats.saturationLevel, false) + stats.setSaturation(stats.saturationLevel - (received / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) } else if (stats.foodLevel > 0) { // так как голод не тикает для андроидов, "умереть с голоду" мы не можем // но со стороны будет выглядеть как будто мы умираем с голода - if (androidEnergy.receiveEnergyExact(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { + if (androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { stats.foodLevel-- } } @@ -1281,11 +1281,11 @@ class MatteryPlayer(val ply: Player) { if (ply.isHurt && ply.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { if (--nextHealTick <= 0) { - nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION + nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else PlayerConfig.TIME_BETWEEN_NATURAL_REGENERATION ply.heal(1f) } } else { - nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else AndroidConfig.TIME_BETWEEN_NATURAL_REGENERATION + nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else PlayerConfig.TIME_BETWEEN_NATURAL_REGENERATION } } } @@ -1476,8 +1476,8 @@ class MatteryPlayer(val ply: Player) { ply.matteryPlayer.shouldSendIteration = true ply.matteryPlayer.deathLog.addLast(ply.tickCount to ply.combatTracker.deathMessage) - if (ply.matteryPlayer.androidEnergy.batteryLevel < AndroidConfig.ANDROID_MAX_ENERGY * Decimal("0.2")) - ply.matteryPlayer.androidEnergy.batteryLevel = AndroidConfig.ANDROID_MAX_ENERGY * Decimal("0.2") // если смерть была от разряда батареи, то предотвращаем софтлок + if (ply.matteryPlayer.androidEnergy.batteryLevel < PlayerConfig.ANDROID_MAX_ENERGY * Decimal("0.2")) + ply.matteryPlayer.androidEnergy.batteryLevel = PlayerConfig.ANDROID_MAX_ENERGY * Decimal("0.2") // если смерть была от разряда батареи, то предотвращаем софтлок while (ply.matteryPlayer.deathLog.size > 6) { ply.matteryPlayer.deathLog.removeFirst() From a34b485e685eb207cb15105e544d0dc2b9478e07 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 08:52:36 +0700 Subject: [PATCH 06/12] Base replacement for FoodData --- .../mc/otm/mixin/FoodDataMixin.java | 50 -------- .../dbotthepony/mc/otm/mixin/MixinPlayer.java | 17 ++- .../mc/otm/config/IFoodRegenerationValues.kt | 9 ++ .../dbotthepony/mc/otm/config/PlayerConfig.kt | 99 +++++++++++++++ .../mc/otm/player/MatteryFoodData.kt | 119 ++++++++++++++++++ .../resources/META-INF/accesstransformer.cfg | 6 + .../overdrive_that_matters.mixins.json | 1 - 7 files changed, 249 insertions(+), 52 deletions(-) delete mode 100644 src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/config/IFoodRegenerationValues.kt create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java deleted file mode 100644 index 2b00f3d4f..000000000 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/FoodDataMixin.java +++ /dev/null @@ -1,50 +0,0 @@ -package ru.dbotthepony.mc.otm.mixin; - -import net.minecraft.world.Difficulty; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.food.FoodData; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import ru.dbotthepony.mc.otm.player.IMatteryPlayer; - -@Mixin(FoodData.class) -public class FoodDataMixin { - @Shadow(remap = false) - private int lastFoodLevel; - @Shadow(remap = false) - private int tickTimer; - @Shadow(remap = false) - private int foodLevel; - @Shadow(remap = false) - private float exhaustionLevel; - - @Inject( - method = "tick(Lnet/minecraft/world/entity/player/Player;)V", - at = @At("HEAD"), - remap = false, - cancellable = true - ) - private void tick(Player player, CallbackInfo info) { - var it = ((IMatteryPlayer) player).getOtmPlayer(); - - if (it.isAndroid()) { - info.cancel(); - - // полностью подменяем логику если андроид - lastFoodLevel = foodLevel; - - if (player.level().getDifficulty() == Difficulty.PEACEFUL) { - exhaustionLevel = 0f; - } else { - tickTimer = 0; - } - - // не обновляем уровень истощения ибо он обнуляется логикой внутри MatteryPlayerCapability - // а так же не регенерируем - // ну и не получаем урон от "голодания" - } - } -} diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java index bcde0cf79..c6f691361 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java @@ -4,21 +4,25 @@ import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodData; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import ru.dbotthepony.mc.otm.player.IMatteryPlayer; +import ru.dbotthepony.mc.otm.player.MatteryFoodData; import ru.dbotthepony.mc.otm.player.MatteryPlayer; import java.util.Objects; @Mixin(Player.class) -public class MixinPlayer implements IMatteryPlayer { +public abstract class MixinPlayer implements IMatteryPlayer { private Player otmSelf() { return (Player) (Object) this; } @@ -85,4 +89,15 @@ public class MixinPlayer implements IMatteryPlayer { private void readAdditionalSaveData(CompoundTag data, CallbackInfo ci) { otmPlayer.deserializeNBT(data.getCompound("overdrive_that_matters_player"), otmSelf().registryAccess()); } + + @Shadow + protected FoodData foodData; + + @Inject( + method = "", + at = @At("TAIL") + ) + private void ctorMix() { + foodData = new MatteryFoodData(otmSelf()); + } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/IFoodRegenerationValues.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/IFoodRegenerationValues.kt new file mode 100644 index 000000000..ab1e9e719 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/IFoodRegenerationValues.kt @@ -0,0 +1,9 @@ +package ru.dbotthepony.mc.otm.config + +interface IFoodRegenerationValues { + val foodLimit: Int + val requiresSaturation: Boolean + val ticks: Int + val regenerationSlowdown: Boolean + val upperSlowdownBound: Double +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index 90ca28b22..fb5108a30 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -148,4 +148,103 @@ object PlayerConfig : AbstractConfig("player") { Magnet Shockwave } + + object Food { + init { + builder + .comment("Food related tweaks") + .comment("Since OTM overrides FoodData logic (to make room for Android logic)") + .comment("these settings are provided for tweaking FoodData behavior") + .push("Food") + } + + val SOFT_FOOD_LIMIT: Int by builder + .comment("Soft food points limit, which dictate upper bound where player is considered 'hungry',") + .comment("e.g. they can eat food which is not marked as 'can always eat'") + .defineInRange("SOFT_FOOD_LIMIT", 20, 0) + + val HARD_FOOD_LIMIT: Int by builder + .comment("Hard food points limit, which dictate upper bound of food points,") + .comment("e.g. hunger can not go above this value") + .comment("This is extremely buffed in OTM by default to remove annoyance regarding consuming foodstuffs") + .comment("when you are running low on food, so you can eat high-quality food without fear") + .comment("that food points will go to waste (especially when you need to regenerate lots of HP)") + .defineInRange("HARD_FOOD_LIMIT", 40, 1) + + val OVERSATURATION_LIMIT: Double by builder + .comment("Controls how much 'saturation' can be stored above hunger level.") + .comment("Negative values will decrease maximum saturation achievable.") + .defineInRange("OVERSATURATION_LIMIT", 0.0, -Float.MAX_VALUE.toDouble() + 1.0, Float.MAX_VALUE.toDouble() - 1.0) + + val EXHAUSTION_LIMIT: Double by builder + .comment("Controls technical aspect how much 'exhaustion' player can accumulate") + .comment("This should not be confused with how much 'exhaustion' is considered as 1 hunger point") + .comment("Usually, this should not be changed, since it is a very technical detail") + .comment("but if you have a mod installed which easily hits this limit (and somehow hunger system can't keep up,)") + .comment("e.g. it pushes exhaustion over its limit in one call), you can increase this value") + .defineInRange("EXHAUSTION_LIMIT", 40.0, 4.0, Float.MAX_VALUE.toDouble() - 1.0) + + private fun defineRegeneration( + threshold: Int, + requiresSaturation: Boolean, + ticks: Int, + ): IFoodRegenerationValues { + return object : IFoodRegenerationValues { + override val foodLimit: Int by builder + .defineInRange("FOOD_THRESHOLD", threshold, 1) + + override val requiresSaturation: Boolean by builder + .define("REQUIRES_SATURATION", requiresSaturation) + + override val ticks: Int by builder + .defineInRange("TICKS", ticks, 0) + + override val regenerationSlowdown: Boolean by builder + .comment("Slowdown regeneration based on remaining saturation (given REQUIRES_SATURATION is true)") + .comment("This replicates vanilla behavior where fast regeneration speed linearly slowdowns the moment") + .comment("saturation falls below 6 hunger points (configurable through SATURATION_SLOWDOWN_BOUND)") + .comment("This is disabled in OTM by default to buff humans compared to androids when it comes to regeneration") + .define("SATURATION_SLOWDOWN", false) + + override val upperSlowdownBound: Double by builder + .defineInRange("SATURATION_SLOWDOWN_BOUND", 6.0, 1.0, Float.MAX_VALUE - 1.0) + } + } + + val FAST_REGEN: IFoodRegenerationValues + val SLOW_REGEN: IFoodRegenerationValues + + init { + builder.push("FAST_REGENERATION") + FAST_REGEN = defineRegeneration(20, true, 10) + builder.pop() + + builder.push("SLOW_REGENERATION") + SLOW_REGEN = defineRegeneration(18, false, 80) + builder.pop() + } + + val ENABLE_STARVATION: Boolean by builder + .define("ENABLE_STARVATION", true) + + val STARVATION_TICKS: Int by builder + .defineInRange("STARVATION_TICKS", 80, 1) + + val STARVATION_HEALTH_LIMIT_EASY: Double by builder + .defineInRange("STARVATION_HEALTH_LIMIT_EASY", 10.0, 0.0) + + val STARVATION_HEALTH_LIMIT_NORMAL: Double by builder + .defineInRange("STARVATION_HEALTH_LIMIT_NORMAL", 1.0, 0.0) + + val STARVATION_HEALTH_LIMIT_HARD: Double by builder + .defineInRange("STARVATION_HEALTH_LIMIT_HARD", 0.0, 0.0) + + init { + builder.pop() + } + } + + init { + Food + } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt new file mode 100644 index 000000000..1fc92dfa0 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt @@ -0,0 +1,119 @@ +package ru.dbotthepony.mc.otm.player + +import net.minecraft.nbt.CompoundTag +import net.minecraft.world.Difficulty +import net.minecraft.world.entity.player.Player +import net.minecraft.world.food.FoodConstants +import net.minecraft.world.food.FoodData +import net.minecraft.world.food.FoodProperties +import net.minecraft.world.level.GameRules +import ru.dbotthepony.mc.otm.config.IFoodRegenerationValues +import ru.dbotthepony.mc.otm.config.PlayerConfig +import ru.dbotthepony.mc.otm.core.nbt.set +import kotlin.math.max +import kotlin.math.min +import kotlin.math.roundToInt + +class MatteryFoodData(private var player: Player) : FoodData() { + private fun add(foodLevel: Int, saturation: Float) { + this.foodLevel = min(this.foodLevel + foodLevel, PlayerConfig.Food.HARD_FOOD_LIMIT) + this.saturationLevel = min(this.saturationLevel + saturation, this.foodLevel + PlayerConfig.Food.OVERSATURATION_LIMIT.toFloat()).coerceAtLeast(0f) + } + + override fun eat(foodLevelModifier: Int, saturationLevelModifier: Float) { + add(foodLevelModifier, FoodConstants.saturationByModifier(foodLevelModifier, saturationLevelModifier)) + } + + override fun eat(foodProperties: FoodProperties) { + add(foodProperties.nutrition(), foodProperties.saturation()) + } + + override fun needsFood(): Boolean { + return foodLevel < PlayerConfig.Food.SOFT_FOOD_LIMIT + } + + override fun addExhaustion(exhaustion: Float) { + this.exhaustionLevel = min(this.exhaustionLevel + exhaustion, PlayerConfig.Food.EXHAUSTION_LIMIT.toFloat()) + } + + override fun readAdditionalSaveData(compoundTag: CompoundTag) { + super.readAdditionalSaveData(compoundTag) + + if ("lastFoodLevel" in compoundTag) + lastFoodLevel = compoundTag.getInt("lastFoodLevel") + } + + override fun addAdditionalSaveData(compoundTag: CompoundTag) { + super.addAdditionalSaveData(compoundTag) + compoundTag["lastFoodLevel"] = lastFoodLevel + } + + private fun tickExhaustion() { + if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) { + var points = (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT).toInt() + exhaustionLevel %= EXHAUSTION_PER_HUNGER_POINT + + if (saturationLevel > 0f) { + val satisfied = min(saturationLevel.roundToInt(), points) + points -= satisfied + saturationLevel -= satisfied + } + + foodLevel = max(0, foodLevel - points) + } + } + + private fun tickRegeneration(values: IFoodRegenerationValues): Boolean { + if (!player.isHurt || foodLevel < values.foodLimit || values.requiresSaturation && saturationLevel <= 0f) + return false + + while (player.isHurt && foodLevel >= values.foodLimit && (!values.requiresSaturation || saturationLevel > 0f) && ++tickTimer >= values.ticks) { + tickTimer = 0 + + val healAmount = if (values.requiresSaturation && values.regenerationSlowdown) min(saturationLevel, values.upperSlowdownBound.toFloat()) / values.upperSlowdownBound.toFloat() else 1f + player.heal(healAmount) + addExhaustion(healAmount * 6f) + tickExhaustion() + } + + return tickTimer != 0 + } + + override fun tick(player: Player) { + this.player = player + + if (player.matteryPlayer.isAndroid) + return + + lastFoodLevel = foodLevel + tickExhaustion() + + if ( + player.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION) && + (tickRegeneration(PlayerConfig.Food.FAST_REGEN) || tickRegeneration(PlayerConfig.Food.SLOW_REGEN)) + ) { + // do nothing + } else if (PlayerConfig.Food.ENABLE_STARVATION && foodLevel <= 0) { + if (++tickTimer >= PlayerConfig.Food.STARVATION_TICKS) { + tickTimer = 0 + + val threshold = when (player.level().difficulty) { + Difficulty.PEACEFUL -> Float.POSITIVE_INFINITY + Difficulty.EASY -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_EASY.toFloat() + Difficulty.NORMAL -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_NORMAL.toFloat() + Difficulty.HARD -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_HARD.toFloat() + } + + if (player.health > threshold) { + player.hurt(player.damageSources().starve(), 1.0f) + } + } + } else { + tickTimer = 0 + } + } + + companion object { + const val EXHAUSTION_PER_HUNGER_POINT = 4f + } +} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 981907976..131df1c03 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -176,3 +176,9 @@ public net.minecraft.advancements.critereon.InventoryChangeTrigger$TriggerInstan #public-f net.minecraft.advancements.critereon.SimpleCriterionTrigger removePlayerListeners(Lnet/minecraft/server/PlayerAdvancements;)V public net.minecraft.world.entity.npc.VillagerTrades$TreasureMapForEmeralds + +protected net.minecraft.world.food.FoodData foodLevel +protected net.minecraft.world.food.FoodData saturationLevel +protected net.minecraft.world.food.FoodData exhaustionLevel +protected net.minecraft.world.food.FoodData tickTimer +protected net.minecraft.world.food.FoodData lastFoodLevel diff --git a/src/main/resources/overdrive_that_matters.mixins.json b/src/main/resources/overdrive_that_matters.mixins.json index 934ead87e..5a114f337 100644 --- a/src/main/resources/overdrive_that_matters.mixins.json +++ b/src/main/resources/overdrive_that_matters.mixins.json @@ -7,7 +7,6 @@ "refmap": "overdrive_that_matters.refmap.json", "mixins": [ "BlockEntityMixin", - "FoodDataMixin", "MixinLivingEntity", "MixinAnvilBlock", "MixinInventory", From c4d5ffefa5c9bf89d402315bd64854824efade1f Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 10:37:54 +0700 Subject: [PATCH 07/12] Move all logic regarding food / regeneration to MatteryFoodData --- .../dbotthepony/mc/otm/config/PlayerConfig.kt | 17 ++- .../mc/otm/player/MatteryFoodData.kt | 142 ++++++++++++++---- .../mc/otm/player/MatteryPlayer.kt | 82 +--------- 3 files changed, 129 insertions(+), 112 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index fb5108a30..7bad9ab1c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -5,15 +5,22 @@ import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.defineDecimal object PlayerConfig : AbstractConfig("player") { + init { + builder.push("Android") + } + val REGENERATE_ENERGY: Boolean by builder - .comment("If (technically) hunger is above threshold, it turns into energy") .comment("This setting controls whenever to regenerate small amount of energy while eating as Android") .comment("And also whenever to regenerate energy while in peaceful") - .comment("If this is disabled, any (technically) excess hunger will be nullified, unless playing on peaceful difficulty.") .define("REGENERATE_ENERGY", true) + val REGENERATE_ENERGY_IN_PEACEFUL: Boolean by builder + .comment("Regenerate energy while in peaceful") + .comment("This is disabled by default because this is easily exploitable") + .define("REGENERATE_ENERGY_IN_PEACEFUL", false) + val TIME_BETWEEN_NATURAL_REGENERATION: Int by builder - .comment("Time in ticks between natural health regeneration ticks") + .comment("Time in ticks between natural health regeneration ticks for Android") .comment("Default value is meant to be one of downsides of being an android,") .comment("so please, don't blindly buff it, players have ability to research into Nanobots Regeneration,") .comment("which provide superior regeneration on average than human players.") @@ -24,6 +31,10 @@ object PlayerConfig : AbstractConfig("player") { .comment("for android players, since 'hunger' (for compatibility) is managed by mod in such case") .defineInRange("TIME_BETWEEN_NATURAL_REGENERATION", 120, 0, Int.MAX_VALUE) + init { + builder.pop() + } + object NanobotsRegeneration { init { builder.push("NanobotsRegeneration") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt index 1fc92dfa0..279438107 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt @@ -2,6 +2,9 @@ package ru.dbotthepony.mc.otm.player import net.minecraft.nbt.CompoundTag import net.minecraft.world.Difficulty +import net.minecraft.world.damagesource.DamageSource +import net.minecraft.world.effect.MobEffectInstance +import net.minecraft.world.effect.MobEffects import net.minecraft.world.entity.player.Player import net.minecraft.world.food.FoodConstants import net.minecraft.world.food.FoodData @@ -9,15 +12,24 @@ import net.minecraft.world.food.FoodProperties import net.minecraft.world.level.GameRules import ru.dbotthepony.mc.otm.config.IFoodRegenerationValues import ru.dbotthepony.mc.otm.config.PlayerConfig +import ru.dbotthepony.mc.otm.core.damageType +import ru.dbotthepony.mc.otm.core.math.Decimal +import ru.dbotthepony.mc.otm.core.math.getDecimal +import ru.dbotthepony.mc.otm.core.math.set import ru.dbotthepony.mc.otm.core.nbt.set +import ru.dbotthepony.mc.otm.registry.MDamageTypes import kotlin.math.max import kotlin.math.min import kotlin.math.roundToInt class MatteryFoodData(private var player: Player) : FoodData() { private fun add(foodLevel: Int, saturation: Float) { - this.foodLevel = min(this.foodLevel + foodLevel, PlayerConfig.Food.HARD_FOOD_LIMIT) - this.saturationLevel = min(this.saturationLevel + saturation, this.foodLevel + PlayerConfig.Food.OVERSATURATION_LIMIT.toFloat()).coerceAtLeast(0f) + if (player.matteryPlayer.isAndroid && PlayerConfig.REGENERATE_ENERGY) { + energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * foodLevel + PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * saturation + } else if (!player.matteryPlayer.isAndroid) { + this.foodLevel = min(this.foodLevel + foodLevel, PlayerConfig.Food.HARD_FOOD_LIMIT) + this.saturationLevel = min(this.saturationLevel + saturation, this.foodLevel + PlayerConfig.Food.OVERSATURATION_LIMIT.toFloat()).coerceAtLeast(0f) + } } override fun eat(foodLevelModifier: Int, saturationLevelModifier: Float) { @@ -29,11 +41,12 @@ class MatteryFoodData(private var player: Player) : FoodData() { } override fun needsFood(): Boolean { - return foodLevel < PlayerConfig.Food.SOFT_FOOD_LIMIT + return player.matteryPlayer.isAndroid || foodLevel < PlayerConfig.Food.SOFT_FOOD_LIMIT } override fun addExhaustion(exhaustion: Float) { - this.exhaustionLevel = min(this.exhaustionLevel + exhaustion, PlayerConfig.Food.EXHAUSTION_LIMIT.toFloat()) + // store exhaustion as usual, and handle its reduction in tick for both humans and androids + this.exhaustionLevel = min(this.exhaustionLevel + exhaustion, PlayerConfig.Food.EXHAUSTION_LIMIT.toFloat()).coerceAtLeast(0f) } override fun readAdditionalSaveData(compoundTag: CompoundTag) { @@ -41,25 +54,35 @@ class MatteryFoodData(private var player: Player) : FoodData() { if ("lastFoodLevel" in compoundTag) lastFoodLevel = compoundTag.getInt("lastFoodLevel") + + if ("foodAndroidEnergyToDrain" in compoundTag) + energyToDrain = compoundTag.getDecimal("foodAndroidEnergyToDrain") } override fun addAdditionalSaveData(compoundTag: CompoundTag) { super.addAdditionalSaveData(compoundTag) compoundTag["lastFoodLevel"] = lastFoodLevel + compoundTag["foodAndroidEnergyToDrain"] = energyToDrain } + private var energyToDrain = Decimal.ZERO + private fun tickExhaustion() { if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) { var points = (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT).toInt() exhaustionLevel %= EXHAUSTION_PER_HUNGER_POINT - if (saturationLevel > 0f) { - val satisfied = min(saturationLevel.roundToInt(), points) - points -= satisfied - saturationLevel -= satisfied - } + if (player.matteryPlayer.isAndroid) { + energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * points + } else { + if (saturationLevel > 0f) { + val satisfied = min(saturationLevel.roundToInt(), points) + points -= satisfied + saturationLevel -= satisfied + } - foodLevel = max(0, foodLevel - points) + foodLevel = max(0, foodLevel - points) + } } } @@ -82,37 +105,96 @@ class MatteryFoodData(private var player: Player) : FoodData() { override fun tick(player: Player) { this.player = player - if (player.matteryPlayer.isAndroid) - return - - lastFoodLevel = foodLevel tickExhaustion() - if ( - player.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION) && - (tickRegeneration(PlayerConfig.Food.FAST_REGEN) || tickRegeneration(PlayerConfig.Food.SLOW_REGEN)) - ) { - // do nothing - } else if (PlayerConfig.Food.ENABLE_STARVATION && foodLevel <= 0) { - if (++tickTimer >= PlayerConfig.Food.STARVATION_TICKS) { - tickTimer = 0 + if (player.matteryPlayer.isAndroid) { + if (energyToDrain > Decimal.ZERO) + energyToDrain -= player.matteryPlayer.androidEnergy.extractEnergy(energyToDrain, false) + else if (energyToDrain < Decimal.ZERO) + energyToDrain += player.matteryPlayer.androidEnergy.receiveEnergy(-energyToDrain, false) - val threshold = when (player.level().difficulty) { - Difficulty.PEACEFUL -> Float.POSITIVE_INFINITY - Difficulty.EASY -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_EASY.toFloat() - Difficulty.NORMAL -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_NORMAL.toFloat() - Difficulty.HARD -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_HARD.toFloat() + if (player.level().difficulty == Difficulty.PEACEFUL && PlayerConfig.REGENERATE_ENERGY_IN_PEACEFUL) + player.matteryPlayer.androidEnergy.receiveEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false) + + if (!player.matteryPlayer.androidHasEnergy) { + if (++tickTimer >= 20 && player.hurt(DamageSource(player.level().registryAccess().damageType(MDamageTypes.ANDROID_DISCHARGE)), 1f)) { + tickTimer = 0 } - if (player.health > threshold) { - player.hurt(player.damageSources().starve(), 1.0f) + val effect = player.activeEffectsMap[MobEffects.MOVEMENT_SLOWDOWN] + + if (effect == null || effect.duration < 40 || effect.amplifier < 2) { + player.addEffect(MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, effect?.duration?.coerceAtLeast(60) ?: 60, effect?.amplifier?.coerceAtLeast(2) ?: 2, false, false)) + } + } else { + if (player.isHurt && player.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { + if (++tickTimer >= PlayerConfig.TIME_BETWEEN_NATURAL_REGENERATION) { + player.heal(1f) + addExhaustion(6f) + tickTimer = 0 + } + } else { + tickTimer = 0 } } } else { - tickTimer = 0 + lastFoodLevel = foodLevel + energyToDrain = Decimal.ZERO + + if ( + player.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION) && + (tickRegeneration(PlayerConfig.Food.FAST_REGEN) || tickRegeneration(PlayerConfig.Food.SLOW_REGEN)) + ) { + // do nothing + } else if (PlayerConfig.Food.ENABLE_STARVATION && foodLevel <= 0) { + if (++tickTimer >= PlayerConfig.Food.STARVATION_TICKS) { + tickTimer = 0 + + val threshold = when (player.level().difficulty) { + Difficulty.PEACEFUL -> Float.POSITIVE_INFINITY + Difficulty.EASY -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_EASY.toFloat() + Difficulty.NORMAL -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_NORMAL.toFloat() + Difficulty.HARD -> PlayerConfig.Food.STARVATION_HEALTH_LIMIT_HARD.toFloat() + } + + if (player.health > threshold) { + player.hurt(player.damageSources().starve(), 1.0f) + } + } + } else { + tickTimer = 0 + } } } + override fun getFoodLevel(): Int { + if (player.matteryPlayer.isAndroid) + return if (player.matteryPlayer.androidHasEnergy) PlayerConfig.Food.SOFT_FOOD_LIMIT else 0 + + return super.getFoodLevel() + } + + override fun getLastFoodLevel(): Int { + if (player.matteryPlayer.isAndroid) + return getFoodLevel() + + return super.getLastFoodLevel() + } + + override fun getExhaustionLevel(): Float { + if (player.matteryPlayer.isAndroid && player.matteryPlayer.androidHasEnergy) + return 0f + + return super.getExhaustionLevel() + } + + override fun getSaturationLevel(): Float { + if (player.matteryPlayer.isAndroid) + return if (player.matteryPlayer.androidHasEnergy) player.matteryPlayer.androidEnergy.batteryLevel.percentage(player.matteryPlayer.androidEnergy.maxBatteryLevel) * PlayerConfig.Food.SOFT_FOOD_LIMIT else 0f + + return super.getSaturationLevel() + } + companion object { const val EXHAUSTION_PER_HUNGER_POINT = 4f } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt index bde1b88f8..2553a6656 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt @@ -436,8 +436,6 @@ class MatteryPlayer(val ply: Player) { private var shouldPlaySound = false private val research = IdentityHashMap() - private var nextDischargeHurt = 20 - private var nextHealTick = 0 /** * This returns if player is an Android or will become one on death/sleep/etc @@ -563,6 +561,9 @@ class MatteryPlayer(val ply: Player) { */ val androidEnergy = BatteryBackedEnergyStorage(ply, syncher, PlayerConfig.ANDROID_MAX_ENERGY, PlayerConfig.ANDROID_MAX_ENERGY, true) + val androidHasEnergy: Boolean + get() = androidEnergy.batteryLevel > Decimal.TEN + /** * [IMatteryEnergyStorage] instance, representing Exopack battery charge */ @@ -584,8 +585,6 @@ class MatteryPlayer(val ply: Player) { savetables.bool(::isExopackCraftingUpgraded, "isExoSuitCraftingUpgraded") savetables.bool(::isExopackEnderAccessInstalled, "isExopackEnderAccessUpgraded") savetables.bool(::acceptExopackChargeFromWirelessCharger) - savetables.int(::nextDischargeHurt) - savetables.int(::nextHealTick) savetables.vector(::lastLiquidPosition) savetables.codec(::lastDimension, ResourceLocation.CODEC) @@ -1213,81 +1212,6 @@ class MatteryPlayer(val ply: Player) { lastLiquidPosition = ply.position } - - val stats = ply.foodData - val fourTimesTheHunger = PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * 4 - - // истощение - if (stats.exhaustionLevel > 0f) { - val extracted = androidEnergy.extractEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (stats.exhaustionLevel / 4f), false) - stats.setExhaustion(stats.exhaustionLevel - (extracted / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat() * 4f) - } - - // Обычный голод - while ( - stats.foodLevel < 18 && - androidEnergy.batteryLevel >= fourTimesTheHunger && - androidEnergy.extractEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false) - ) { - stats.foodLevel++ - } - - // "поглощение" излишек голода, как при мирном режиме, так и при поедании обычной еды - if (PlayerConfig.REGENERATE_ENERGY) { - while (stats.foodLevel > 18 && androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT / 2, false)) { - stats.foodLevel-- - } - } else if (ply.level().difficulty != Difficulty.PEACEFUL) { - stats.foodLevel = stats.foodLevel.coerceAtMost(18) - } - - val foodLevel = stats.foodLevel.toFloat() - - // насыщение - if (stats.saturationLevel < foodLevel && androidEnergy.batteryLevel >= fourTimesTheHunger) { - val extracted = androidEnergy.extractEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (foodLevel - stats.saturationLevel), false) - stats.setSaturation(stats.saturationLevel + (extracted / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) - } - - if (androidEnergy.batteryLevel <= Decimal.TEN && !ply.isCreative && ply.level().difficulty != Difficulty.PEACEFUL) { - if (stats.saturationLevel > 1f) { - if (androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { - stats.setSaturation(stats.saturationLevel - 1f) - } - } else if (stats.saturationLevel > 0f) { - val received = androidEnergy.receiveEnergy(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * stats.saturationLevel, false) - stats.setSaturation(stats.saturationLevel - (received / PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT).toFloat()) - } else if (stats.foodLevel > 0) { - // так как голод не тикает для андроидов, "умереть с голоду" мы не можем - // но со стороны будет выглядеть как будто мы умираем с голода - if (androidEnergy.receiveEnergyExact(PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)) { - stats.foodLevel-- - } - } - - if (androidEnergy.batteryLevel <= Decimal.TEN) { - if (--nextDischargeHurt <= 0 && ply.hurt(DamageSource(ply.level().registryAccess().damageType(MDamageTypes.ANDROID_DISCHARGE)), 1f)) { - nextDischargeHurt = 20 - } - - val effect = ply.activeEffectsMap[MobEffects.MOVEMENT_SLOWDOWN] - - if (effect == null || effect.duration < 40 || effect.amplifier < 2) { - ply.addEffect(MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, effect?.duration?.coerceAtLeast(60) ?: 60, effect?.amplifier?.coerceAtLeast(2) ?: 2, false, false)) - } - } - } else { - nextDischargeHurt = 20 - - if (ply.isHurt && ply.level().gameRules.getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { - if (--nextHealTick <= 0) { - nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else PlayerConfig.TIME_BETWEEN_NATURAL_REGENERATION - ply.heal(1f) - } - } else { - nextHealTick = if (ply.level().difficulty == Difficulty.PEACEFUL) 10 else PlayerConfig.TIME_BETWEEN_NATURAL_REGENERATION - } - } } for (feature in featureMap.values) { From b23bda2f6a2b49d9cc0f4f1768dc72d1fb294572 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 10:54:08 +0700 Subject: [PATCH 08/12] Move android package to player package --- .../ru/dbotthepony/mc/otm/datagen/DataGen.kt | 2 +- .../mc/otm/datagen/ResearchData.kt | 6 +- .../datagen/lang/MatteryLanguageProvider.kt | 4 +- .../mc/otm/OverdriveThatMatters.kt | 12 +-- .../mc/otm/client/AndroidAbilityKeyMapping.kt | 2 +- .../mc/otm/client/AndroidMenuKeyMapping.kt | 4 +- .../mc/otm/client/ClientEventHandler.kt | 2 +- .../dbotthepony/mc/otm/client/MatteryGUI.kt | 2 +- .../screen/tech/AndroidStationScreen.kt | 6 +- .../mc/otm/network/AndroidPackets.kt | 10 +-- .../mc/otm/network/NetworkPackets.kt | 4 +- .../mc/otm/player/MatteryPlayer.kt | 16 ++-- .../android/AndroidActiveFeature.kt | 2 +- .../{ => player}/android/AndroidFeature.kt | 2 +- .../android/AndroidFeatureType.kt | 2 +- .../{ => player}/android/AndroidResearch.kt | 2 +- .../android/AndroidResearchDataProvider.kt | 2 +- .../android/AndroidResearchDescription.kt | 74 +++++++++++++++---- .../android/AndroidResearchManager.kt | 7 +- .../android/AndroidResearchResult.kt | 13 ++-- .../android/AndroidResearchType.kt | 6 +- .../android/AndroidSwitchableFeature.kt | 2 +- .../android/feature/AttackBoostFeature.kt | 4 +- .../android/feature/EnderTeleporterFeature.kt | 4 +- .../android/feature/ExtendedReachFeature.kt | 4 +- .../android/feature/FallDampenersFeature.kt | 4 +- .../android/feature/ItemMagnetFeature.kt | 9 ++- .../android/feature/JumpBoostFeature.kt | 4 +- .../feature/LimbOverclockingFeature.kt | 6 +- .../android/feature/NanobotsArmorFeature.kt | 4 +- .../feature/NanobotsRegenerationFeature.kt | 4 +- .../android/feature/NightVisionFeature.kt | 4 +- .../android/feature/ShockwaveFeature.kt | 4 +- .../android/feature/StepAssistFeature.kt | 4 +- .../android/feature/SwimBoostersFeature.kt | 4 +- .../dbotthepony/mc/otm/registry/MRegistry.kt | 6 +- .../mc/otm/registry/game/AndroidFeatures.kt | 18 ++++- .../mc/otm/server/command/AndroidCommand.kt | 4 +- .../server/command/AndroidResearchArgument.kt | 4 +- .../mc/otm/triggers/AndroidResearchTrigger.kt | 2 +- 40 files changed, 165 insertions(+), 110 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidActiveFeature.kt (95%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidFeature.kt (97%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidFeatureType.kt (96%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearch.kt (99%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearchDataProvider.kt (98%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearchDescription.kt (68%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearchManager.kt (97%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearchResult.kt (94%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidResearchType.kt (99%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/AndroidSwitchableFeature.kt (98%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/AttackBoostFeature.kt (89%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/EnderTeleporterFeature.kt (99%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/ExtendedReachFeature.kt (89%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/FallDampenersFeature.kt (91%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/ItemMagnetFeature.kt (96%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/JumpBoostFeature.kt (95%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/LimbOverclockingFeature.kt (91%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/NanobotsArmorFeature.kt (96%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/NanobotsRegenerationFeature.kt (95%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/NightVisionFeature.kt (92%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/ShockwaveFeature.kt (98%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/StepAssistFeature.kt (93%) rename src/main/kotlin/ru/dbotthepony/mc/otm/{ => player}/android/feature/SwimBoostersFeature.kt (92%) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt index 396d3f04d..52fb18559 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt @@ -23,7 +23,7 @@ import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider import net.neoforged.neoforge.data.event.GatherDataEvent import net.neoforged.neoforge.registries.NeoForgeRegistries import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidResearchDataProvider +import ru.dbotthepony.mc.otm.player.android.AndroidResearchDataProvider import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.util.WriteOnce diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt index 9032c063f..387c7a582 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/ResearchData.kt @@ -4,9 +4,9 @@ import net.minecraft.tags.ItemTags import net.minecraft.world.item.Items import net.neoforged.neoforge.common.Tags import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidResearchDescriptions -import ru.dbotthepony.mc.otm.android.AndroidResearchResults -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchDescriptions +import ru.dbotthepony.mc.otm.player.android.AndroidResearchResults +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/MatteryLanguageProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/MatteryLanguageProvider.kt index a92f5f2bf..7aabd86cc 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/MatteryLanguageProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/MatteryLanguageProvider.kt @@ -15,8 +15,8 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.level.block.Block import net.neoforged.neoforge.common.data.LanguageProvider import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeatureType -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt index b9c7345e2..dd23eeaef 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/OverdriveThatMatters.kt @@ -6,12 +6,12 @@ import net.neoforged.bus.api.EventPriority import net.neoforged.fml.common.Mod import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent -import ru.dbotthepony.mc.otm.android.AndroidResearchDescription -import ru.dbotthepony.mc.otm.android.AndroidResearchDescriptions -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchResult -import ru.dbotthepony.mc.otm.android.AndroidResearchResults -import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature +import ru.dbotthepony.mc.otm.player.android.AndroidResearchDescription +import ru.dbotthepony.mc.otm.player.android.AndroidResearchDescriptions +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchResult +import ru.dbotthepony.mc.otm.player.android.AndroidResearchResults +import ru.dbotthepony.mc.otm.player.android.feature.EnderTeleporterFeature import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity import ru.dbotthepony.mc.otm.player.MatteryPlayer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt index 2cb90d1a1..8218c4dd3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt @@ -8,7 +8,7 @@ import net.neoforged.neoforge.client.event.RenderLevelStageEvent import net.neoforged.neoforge.client.settings.KeyConflictContext import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidActiveFeature +import ru.dbotthepony.mc.otm.player.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets18 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 5b6b2065e..70144d851 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -11,8 +11,8 @@ import net.neoforged.neoforge.client.event.RenderGuiEvent import net.neoforged.neoforge.client.settings.KeyConflictContext import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt index fa0975202..e6b4e9539 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/ClientEventHandler.kt @@ -18,7 +18,7 @@ import net.neoforged.neoforge.client.event.ScreenEvent import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.config.ClientConfig -import ru.dbotthepony.mc.otm.android.feature.JumpBoostFeature +import ru.dbotthepony.mc.otm.player.android.feature.JumpBoostFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.render.UVWindingOrder diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index 20e18e1c6..e414af87d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -23,7 +23,7 @@ import net.neoforged.neoforge.client.event.RenderGuiLayerEvent import net.neoforged.neoforge.client.event.ScreenEvent import net.neoforged.neoforge.client.gui.VanillaGuiLayers import net.neoforged.neoforge.common.ItemAbilities -import ru.dbotthepony.mc.otm.android.feature.NanobotsArmorFeature +import ru.dbotthepony.mc.otm.player.android.feature.NanobotsArmorFeature import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index fee98d5b6..f6edd683a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -11,9 +11,9 @@ import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.android.AndroidResearch -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidResearch +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.CursorType import ru.dbotthepony.mc.otm.client.render.MGUIGraphics diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt index 74a49b8e6..b05ef757b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/AndroidPackets.kt @@ -10,11 +10,11 @@ import net.minecraft.server.level.ServerPlayer import net.minecraft.sounds.SoundSource import net.neoforged.neoforge.network.handling.IPayloadContext import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidActiveFeature -import ru.dbotthepony.mc.otm.android.AndroidFeatureType -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchType -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidActiveFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.client.MatteryGUI diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/NetworkPackets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/NetworkPackets.kt index a44f72a04..1dcb38afa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/NetworkPackets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/NetworkPackets.kt @@ -2,8 +2,8 @@ package ru.dbotthepony.mc.otm.network import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent import net.neoforged.neoforge.network.registration.HandlerThread -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.feature.ItemEntityDataPacket +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.feature.ItemEntityDataPacket import ru.dbotthepony.mc.otm.compat.vanilla.InventoryScrollPacket import ru.dbotthepony.mc.otm.data.FlywheelMaterials import ru.dbotthepony.mc.otm.item.QuantumBatteryItem diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt index 2553a6656..a8a906d5f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryPlayer.kt @@ -20,10 +20,7 @@ import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerPlayer import net.minecraft.tags.TagKey import net.minecraft.world.Container -import net.minecraft.world.Difficulty -import net.minecraft.world.damagesource.DamageSource import net.minecraft.world.effect.MobEffect -import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.boss.wither.WitherBoss @@ -36,7 +33,6 @@ import net.minecraft.world.item.ProjectileWeaponItem import net.minecraft.world.item.crafting.RecipeManager import net.minecraft.world.item.crafting.RecipeType import net.minecraft.world.item.crafting.SingleRecipeInput -import net.minecraft.world.level.GameRules import net.minecraft.world.level.Level import net.minecraft.world.phys.Vec3 import net.neoforged.bus.api.Event @@ -60,11 +56,11 @@ import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue import ru.dbotthepony.kommons.util.value import ru.dbotthepony.mc.otm.* -import ru.dbotthepony.mc.otm.android.AndroidFeature -import ru.dbotthepony.mc.otm.android.AndroidFeatureType -import ru.dbotthepony.mc.otm.android.AndroidResearch -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType +import ru.dbotthepony.mc.otm.player.android.AndroidResearch +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.block.entity.ItemJob import ru.dbotthepony.mc.otm.block.entity.JobContainer import ru.dbotthepony.mc.otm.block.entity.JobStatus @@ -74,8 +70,6 @@ import ru.dbotthepony.mc.otm.capability.energy import ru.dbotthepony.mc.otm.capability.energy.BatteryBackedEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage -import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.capability.energy.receiveEnergyExact import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.config.PlayerConfig diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidActiveFeature.kt similarity index 95% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidActiveFeature.kt index 230a0cd47..348be4672 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidActiveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidActiveFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.Camera diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeature.kt similarity index 97% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeature.kt index 958e2ae6f..b225be0e1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import net.minecraft.core.HolderLookup import net.minecraft.nbt.CompoundTag diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeatureType.kt similarity index 96% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeatureType.kt index d01adc685..9fcc9be5c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidFeatureType.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidFeatureType.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import net.minecraft.network.chat.Component import net.minecraft.network.chat.ComponentContents diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearch.kt similarity index 99% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearch.kt index 3954b9f2e..8e3675772 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearch.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearch.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import net.minecraft.ChatFormatting import net.minecraft.core.HolderLookup diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDataProvider.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDataProvider.kt similarity index 98% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDataProvider.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDataProvider.kt index 1ca529af2..492295d78 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDataProvider.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDataProvider.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import com.google.gson.JsonObject import it.unimi.dsi.fastutil.objects.ObjectArraySet diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt similarity index 68% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt index 1a53c7e37..ac201aa1a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import com.mojang.serialization.Codec import com.mojang.serialization.MapCodec @@ -29,35 +29,76 @@ object AndroidResearchDescriptions { val ENDER_TELEPORTER: AndroidResearchDescription.Singleton by registrar.register("ender_teleporter") { AndroidResearchDescription.singleton { - TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.EnderTeleporter.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + TranslatableComponent( + "otm.gui.power_cost_per_use", + PlayerConfig.EnderTeleporter.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy() + .withStyle(ChatFormatting.YELLOW) + ) + } } val FALL_DAMPENERS: AndroidResearchDescription.Leveled by registrar.register("fall_dampeners") { AndroidResearchDescription.Leveled { _, list, level -> - list.add(TranslatableComponent("otm.fall_dampeners.description", - TextComponent("%.1f".format((PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * level).toFloat().coerceIn(0f, 1f) * 100f)).withStyle(ChatFormatting.YELLOW), - TextComponent("%.1f".format((PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * level).toFloat())).withStyle(ChatFormatting.YELLOW), - )) } + list.add( + TranslatableComponent( + "otm.fall_dampeners.description", + TextComponent( + "%.1f".format( + (PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_P * level).toFloat().coerceIn(0f, 1f) * 100f + ) + ).withStyle(ChatFormatting.YELLOW), + TextComponent("%.1f".format((PlayerConfig.FALL_DAMAGE_REDUCTION_PER_LEVEL_F * level).toFloat())).withStyle( + ChatFormatting.YELLOW + ), + ) + ) + } } val SWIM_BOOSTERS: AndroidResearchDescription.Leveled by registrar.register("swim_boosters") { AndroidResearchDescription.Leveled { _, list, level -> - list.add(TranslatableComponent( - "android_research.overdrive_that_matters.swim_boosters.description", - TextComponent("%.1f".format(PlayerConfig.SWIM_BOOSTERS * (1 + level) * 100.0)).withStyle(ChatFormatting.YELLOW) - )) } + list.add( + TranslatableComponent( + "android_research.overdrive_that_matters.swim_boosters.description", + TextComponent("%.1f".format(PlayerConfig.SWIM_BOOSTERS * (1 + level) * 100.0)).withStyle( + ChatFormatting.YELLOW + ) + ) + ) + } } val ITEM_MAGNET: AndroidResearchDescription.Singleton by registrar.register("item_magnet") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_tick", PlayerConfig.Magnet.POWER_DRAW.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { + TranslatableComponent( + "otm.gui.power_cost_per_tick", + PlayerConfig.Magnet.POWER_DRAW.formatPower( + formatAsReadable = ShiftPressedCond + ).copy().withStyle(ChatFormatting.YELLOW) + ) + } } val JUMP_BOOST: AndroidResearchDescription.Singleton by registrar.register("jump_boost") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.JumpBoost.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { + TranslatableComponent( + "otm.gui.power_cost_per_use", + PlayerConfig.JumpBoost.ENERGY_COST.formatPower( + formatAsReadable = ShiftPressedCond + ).copy().withStyle(ChatFormatting.YELLOW) + ) + } } val SHOCKWAVE: AndroidResearchDescription.Singleton by registrar.register("shockwave") { - AndroidResearchDescription.singleton { TranslatableComponent("otm.gui.power_cost_per_use", PlayerConfig.Shockwave.ENERGY_COST.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.YELLOW)) } + AndroidResearchDescription.singleton { + TranslatableComponent( + "otm.gui.power_cost_per_use", + PlayerConfig.Shockwave.ENERGY_COST.formatPower( + formatAsReadable = ShiftPressedCond + ).copy().withStyle(ChatFormatting.YELLOW) + ) + } } } @@ -78,7 +119,8 @@ interface AndroidResearchDescription { get() = this } - class Leveled(val callback: (research: AndroidResearch, lines: MutableList, level: Int) -> Unit) : Type { + class Leveled(val callback: (research: AndroidResearch, lines: MutableList, level: Int) -> Unit) : + Type { inner class Instance(val level: Int) : AndroidResearchDescription { override fun addLines(research: AndroidResearch, lines: MutableList) { callback.invoke(research, lines, level) @@ -90,7 +132,7 @@ interface AndroidResearchDescription { override val codec: MapCodec by lazy { RecordCodecBuilder.mapCodec { - it.group(Codec.INT.fieldOf("level").forGetter(Instance::level)).apply(it, ::Instance) + it.group(Codec.INT.fieldOf("level").forGetter(Instance::level)).apply(it, Leveled::Instance) } } } @@ -138,7 +180,7 @@ object PlainAndroidResearchDescription : AndroidResearchDescription.Type(ResourceLocation(OverdriveThatMatters.MOD_ID, "research_sync")) - val SYNC_CODEC: StreamCodec = StreamCodec.ofMember(SyncPacket::write, ::readSyncPacket) + val SYNC_CODEC: StreamCodec = StreamCodec.ofMember( + SyncPacket::write, + AndroidResearchManager::readSyncPacket + ) class SyncPacket(val collection: Collection) : CustomPacketPayload { fun write(buff: FriendlyByteBuf) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchResult.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchResult.kt similarity index 94% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchResult.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchResult.kt index ac67e499e..41043c82d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchResult.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchResult.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import com.mojang.serialization.Codec import com.mojang.serialization.MapCodec @@ -16,8 +16,8 @@ object AndroidResearchResults { private val registrar = MDeferredRegister(AndroidResearchResult.registryKey, OverdriveThatMatters.MOD_ID) init { - registrar.register("feature") { AndroidResearchResult.Feature.Companion } - registrar.register("feature_level") { AndroidResearchResult.FeatureLevel.Companion } + registrar.register("feature") { AndroidResearchResult.Feature } + registrar.register("feature_level") { AndroidResearchResult.FeatureLevel } } private object NanobotsArmorStrength : AndroidResearchResult.Singleton { @@ -90,7 +90,7 @@ interface AndroidResearchResult { it.group( ResourceLocation.CODEC.fieldOf("id").forGetter(Feature::id), Codec.BOOL.optionalFieldOf("optional", false).forGetter(Feature::optional) - ).apply(it, ::Feature) + ).apply(it, AndroidResearchResult::Feature) } } } @@ -99,7 +99,8 @@ interface AndroidResearchResult { /** * Increases level of specific android feature [id] by specified amount [levels] */ - class FeatureLevel(val id: ResourceLocation, val optional: Boolean = false, val levels: Int = 1) : AndroidResearchResult { + class FeatureLevel(val id: ResourceLocation, val optional: Boolean = false, val levels: Int = 1) : + AndroidResearchResult { val feature = MRegistry.ANDROID_FEATURES.get(id) ?: if (optional) null else throw NoSuchElementException("Unknown android feature $id") override val type: Type<*> @@ -132,7 +133,7 @@ interface AndroidResearchResult { ResourceLocation.CODEC.fieldOf("id").forGetter(FeatureLevel::id), Codec.BOOL.optionalFieldOf("optional", false).forGetter(FeatureLevel::optional), Codec.INT.optionalFieldOf("levels", 1).forGetter(FeatureLevel::levels), - ).apply(it, ::FeatureLevel) + ).apply(it, AndroidResearchResult::FeatureLevel) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchType.kt similarity index 99% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchType.kt index f7e2cc739..e7fb141cd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidResearchType.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchType.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import com.google.common.collect.ImmutableList import com.google.gson.JsonObject @@ -131,10 +131,10 @@ class AndroidResearchType( it.group( ResourceLocation.CODEC.fieldOf("id").forGetter(Reference::id), Codec.BOOL.optionalFieldOf("optional", false).forGetter(Reference::optional) - ).apply(it, ::Reference) + ).apply(it, AndroidResearchType::Reference) }) .xmap( - { c -> c.map(::Reference, Function.identity()) }, + { c -> c.map(AndroidResearchType::Reference, Function.identity()) }, { c -> if (c.optional) Either.right(c) else Either.left(c.id) } ) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidSwitchableFeature.kt similarity index 98% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidSwitchableFeature.kt index df6ea10af..04a67138c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidSwitchableFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android +package ru.dbotthepony.mc.otm.player.android import net.minecraft.client.multiplayer.ClientLevel import net.minecraft.core.HolderLookup diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/AttackBoostFeature.kt similarity index 89% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/AttackBoostFeature.kt index d70658560..c37ae67b8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/AttackBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/AttackBoostFeature.kt @@ -1,9 +1,9 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/EnderTeleporterFeature.kt similarity index 99% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/EnderTeleporterFeature.kt index 35bad8f25..807d461b1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/EnderTeleporterFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.PoseStack @@ -25,7 +25,7 @@ import net.neoforged.neoforge.event.entity.living.LivingDeathEvent import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.NULLABLE_MINECRAFT_SERVER import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidActiveFeature +import ru.dbotthepony.mc.otm.player.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.player.matteryPlayer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ExtendedReachFeature.kt similarity index 89% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ExtendedReachFeature.kt index c816e044e..7c80cab46 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ExtendedReachFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ExtendedReachFeature.kt @@ -1,9 +1,9 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/FallDampenersFeature.kt similarity index 91% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/FallDampenersFeature.kt index 0ab545303..9e2cc4ea2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/FallDampenersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/FallDampenersFeature.kt @@ -1,8 +1,8 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.server.level.ServerPlayer import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.config.PlayerConfig import ru.dbotthepony.mc.otm.core.isFall diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ItemMagnetFeature.kt similarity index 96% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ItemMagnetFeature.kt index 679f8f767..abd1d7f60 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ItemMagnetFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.client.multiplayer.ClientLevel import net.minecraft.network.FriendlyByteBuf @@ -12,7 +12,7 @@ import net.neoforged.neoforge.network.handling.IPayloadContext import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.config.PlayerConfig -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics @@ -60,7 +60,10 @@ class ItemEntityDataPacket(val itemUUID: Int, val owner: UUID? = null, val age: companion object { val TYPE = CustomPacketPayload.Type(ResourceLocation(OverdriveThatMatters.MOD_ID, "item_entity_data")) - val CODEC: StreamCodec = StreamCodec.ofMember(ItemEntityDataPacket::write, ::read) + val CODEC: StreamCodec = StreamCodec.ofMember( + ItemEntityDataPacket::write, + Companion::read + ) fun read(buff: FriendlyByteBuf): ItemEntityDataPacket { return ItemEntityDataPacket(buff.readVarInt(), if (buff.readBoolean()) buff.readUUID() else null, buff.readVarInt(), buff.readVarInt(), buff.readBoolean()) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/JumpBoostFeature.kt similarity index 95% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/JumpBoostFeature.kt index 073327eda..c53c7742a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/JumpBoostFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.server.level.ServerPlayer import net.minecraft.sounds.SoundSource @@ -6,7 +6,7 @@ import net.neoforged.neoforge.network.PacketDistributor import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature.kt similarity index 91% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature.kt index 061d5302e..66c5cde75 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/LimbOverclockingFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/LimbOverclockingFeature.kt @@ -1,11 +1,11 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import net.minecraft.world.entity.player.Player import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.player.matteryPlayer import ru.dbotthepony.mc.otm.core.ResourceLocation @@ -17,7 +17,7 @@ class LimbOverclockingFeature(android: MatteryPlayer) : AndroidFeature(AndroidFe if (speed != null) { speed.removeModifier(MODIFIER_ID) - speed.addPermanentModifier(AttributeModifier(MODIFIER_ID,(level + 1) * 0.08, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL)) + speed.addPermanentModifier(AttributeModifier(MODIFIER_ID, (level + 1) * 0.08, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL)) } val attackSpeed = ply.getAttribute(Attributes.ATTACK_SPEED) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsArmorFeature.kt similarity index 96% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsArmorFeature.kt index d80ce2a14..732677573 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsArmorFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.core.HolderLookup import net.minecraft.nbt.CompoundTag @@ -7,7 +7,7 @@ import net.minecraft.tags.DamageTypeTags import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.kommons.util.getValue import ru.dbotthepony.kommons.util.setValue -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.core.isBypassArmor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsRegenerationFeature.kt similarity index 95% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsRegenerationFeature.kt index 23a06c150..1e3817629 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NanobotsRegenerationFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.core.HolderLookup import net.minecraft.nbt.CompoundTag @@ -6,7 +6,7 @@ import net.minecraft.server.level.ServerPlayer import net.minecraft.world.level.GameRules import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent import ru.dbotthepony.mc.otm.config.PlayerConfig -import ru.dbotthepony.mc.otm.android.AndroidFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.StatNames diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NightVisionFeature.kt similarity index 92% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NightVisionFeature.kt index c4c3d9df4..4277aced7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/NightVisionFeature.kt @@ -1,9 +1,9 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import ru.dbotthepony.kommons.math.RGBAColor -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ShockwaveFeature.kt similarity index 98% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ShockwaveFeature.kt index a78b9fe14..a7d3eb6d6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/ShockwaveFeature.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import it.unimi.dsi.fastutil.objects.ReferenceArraySet import net.minecraft.server.level.ServerPlayer @@ -7,7 +7,7 @@ import net.minecraft.world.entity.Entity import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.monster.warden.Warden import net.neoforged.neoforge.network.PacketDistributor -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.client.render.MGUIGraphics diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/StepAssistFeature.kt similarity index 93% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/StepAssistFeature.kt index 92d048b78..08cb9cc6a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/StepAssistFeature.kt @@ -1,8 +1,8 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/SwimBoostersFeature.kt similarity index 92% rename from src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/SwimBoostersFeature.kt index 4f9c16ceb..2cd1a933e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/feature/SwimBoostersFeature.kt @@ -1,8 +1,8 @@ -package ru.dbotthepony.mc.otm.android.feature +package ru.dbotthepony.mc.otm.player.android.feature import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.neoforged.neoforge.common.NeoForgeMod -import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature +import ru.dbotthepony.mc.otm.player.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt index 0cf69e5f3..e117ad120 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt @@ -29,9 +29,9 @@ import net.neoforged.neoforge.event.ModifyDefaultComponentsEvent import net.neoforged.neoforge.registries.RegisterEvent import ru.dbotthepony.kommons.math.RGBAColor import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidFeatureType -import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature -import ru.dbotthepony.mc.otm.android.feature.NanobotsArmorFeature +import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType +import ru.dbotthepony.mc.otm.player.android.feature.EnderTeleporterFeature +import ru.dbotthepony.mc.otm.player.android.feature.NanobotsArmorFeature import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock import ru.dbotthepony.mc.otm.block.decorative.ComputerTerminalBlock import ru.dbotthepony.mc.otm.block.decorative.StarChairBlock diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/AndroidFeatures.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/AndroidFeatures.kt index 43dbc2b22..f3ad0df38 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/AndroidFeatures.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/AndroidFeatures.kt @@ -1,9 +1,21 @@ package ru.dbotthepony.mc.otm.registry.game import net.neoforged.bus.api.IEventBus -import ru.dbotthepony.mc.otm.android.AndroidFeatureType -import ru.dbotthepony.mc.otm.android.DummyAndroidFeature -import ru.dbotthepony.mc.otm.android.feature.* +import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType +import ru.dbotthepony.mc.otm.player.android.DummyAndroidFeature +import ru.dbotthepony.mc.otm.player.android.feature.AttackBoostFeature +import ru.dbotthepony.mc.otm.player.android.feature.EnderTeleporterFeature +import ru.dbotthepony.mc.otm.player.android.feature.ExtendedReachFeature +import ru.dbotthepony.mc.otm.player.android.feature.FallDampenersFeature +import ru.dbotthepony.mc.otm.player.android.feature.ItemMagnetFeature +import ru.dbotthepony.mc.otm.player.android.feature.JumpBoostFeature +import ru.dbotthepony.mc.otm.player.android.feature.LimbOverclockingFeature +import ru.dbotthepony.mc.otm.player.android.feature.NanobotsArmorFeature +import ru.dbotthepony.mc.otm.player.android.feature.NanobotsRegenerationFeature +import ru.dbotthepony.mc.otm.player.android.feature.NightVisionFeature +import ru.dbotthepony.mc.otm.player.android.feature.ShockwaveFeature +import ru.dbotthepony.mc.otm.player.android.feature.StepAssistFeature +import ru.dbotthepony.mc.otm.player.android.feature.SwimBoostersFeature import ru.dbotthepony.mc.otm.registry.MDeferredRegister import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MRegistry diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt index f56e583a5..08e2a5df2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidCommand.kt @@ -4,8 +4,8 @@ import net.minecraft.commands.Commands import net.minecraft.commands.arguments.EntityArgument import net.minecraft.world.entity.player.Player import net.neoforged.neoforge.event.RegisterCommandsEvent -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.player.matteryPlayer object AndroidCommand { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidResearchArgument.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidResearchArgument.kt index 16b9cebde..80a58b0c9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidResearchArgument.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/server/command/AndroidResearchArgument.kt @@ -8,8 +8,8 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder import net.minecraft.commands.CommandSourceStack import net.minecraft.commands.SharedSuggestionProvider import net.minecraft.resources.ResourceLocation -import ru.dbotthepony.mc.otm.android.AndroidResearchManager -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchManager +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import java.util.concurrent.CompletableFuture class AndroidResearchArgument : ArgumentType { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/AndroidResearchTrigger.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/AndroidResearchTrigger.kt index a761cc0bb..8b71b4b85 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/AndroidResearchTrigger.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/triggers/AndroidResearchTrigger.kt @@ -6,7 +6,7 @@ import net.minecraft.advancements.critereon.ContextAwarePredicate import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.android.AndroidResearchType +import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.core.ResourceLocation import java.util.* import java.util.function.Predicate From 922f94b9de82f2646ad9d6e9b9a02a1920894233 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 11:02:08 +0700 Subject: [PATCH 09/12] e --- src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index 7bad9ab1c..d145a42be 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -190,7 +190,7 @@ object PlayerConfig : AbstractConfig("player") { val EXHAUSTION_LIMIT: Double by builder .comment("Controls technical aspect how much 'exhaustion' player can accumulate") .comment("This should not be confused with how much 'exhaustion' is considered as 1 hunger point") - .comment("Usually, this should not be changed, since it is a very technical detail") + .comment("Usually, this should not be changed, since it is a very technical detail;") .comment("but if you have a mod installed which easily hits this limit (and somehow hunger system can't keep up,)") .comment("e.g. it pushes exhaustion over its limit in one call), you can increase this value") .defineInRange("EXHAUSTION_LIMIT", 40.0, 4.0, Float.MAX_VALUE.toDouble() - 1.0) From d10b1b4ee1a820717f44f442f9e51be3024766bd Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 11:21:08 +0700 Subject: [PATCH 10/12] Aeugh --- .../mc/otm/player/android/AndroidResearchDescription.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt index ac201aa1a..2afc8d9dc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/android/AndroidResearchDescription.kt @@ -119,8 +119,7 @@ interface AndroidResearchDescription { get() = this } - class Leveled(val callback: (research: AndroidResearch, lines: MutableList, level: Int) -> Unit) : - Type { + class Leveled(val callback: (research: AndroidResearch, lines: MutableList, level: Int) -> Unit) : Type { inner class Instance(val level: Int) : AndroidResearchDescription { override fun addLines(research: AndroidResearch, lines: MutableList) { callback.invoke(research, lines, level) @@ -132,7 +131,7 @@ interface AndroidResearchDescription { override val codec: MapCodec by lazy { RecordCodecBuilder.mapCodec { - it.group(Codec.INT.fieldOf("level").forGetter(Instance::level)).apply(it, Leveled::Instance) + it.group(Codec.INT.fieldOf("level").forGetter(Instance::level)).apply(it, ::Instance) } } } From e06928a4b54aae4e9832acf11b0a243fd847b355 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 11:24:58 +0700 Subject: [PATCH 11/12] Update mixin signature --- src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java index c6f691361..19a9c6a17 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java +++ b/src/main/java/ru/dbotthepony/mc/otm/mixin/MixinPlayer.java @@ -97,7 +97,7 @@ public abstract class MixinPlayer implements IMatteryPlayer { method = "", at = @At("TAIL") ) - private void ctorMix() { + private void ctorMix(Level level, BlockPos pos, float yRot, GameProfile gameProfile, CallbackInfo info) { foodData = new MatteryFoodData(otmSelf()); } } From 5d8f2d5a4a8644052c4639be8e8efd8fe1e306fe Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 14 Mar 2025 12:04:16 +0700 Subject: [PATCH 12/12] Add REGENERATE_ENERGY_EFFICIENCY_FOOD and REGENERATE_ENERGY_EFFICIENCY_SATURATION --- .../kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt | 8 ++++++++ .../ru/dbotthepony/mc/otm/player/MatteryFoodData.kt | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index d145a42be..b8be2c4c8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -14,6 +14,14 @@ object PlayerConfig : AbstractConfig("player") { .comment("And also whenever to regenerate energy while in peaceful") .define("REGENERATE_ENERGY", true) + val REGENERATE_ENERGY_EFFICIENCY_FOOD: Double by builder + .comment("How much % of food points to convert to energy") + .defineInRange("REGENERATE_ENERGY_EFFICIENCY_FOOD", 0.75, 0.0) + + val REGENERATE_ENERGY_EFFICIENCY_SATURATION: Double by builder + .comment("How much % of food saturation points to convert to energy") + .defineInRange("REGENERATE_ENERGY_EFFICIENCY_SATURATION", 0.4, 0.0) + val REGENERATE_ENERGY_IN_PEACEFUL: Boolean by builder .comment("Regenerate energy while in peaceful") .comment("This is disabled by default because this is easily exploitable") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt index 279438107..1ffbc6b74 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt @@ -25,7 +25,8 @@ import kotlin.math.roundToInt class MatteryFoodData(private var player: Player) : FoodData() { private fun add(foodLevel: Int, saturation: Float) { if (player.matteryPlayer.isAndroid && PlayerConfig.REGENERATE_ENERGY) { - energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * foodLevel + PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * saturation + energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * foodLevel * PlayerConfig.REGENERATE_ENERGY_EFFICIENCY_FOOD + energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * saturation.coerceAtMost(PlayerConfig.Food.SOFT_FOOD_LIMIT.toFloat()) * PlayerConfig.REGENERATE_ENERGY_EFFICIENCY_SATURATION } else if (!player.matteryPlayer.isAndroid) { this.foodLevel = min(this.foodLevel + foodLevel, PlayerConfig.Food.HARD_FOOD_LIMIT) this.saturationLevel = min(this.saturationLevel + saturation, this.foodLevel + PlayerConfig.Food.OVERSATURATION_LIMIT.toFloat()).coerceAtLeast(0f)