mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-14 01:04:11 +00:00
add setting to disable flan compat
This commit is contained in:
4 files changed
+28
-8
No files matched your search
@@ -28,6 +28,7 @@ public class Settings
|
||||
public static boolean POLLUTIVE_NUCLEAR = true;
|
||||
public static boolean CREATE_NETHERRACK = true;
|
||||
public static double REDUCE_OBSIDIAN_RESISTANCE = 45F;
|
||||
public static boolean ENABLE_FLANS_MOD_INTEGRATION = true;
|
||||
|
||||
public static void initiate()
|
||||
{
|
||||
@@ -47,5 +48,9 @@ public class Settings
|
||||
POLLUTIVE_NUCLEAR = Settings.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Pollutive Nuclear", true).getBoolean(true);
|
||||
CREATE_NETHERRACK = Settings.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Exothermic Create Netherrack", true).getBoolean(true);
|
||||
REDUCE_OBSIDIAN_RESISTANCE = Settings.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Reduce Obsidian Resistance", 45F).getDouble(45F);
|
||||
ENABLE_FLANS_MOD_INTEGRATION = Settings.CONFIGURATION.get(Configuration.CATEGORY_GENERAL,
|
||||
"Enable Flan's Mod Integration", true,
|
||||
"Registers DefenseTech aircraft bombs with Flan's Mod and allows radar and anti-ballistic missiles to detect Flan aircraft. This setting must match on the client and server.")
|
||||
.setRequiresMcRestart(true).getBoolean(true);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import defense.common.DefenseTech;
|
||||
import defense.common.Settings;
|
||||
import defense.common.entity.EntityMissile;
|
||||
|
||||
/** Optional loader that never resolves a Flan class unless Flan is installed. */
|
||||
@@ -30,6 +31,12 @@ public final class FlansModIntegration
|
||||
|
||||
attempted = true;
|
||||
|
||||
if(!Settings.ENABLE_FLANS_MOD_INTEGRATION)
|
||||
{
|
||||
DefenseTech.LOGGER.info("Optional Flan's Mod integration is disabled by configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Loader.isModLoaded("flansmod"))
|
||||
{
|
||||
return;
|
||||
@@ -50,7 +57,7 @@ public final class FlansModIntegration
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if(bridge != null)
|
||||
if(isEnabled())
|
||||
{
|
||||
bridge.init();
|
||||
}
|
||||
@@ -58,7 +65,7 @@ public final class FlansModIntegration
|
||||
|
||||
public static void postInit()
|
||||
{
|
||||
if(bridge != null)
|
||||
if(isEnabled())
|
||||
{
|
||||
bridge.postInit();
|
||||
}
|
||||
@@ -66,7 +73,7 @@ public final class FlansModIntegration
|
||||
|
||||
public static void clientInit()
|
||||
{
|
||||
if(bridge == null)
|
||||
if(!isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -85,19 +92,24 @@ public final class FlansModIntegration
|
||||
|
||||
public static Entity findNearestAircraft(World world, AxisAlignedBB bounds, Entity excluded)
|
||||
{
|
||||
return bridge == null ? null : bridge.findNearestAircraft(world, bounds, excluded);
|
||||
return isEnabled() ? bridge.findNearestAircraft(world, bounds, excluded) : null;
|
||||
}
|
||||
|
||||
public static boolean isAircraft(Entity entity)
|
||||
{
|
||||
return bridge != null && bridge.isAircraft(entity);
|
||||
return isEnabled() && bridge.isAircraft(entity);
|
||||
}
|
||||
|
||||
public static void interceptAircraft(Entity aircraft, EntityMissile interceptor)
|
||||
{
|
||||
if(bridge != null)
|
||||
if(isEnabled())
|
||||
{
|
||||
bridge.interceptAircraft(aircraft, interceptor);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEnabled()
|
||||
{
|
||||
return Settings.ENABLE_FLANS_MOD_INTEGRATION && bridge != null;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import defense.api.ExplosionEvent.ExplosivePreDetonationEvent;
|
||||
import defense.api.ExplosiveType;
|
||||
import defense.common.explosive.Explosive;
|
||||
import defense.common.explosive.ExplosiveRegistry;
|
||||
import defense.common.integration.FlansModIntegration;
|
||||
|
||||
/** Flan projectile physics with DefenseTech detonation behavior. */
|
||||
public class EntityDefenseTechBomb extends EntityBullet
|
||||
@@ -52,7 +53,8 @@ public class EntityDefenseTechBomb extends EntityBullet
|
||||
double x = posX;
|
||||
double y = posY;
|
||||
double z = posZ;
|
||||
boolean dispatch = !payloadDispatched && world != null && !world.isRemote && explosiveId >= 0;
|
||||
boolean dispatch = FlansModIntegration.isEnabled() && !payloadDispatched
|
||||
&& world != null && !world.isRemote && explosiveId >= 0;
|
||||
Explosive explosive = dispatch ? ExplosiveRegistry.get(explosiveId) : null;
|
||||
|
||||
if(explosive == null || !explosive.hasBlockForm())
|
||||
|
||||
@@ -36,6 +36,7 @@ import defense.common.entity.EntityMissile;
|
||||
import defense.common.explosive.Explosive;
|
||||
import defense.common.explosive.ExplosiveRegistry;
|
||||
import defense.common.integration.IFlansModIntegration;
|
||||
import defense.common.integration.FlansModIntegration;
|
||||
|
||||
/** Implementation loaded only after the optional {@code flansmod} mod is found. */
|
||||
public class FlansModCompat implements IFlansModIntegration
|
||||
@@ -207,7 +208,7 @@ public class FlansModCompat implements IFlansModIntegration
|
||||
@SubscribeEvent
|
||||
public void onEntityJoinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if(event.entity instanceof EntityPlane)
|
||||
if(FlansModIntegration.isEnabled() && event.entity instanceof EntityPlane)
|
||||
{
|
||||
RadarRegistry.register(event.entity);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user