mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-15 01:25:16 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f738bc728 | ||
|
|
8329a4f186 | ||
|
|
e5ab6193a5 |
No files matched your search
+1
-1
@@ -117,7 +117,7 @@ minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@@ -23,6 +24,9 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkCheckHandler;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
@@ -52,6 +56,7 @@ public class Waila {
|
||||
public static ProxyServer proxy;
|
||||
public static Logger log = LogManager.getLogger("Waila");
|
||||
public boolean serverPresent = false;
|
||||
private final ArtifactVersion minimumClientJoinVersion = new DefaultArtifactVersion("1.7.3");
|
||||
|
||||
/* INIT SEQUENCE */
|
||||
@EventHandler
|
||||
@@ -130,4 +135,16 @@ public class Waila {
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new CommandDumpHandlers());
|
||||
}
|
||||
|
||||
/**
|
||||
* Block any clients older than 1.7.3 to ensure the vanilla.show_invisible_players property is respected
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@NetworkCheckHandler
|
||||
public boolean checkModList(Map<String, String> versions, Side side) {
|
||||
if (side == Side.CLIENT && versions.containsKey("Waila")) {
|
||||
return minimumClientJoinVersion.compareTo(new DefaultArtifactVersion(versions.get("Waila"))) <= 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,11 @@ public class BCModule {
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[BC] Class not found. " + e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Waila.log.log(Level.WARN, "[BC] Method not found." + e);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Waila.log.log(Level.INFO, "[BC] Buildcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Buildcraft mod found.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,14 @@ public class IC2Module {
|
||||
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.outputeu");
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
Waila.log.log(Level.INFO, "[IndustrialCraft 2] IndustrialCraft 2 mod not found.");
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "IndustrialCraft 2 mod found.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,10 +66,13 @@ public class ThaumcraftModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Class not found. " + e);
|
||||
Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception." + e);
|
||||
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception. {}", e);
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Thaumcraft mod found.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,14 @@ public class ThermalDynamicsModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerDuct(), TileFluidDuct);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Dynamics] Thermal Dynamics mod not found.");
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks. {}", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Waila.log.log(Level.INFO, "Thermal Dynamics mod found.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ public class ThermalExpansionModule {
|
||||
public static Method IBlockInfo_getBlockInfo = null;
|
||||
|
||||
public static void register() {
|
||||
boolean printedThermalExpansionNotFound = false;
|
||||
// XXX : We register the Energy interface first
|
||||
try {
|
||||
IEnergyProvider = Class.forName("cofh.api.energy.IEnergyProvider");
|
||||
@@ -74,7 +75,12 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIEnergyHandler(), IEnergyInfo);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
printedThermalExpansionNotFound = true;
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the energy cell
|
||||
@@ -88,7 +94,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Energy Cell hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Tank interface
|
||||
@@ -107,7 +120,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTank(), TileTank);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tank hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Tesseract interface
|
||||
@@ -123,7 +143,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the ISecureTile interface
|
||||
@@ -137,7 +164,14 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerISecureTile(), ISecureTile);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading ISecureTile hooks. {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX : We register the Cache interface
|
||||
@@ -153,7 +187,17 @@ public class ThermalExpansionModule {
|
||||
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerCache(), TileCache);
|
||||
|
||||
} catch (Exception e) {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks." + e);
|
||||
if (e instanceof ClassNotFoundException) {
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
printedThermalExpansionNotFound = true;
|
||||
Waila.log.log(Level.INFO, "[Thermal Expansion] Thermal Expansion mod not found.");
|
||||
}
|
||||
} else {
|
||||
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading Tesseract hooks. {}", e);
|
||||
}
|
||||
}
|
||||
if (!printedThermalExpansionNotFound) {
|
||||
Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.redstone");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.silverfish");
|
||||
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
|
||||
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.show_invisible_players");
|
||||
|
||||
IWailaDataProvider provider = new HUDHandlerVanilla();
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -38,8 +39,8 @@ public class RayTracing {
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public void fire() {
|
||||
if (mc.objectMouseOver != null
|
||||
&& mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
|
||||
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
|
||||
&& !shouldHidePlayer(mc.objectMouseOver.entityHit)) {
|
||||
this.target = mc.objectMouseOver;
|
||||
return;
|
||||
}
|
||||
@@ -50,6 +51,15 @@ public class RayTracing {
|
||||
this.target = this.rayTrace(viewpoint, mc.playerController.getBlockReachDistance(), 0);
|
||||
}
|
||||
|
||||
private static boolean shouldHidePlayer(Entity targetEnt) {
|
||||
// Check if entity is player with invisibility effect
|
||||
if (targetEnt instanceof EntityPlayer thePlayer) {
|
||||
boolean shouldHidePlayerSetting = !ConfigHandler.instance().getConfig("vanilla.show_invisible_players");
|
||||
return shouldHidePlayerSetting && thePlayer.isInvisible();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public MovingObjectPosition getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
@@ -124,7 +134,7 @@ public class RayTracing {
|
||||
.getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
|
||||
if (providerStack != null) {
|
||||
|
||||
if (providerStack.getItem() == null) return new ArrayList<ItemStack>();
|
||||
if (providerStack.getItem() == null) return new ArrayList<>();
|
||||
|
||||
items.add(providerStack);
|
||||
}
|
||||
@@ -141,7 +151,7 @@ public class RayTracing {
|
||||
.getWailaStack(DataAccessorCommon.instance, ConfigHandler.instance());
|
||||
if (providerStack != null) {
|
||||
|
||||
if (providerStack.getItem() == null) return new ArrayList<ItemStack>();
|
||||
if (providerStack.getItem() == null) return new ArrayList<>();
|
||||
|
||||
items.add(providerStack);
|
||||
}
|
||||
@@ -165,12 +175,11 @@ public class RayTracing {
|
||||
try {
|
||||
ItemStack pick = mouseoverBlock.getPickBlock(this.target, world, x, y, z);
|
||||
if (pick != null) items.add(pick);
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (!items.isEmpty()) return items;
|
||||
|
||||
if (mouseoverBlock instanceof IShearable) {
|
||||
IShearable shearable = (IShearable) mouseoverBlock;
|
||||
if (mouseoverBlock instanceof IShearable shearable) {
|
||||
if (shearable.isShearable(new ItemStack(Items.shears), world, x, y, z)) {
|
||||
items.addAll(shearable.onSheared(new ItemStack(Items.shears), world, x, y, z, 0));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user