Try to fix crashes
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ mod_name=Mind & Motion
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.2.3
|
||||
mod_version=1.2.4
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
@@ -6,11 +6,8 @@ import net.fretux.mindmotion.command.SanityCommand;
|
||||
import net.fretux.mindmotion.event.CombatEvents;
|
||||
import net.fretux.mindmotion.event.PlayerTickHandler;
|
||||
import net.fretux.mindmotion.network.ModMessages;
|
||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.fretux.mindmotion;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.fretux.mindmotion.client.effects;
|
||||
|
||||
import net.fretux.mindmotion.ConfigMM;
|
||||
import net.fretux.mindmotion.player.PlayerCapabilityProvider;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
@@ -30,18 +29,8 @@ public final class IronsSpellbooksCompatMM {
|
||||
return ConfigMM.COMMON.TEMPO_PER_MANA_REGEN_PERCENT.get();
|
||||
}
|
||||
|
||||
public static boolean isLoaded() {
|
||||
return ModList.get().isLoaded(IRONS_MODID);
|
||||
}
|
||||
|
||||
public static void applyTempo(Player player) {
|
||||
if (!isLoaded()) return;
|
||||
resolveOnce();
|
||||
if (!available) return;
|
||||
player.getCapability(PlayerCapabilityProvider.TEMPO).ifPresent(tempoCap -> {
|
||||
int tempo = tempoCap.getTempo();
|
||||
applyTempoToManaRegen(player, tempo);
|
||||
});
|
||||
public static boolean isNotLoaded() {
|
||||
return !ModList.get().isLoaded(IRONS_MODID);
|
||||
}
|
||||
|
||||
private static void resolveOnce() {
|
||||
@@ -60,7 +49,7 @@ public final class IronsSpellbooksCompatMM {
|
||||
}
|
||||
|
||||
public static void applyTempoToManaRegen(Player player, int tempo) {
|
||||
if (!isLoaded()) return;
|
||||
if (isNotLoaded()) return;
|
||||
resolveOnce();
|
||||
if (!available) return;
|
||||
Attribute manaRegenAttr = getManaRegenAttribute();
|
||||
|
||||
@@ -21,7 +21,7 @@ public class SanityCommand {
|
||||
ServerPlayer player = ctx.getSource().getPlayer();
|
||||
float sanity = FloatArgumentType.getFloat(ctx, "sanity");
|
||||
float insanity = FloatArgumentType.getFloat(ctx, "insanity");
|
||||
|
||||
assert player != null;
|
||||
player.getCapability(PlayerCapabilityProvider.SANITY).ifPresent(cap -> {
|
||||
cap.setSanity(sanity);
|
||||
cap.setInsanity(insanity);
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ModMessages {
|
||||
|
||||
private static final String PROTOCOL_VERSION = "1";
|
||||
public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(
|
||||
new ResourceLocation(AscendMindMotion.MODID, "main"),
|
||||
ResourceLocation.fromNamespaceAndPath(AscendMindMotion.MODID, "main"),
|
||||
() -> PROTOCOL_VERSION,
|
||||
PROTOCOL_VERSION::equals,
|
||||
PROTOCOL_VERSION::equals
|
||||
|
||||
@@ -14,13 +14,12 @@ public class VentClientEffectPacket {
|
||||
|
||||
public void toBytes(FriendlyByteBuf buf) {}
|
||||
|
||||
public boolean handle(Supplier<NetworkEvent.Context> ctx) {
|
||||
public void handle(Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player == null) return;
|
||||
mc.player.swingTime = 10;
|
||||
VentShaderHandler.triggerVentShockwave();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ public class PlayerCapabilityProvider {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void attachCapabilities(AttachCapabilitiesEvent<?> event) {
|
||||
if (event.getObject() instanceof net.minecraft.world.entity.player.Player player) {
|
||||
event.addCapability(new ResourceLocation("mindmotion", "sanity"), new SanityProvider());
|
||||
event.addCapability(new ResourceLocation("mindmotion", "tempo"), new TempoProvider());
|
||||
if (event.getObject() instanceof net.minecraft.world.entity.player.Player) {
|
||||
event.addCapability(ResourceLocation.fromNamespaceAndPath("mindmotion", "sanity"), new SanityProvider());
|
||||
event.addCapability(ResourceLocation.fromNamespaceAndPath("mindmotion", "tempo"), new TempoProvider());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user