diff --git a/README.md b/README.md index 6bf140b3..62f6ef1f 100644 --- a/README.md +++ b/README.md @@ -175,120 +175,5 @@ if(world.isRemote == false) { } ``` -#### JourneyMap Custom Layer - -VisualProspecting provides a light-weight API for custom and interactive layers. This API will keep all maps as optional mod at runtime and not crash you game if it is missing. You may instantiate [`ButtonManager`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/model/buttons/ButtonManager.java) to create your own logical button. Follow it up with an instance of [`LayerButton`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/journeymap/buttons/LayerButton.java) and register both in the [`VisualProspecting_API`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/VisualProspecting_API.java): - -``` -ButtonManager buttonManager = new ButtonManager("translation.key", "iconName"); -LayerButton layerButton = new LayerButton(buttonManager); - -VisualProspecting_API.LogicalClient.registerCustomButtonManager(buttonManager); -VisualProspecting_API.LogicalClient.registerJourneyMapButton(layerButton); -``` - -If you start the game now, you will see a new button in the menu! - -First, you will implement [`ILocationProvider`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/model/locations/ILocationProvider.java). This class is a container and will provide all information required to display your item on screen. It won't do any rendering. - -``` -class MyLocation implements ILocationProvider { - - public int getDimensionId() { - return 0; // overworld - } - - public int getBlockX() { - return 0; - } - - public int getBlockY() { - return 65; - } - - public int getBlockZ() { - return 0; - } - - public String getLabel() { - return "Hello Minecraft"; - } -} -``` - -Next up, you'll extend [`LayerManager`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/model/layers/LayerManager.java) and implement the abstract function to generate cached List of your [`ILocationProvider`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/model/locations/ILocationProvider.java) implementation. You should only add whatever items are visible to this list. There are more methods to override, that will assist you with that. Take a look! - -``` -class MyLayerManager extends LayerManager { - - public static final MyLayerManager instance = new MyLayerManager(); - - public MyLayerManager() { - super(buttonManager); - } - - protected List generateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - return Collections.singletonList(new MyLocation); - } -} -``` - -You have finished the logical implementation of your custom map layer. Congratulations! Now it is time for the visual integration into the map. This example is provided for JourneyMap, but you might as well take a look at the other possibilities. Since you already implemented the button as a first step, you will need to follow it up with an implementation of `DrawStep`, an interface from JourneyMap. This class will receive an instance of `MyLocation` and perform the actual rendering. - -``` -class MyDrawStep implements DrawStep { - - private final MyLocation myLocation; - - public MyDrawStep(MyLocation myLocation) { - this.myLocation = myLocation; - } - - @Override - public void draw(double draggedPixelX, double draggedPixelY, GridRenderer gridRenderer, float drawScale, double fontScale, double rotation) { - final double blockSize = Math.pow(2, gridRenderer.getZoom()); - final Point2D.Double blockAsPixel = gridRenderer.getBlockPixelInGrid(myLocation.getBlockX(), myLocation.getBlockZ()); - final Point2D.Double pixel = new Point2D.Double(blockAsPixel.getX() + draggedPixelX, blockAsPixel.getY() + draggedPixelY); - - DrawUtil.drawLabel(myLocation.getText(), pixel.getX(), pixel.getY(), DrawUtil.HAlign.Center, DrawUtil.VAlign.Middle, 0, 180, 0x00FFFFFF, 255, fontScale, false, rotation); - } -} -``` - -Continue with your own implementation of [`LayerRenderer`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/journeymap/render/LayerRenderer.java). This class will cache all `DrawStep`s and provide it to JourneyMap whenever it is time to render. - -``` -class MyLayerRenderer extends LayerRenderer { - - public MyLayerRenderer() { - // You may skip MyLayerManager and use an existing ButtonManager like "OreVeinLayerManager.instance" - // Your custom layer will toggle with whatever button you specify here - super(MyLayerManager.instance); - } - - @Override - public List mapLocationProviderToDrawStep(List visibleElements) { - final List drawSteps = new ArrayList<>(); - visibleElements.stream() - .map(element -> (MyLocation) element) - .forEach(location -> drawSteps.add(new MyDrawStep(location))); - return drawSteps; - } - -} -``` - -That's already it! Now you need to register some of these classes. Forge's postInit is a good place for it: - -``` -VisualProspecting_API.LogicalClient.registerCustomLayer(MyLayerManager.instance); -VisualProspecting_API.LogicalClient.registerJourneyMapRenderer(new MyLayerRenderer()); -``` - -Now you need to launch Minecraft, teleport to the right sport (`/tp 0 80 0`) and open JourneyMap. - -If you want to extend support for your layer in other maps as well you already have half the work done. You just need to add implementations for the layer and element renderer. \ -For interactive layers you may take a look at extensions/implementations of [`WaypointProviderManager`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/model/layers/WaypointProviderManager.java) and [`ClickableDrawStep`](https://github.com/SinTh0r4s/VisualProspecting/blob/master/src/main/java/com/sinthoras/visualprospecting/gui/journeymap/drawsteps/ClickableDrawStep.java) to get a head start. - Thank you and happy coding,\ SinTh0r4s diff --git a/dependencies.gradle b/dependencies.gradle index f801f46b..915c91dd 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,16 +1,11 @@ dependencies { shadowImplementation('com.github.GTNewHorizons:Enklume:2.1.0:dev') - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.75:dev') - api(rfg.deobf('maven.modrinth:journeymap:5.2.3')) - - devOnlyNonPublishable('com.github.GTNewHorizons:TCNodeTracker:1.3.0:dev') - - compileOnly(deobfCurse('xaeros-minimap-263420:5060684')) - compileOnly(deobfCurse('xaeros-world-map-317780:5060733')) - compileOnly(deobf('https://media.forgecdn.net/files/2462/146/mod_voxelMap_1.7.0b_for_1.7.10.litemod', 'mod_voxelMap_1.7.0b_for_1.7.10.jar')) + api('com.github.GTNewHorizons:Navigator:1.0.6:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.78:dev') // For debugging runtimeOnlyNonPublishable('com.github.GTNewHorizons:DetravScannerMod:1.8.1:dev') - runtimeOnlyNonPublishable('com.github.GTNewHorizons:ServerUtilities:2.0.60:dev') + runtimeOnlyNonPublishable(rfg.deobf('maven.modrinth:journeymap:5.2.5')) + } diff --git a/src/main/java/com/sinthoras/visualprospecting/ServerTranslations.java b/src/main/java/com/sinthoras/visualprospecting/ServerTranslations.java index 154f8b1c..f92bbcaf 100644 --- a/src/main/java/com/sinthoras/visualprospecting/ServerTranslations.java +++ b/src/main/java/com/sinthoras/visualprospecting/ServerTranslations.java @@ -15,72 +15,40 @@ public static String getEnglishLocalization(Fluid fluid) { return fluid.getLocalizedName(); } - switch (fluid.getUnlocalizedName()) { - case "fluid.gas_natural_gas": - return "Natural Gas"; - case "fluid.liquid_light_oil": - return "Light Oil"; - case "fluid.liquid_medium_oil": - return "Raw Oil"; - case "fluid.liquid_heavy_oil": - return "Heavy Oil"; - case "fluid.oil": - return "Oil"; - case "fluid.drillingfluid": - return "Drilling Fluid"; - case "fluid.helium-3": - return "Helium-3"; - case "fluid.saltwater": - return "Saltwater"; - case "fluid.molten.iron": - return "Molten Iron"; - case "fluid.molten.lead": - return "Molten Lead"; - case "fluid.sulfuricacid": - return "Sulfuric Acid"; - case "fluid.carbondioxide": - return "Carbondioxide"; - case "fluid.chlorobenzene": - return "Chlorobenzene"; - case "fluid.liquid_extra_heavy_oil": - return "Extra Heavy Oil"; - case "fluid.ic2distilledwater": - return "Distilled Water"; - case "fluid.oxygen": - return "Oxygen"; - case "fluid.liquidair": - return "Liquid Air"; - case "fluid.methane": - return "Methane"; - case "fluid.ethane": - return "Ethane"; - case "fluid.liquid_hydricsulfur": - return "Liquid Hydric Sulfur"; - case "fluid.carbonmonoxide": - return "Carbonmonoxide"; - case "fluid.nitrogen": - return "Nitrogen"; - case "fluid.ethylene": - return "Ethylene"; - case "fluid.deuterium": - return "Deuterium"; - case "fluid.fluorine": - return "Fluorine"; - case "fluid.hydrofluoricacid_gt5u": - return "Hydrofluoric Acid"; - case "fluid.molten.copper": - return "Molten Copper"; - case "fluid.unknowwater": - return "Unknowwater"; - case "fluid.molten.tin": - return "Molten Tin"; - case "fluid.hydrogen": - return "Hydrogen"; - case "fluid.lava": - return "Lava"; - default: - return fluid.getUnlocalizedName(); - } + return switch (fluid.getUnlocalizedName()) { + case "fluid.gas_natural_gas" -> "Natural Gas"; + case "fluid.liquid_light_oil" -> "Light Oil"; + case "fluid.liquid_medium_oil" -> "Raw Oil"; + case "fluid.liquid_heavy_oil" -> "Heavy Oil"; + case "fluid.oil" -> "Oil"; + case "fluid.drillingfluid" -> "Drilling Fluid"; + case "fluid.helium-3" -> "Helium-3"; + case "fluid.saltwater" -> "Saltwater"; + case "fluid.molten.iron" -> "Molten Iron"; + case "fluid.molten.lead" -> "Molten Lead"; + case "fluid.sulfuricacid" -> "Sulfuric Acid"; + case "fluid.carbondioxide" -> "Carbondioxide"; + case "fluid.chlorobenzene" -> "Chlorobenzene"; + case "fluid.liquid_extra_heavy_oil" -> "Extra Heavy Oil"; + case "fluid.ic2distilledwater" -> "Distilled Water"; + case "fluid.oxygen" -> "Oxygen"; + case "fluid.liquidair" -> "Liquid Air"; + case "fluid.methane" -> "Methane"; + case "fluid.ethane" -> "Ethane"; + case "fluid.liquid_hydricsulfur" -> "Liquid Hydric Sulfur"; + case "fluid.carbonmonoxide" -> "Carbonmonoxide"; + case "fluid.nitrogen" -> "Nitrogen"; + case "fluid.ethylene" -> "Ethylene"; + case "fluid.deuterium" -> "Deuterium"; + case "fluid.fluorine" -> "Fluorine"; + case "fluid.hydrofluoricacid_gt5u" -> "Hydrofluoric Acid"; + case "fluid.molten.copper" -> "Molten Copper"; + case "fluid.unknowwater" -> "Unknowwater"; + case "fluid.molten.tin" -> "Molten Tin"; + case "fluid.hydrogen" -> "Hydrogen"; + case "fluid.lava" -> "Lava"; + default -> fluid.getUnlocalizedName(); + }; } /* @@ -93,189 +61,98 @@ public static String getEnglishLocalization(VeinType veinType) { return I18n.format(veinType.name); } - switch (veinType.name) { - case "ore.mix.naquadah": - return "Naquadah"; - case "ore.mix.lignite": - return "Lignite"; - case "ore.mix.coal": - return "Coal"; - case "ore.mix.magnetite": - return "Magnetite"; - case "ore.mix.gold": - return "Gold"; - case "ore.mix.iron": - return "Iron"; - case "ore.mix.cassiterite": - return "Cassiterite"; - case "ore.mix.tetrahedrite": - return "Tetrahedrite"; - case "ore.mix.netherquartz": - return "Nether Quartz"; - case "ore.mix.sulfur": - return "Sulfur"; - case "ore.mix.copper": - return "Copper"; - case "ore.mix.bauxite": - return "Bauxite"; - case "ore.mix.salts": - return "Salts"; - case "ore.mix.redstone": - return "Redstone"; - case "ore.mix.soapstone": - return "Soapstone"; - case "ore.mix.nickel": - return "Nickel"; - case "ore.mix.platinum": - return "Platinum"; - case "ore.mix.pitchblende": - return "Pitchblende"; - case "ore.mix.monazite": - return "Monazite"; - case "ore.mix.molybdenum": - return "Molybdenum"; - case "ore.mix.tungstate": - return "Tungstate"; - case "ore.mix.sapphire": - return "Sapphire"; - case "ore.mix.manganese": - return "Manganese"; - case "ore.mix.quartz": - return "Quartz"; - case "ore.mix.diamond": - return "Diamond"; - case "ore.mix.olivine": - return "Olivine"; - case "ore.mix.apatite": - return "Apatite"; - case "ore.mix.galena": - return "Galena"; - case "ore.mix.lapis": - return "Lapis"; - case "ore.mix.beryllium": - return "Beryllium"; - case "ore.mix.uranium": - return "Uranium"; - case "ore.mix.oilsand": - return "Oilsands"; - case "ore.mix.neutronium": - return "Neutronium"; - case "ore.mix.aquaignis": - return "Aqua and Ignis"; - case "ore.mix.terraaer": - return "Terra and Aer"; - case "ore.mix.perditioordo": - return "Perdito and Ordo"; - case "ore.mix.coppertin": - return "Vermiculite"; - case "ore.mix.titaniumchrome": - return "Ilmenite"; - case "ore.mix.mineralsand": - return "Mineralsand"; - case "ore.mix.garnettin": - return "Garnettin"; - case "ore.mix.kaolinitezeolite": - return "Kaolinite"; - case "ore.mix.mica": - return "Mica"; - case "ore.mix.dolomite": - return "Dolomite"; - case "ore.mix.platinumchrome": - return "Palladium"; - case "ore.mix.iridiummytryl": - return "Iridium"; - case "ore.mix.osmium": - return "Osmium"; - case "ore.mix.saltpeterelectrotine": - return "Electrotine"; - case "ore.mix.desh": - return "Desh"; - case "ore.mix.draconium": - return "Draconium"; - case "ore.mix.quantium": - return "Quantum"; - case "ore.mix.callistoice": - return "Callisto Ice"; - case "ore.mix.mytryl": - return "Mithril"; - case "ore.mix.ledox": - return "Ledox"; - case "ore.mix.oriharukon": - return "Oriharukon"; - case "ore.mix.blackplutonium": - return "Black Plutonium"; - case "ore.mix.infusedgold": - return "Infused Gold"; - case "ore.mix.niobium": - return "Niobium"; - case "ore.mix.tungstenirons": - return "Tungsten"; - case "ore.mix.uraniumgtnh": - return "Thorium"; - case "ore.mix.vanadiumgold": - return "Vanadium"; - case "ore.mix.netherstar": - return "NetherStar"; - case "ore.mix.garnet": - return "Garnet"; - case "ore.mix.rareearth": - return "Rare Earths"; - case "ore.mix.richnuclear": - return "Plutonium"; - case "ore.mix.heavypentele": - return "Arsenic"; - case "ore.mix.europa": - return "Magnesite"; - case "ore.mix.europacore": - return "Chrome"; - case "ore.mix.secondlanthanid": - return "Samarium"; - case "ore.mix.quartzspace": - return "Quartz"; - case "ore.mix.rutile": - return "Rutile"; - case "ore.mix.tfgalena": - return "Cryolite"; - case "ore.mix.luvtantalite": - return "Pyrolusit"; - case "ore.mix.ross128.Thorianit": - return "Thorianit"; - case "ore.mix.ross128.carbon": - return "Graphite"; - case "ore.mix.ross128.bismuth": - return "Bismuth"; - case "ore.mix.ross128.TurmalinAlkali": - return "Olenit"; - case "ore.mix.ross128.Roquesit": - return "Roquesit"; - case "ore.mix.ross128.Tungstate": - return "Scheelite"; - case "ore.mix.ross128.CopperSulfits": - return "Djurleit"; - case "ore.mix.ross128.Forsterit": - return "Forsterit"; - case "ore.mix.ross128.Hedenbergit": - return "Hedenbergit"; - case "ore.mix.ross128.RedZircon": - return "Red Zircon"; - case "ore.mix.ross128ba.tib": - return "Tiberium"; - case "ore.mix.ross128ba.Tungstate": - return "Scheelite"; - case "ore.mix.ross128ba.bart": - return "BArTiMaEuSNeK"; - case "ore.mix.ross128ba.TurmalinAlkali": - return "Olenit"; - case "ore.mix.ross128ba.Amethyst": - return "Amethyst"; - case "ore.mix.ross128ba.CopperSulfits": - return "Djurleit"; - case "ore.mix.ross128ba.RedZircon": - return "Red Zircon"; - case "ore.mix.ross128ba.Fluorspar": - return "Fluorspa"; - default: - return veinType.name; - } + return switch (veinType.name) { + case "ore.mix.naquadah" -> "Naquadah"; + case "ore.mix.lignite" -> "Lignite"; + case "ore.mix.coal" -> "Coal"; + case "ore.mix.magnetite" -> "Magnetite"; + case "ore.mix.gold" -> "Gold"; + case "ore.mix.iron" -> "Iron"; + case "ore.mix.cassiterite" -> "Cassiterite"; + case "ore.mix.tetrahedrite" -> "Tetrahedrite"; + case "ore.mix.netherquartz" -> "Nether Quartz"; + case "ore.mix.sulfur" -> "Sulfur"; + case "ore.mix.copper" -> "Copper"; + case "ore.mix.bauxite" -> "Bauxite"; + case "ore.mix.salts" -> "Salts"; + case "ore.mix.redstone" -> "Redstone"; + case "ore.mix.soapstone" -> "Soapstone"; + case "ore.mix.nickel" -> "Nickel"; + case "ore.mix.platinum" -> "Platinum"; + case "ore.mix.pitchblende" -> "Pitchblende"; + case "ore.mix.monazite" -> "Monazite"; + case "ore.mix.molybdenum" -> "Molybdenum"; + case "ore.mix.tungstate" -> "Tungstate"; + case "ore.mix.sapphire" -> "Sapphire"; + case "ore.mix.manganese" -> "Manganese"; + case "ore.mix.quartz" -> "Quartz"; + case "ore.mix.diamond" -> "Diamond"; + case "ore.mix.olivine" -> "Olivine"; + case "ore.mix.apatite" -> "Apatite"; + case "ore.mix.galena" -> "Galena"; + case "ore.mix.lapis" -> "Lapis"; + case "ore.mix.beryllium" -> "Beryllium"; + case "ore.mix.uranium" -> "Uranium"; + case "ore.mix.oilsand" -> "Oilsands"; + case "ore.mix.neutronium" -> "Neutronium"; + case "ore.mix.aquaignis" -> "Aqua and Ignis"; + case "ore.mix.terraaer" -> "Terra and Aer"; + case "ore.mix.perditioordo" -> "Perdito and Ordo"; + case "ore.mix.coppertin" -> "Vermiculite"; + case "ore.mix.titaniumchrome" -> "Ilmenite"; + case "ore.mix.mineralsand" -> "Mineralsand"; + case "ore.mix.garnettin" -> "Garnettin"; + case "ore.mix.kaolinitezeolite" -> "Kaolinite"; + case "ore.mix.mica" -> "Mica"; + case "ore.mix.dolomite" -> "Dolomite"; + case "ore.mix.platinumchrome" -> "Palladium"; + case "ore.mix.iridiummytryl" -> "Iridium"; + case "ore.mix.osmium" -> "Osmium"; + case "ore.mix.saltpeterelectrotine" -> "Electrotine"; + case "ore.mix.desh" -> "Desh"; + case "ore.mix.draconium" -> "Draconium"; + case "ore.mix.quantium" -> "Quantum"; + case "ore.mix.callistoice" -> "Callisto Ice"; + case "ore.mix.mytryl" -> "Mithril"; + case "ore.mix.ledox" -> "Ledox"; + case "ore.mix.oriharukon" -> "Oriharukon"; + case "ore.mix.blackplutonium" -> "Black Plutonium"; + case "ore.mix.infusedgold" -> "Infused Gold"; + case "ore.mix.niobium" -> "Niobium"; + case "ore.mix.tungstenirons" -> "Tungsten"; + case "ore.mix.uraniumgtnh" -> "Thorium"; + case "ore.mix.vanadiumgold" -> "Vanadium"; + case "ore.mix.netherstar" -> "NetherStar"; + case "ore.mix.garnet" -> "Garnet"; + case "ore.mix.rareearth" -> "Rare Earths"; + case "ore.mix.richnuclear" -> "Plutonium"; + case "ore.mix.heavypentele" -> "Arsenic"; + case "ore.mix.europa" -> "Magnesite"; + case "ore.mix.europacore" -> "Chrome"; + case "ore.mix.secondlanthanid" -> "Samarium"; + case "ore.mix.quartzspace" -> "Quartz"; + case "ore.mix.rutile" -> "Rutile"; + case "ore.mix.tfgalena" -> "Cryolite"; + case "ore.mix.luvtantalite" -> "Pyrolusit"; + case "ore.mix.ross128.Thorianit" -> "Thorianit"; + case "ore.mix.ross128.carbon" -> "Graphite"; + case "ore.mix.ross128.bismuth" -> "Bismuth"; + case "ore.mix.ross128.TurmalinAlkali" -> "Olenit"; + case "ore.mix.ross128.Roquesit" -> "Roquesit"; + case "ore.mix.ross128.Tungstate" -> "Scheelite"; + case "ore.mix.ross128.CopperSulfits" -> "Djurleit"; + case "ore.mix.ross128.Forsterit" -> "Forsterit"; + case "ore.mix.ross128.Hedenbergit" -> "Hedenbergit"; + case "ore.mix.ross128.RedZircon" -> "Red Zircon"; + case "ore.mix.ross128ba.tib" -> "Tiberium"; + case "ore.mix.ross128ba.Tungstate" -> "Scheelite"; + case "ore.mix.ross128ba.bart" -> "BArTiMaEuSNeK"; + case "ore.mix.ross128ba.TurmalinAlkali" -> "Olenit"; + case "ore.mix.ross128ba.Amethyst" -> "Amethyst"; + case "ore.mix.ross128ba.CopperSulfits" -> "Djurleit"; + case "ore.mix.ross128ba.RedZircon" -> "Red Zircon"; + case "ore.mix.ross128ba.Fluorspar" -> "Fluorspa"; + default -> veinType.name; + }; } } diff --git a/src/main/java/com/sinthoras/visualprospecting/Utils.java b/src/main/java/com/sinthoras/visualprospecting/Utils.java index 8a3b3004..978a7fb4 100644 --- a/src/main/java/com/sinthoras/visualprospecting/Utils.java +++ b/src/main/java/com/sinthoras/visualprospecting/Utils.java @@ -41,10 +41,6 @@ public static boolean isNEIInstalled() { return Loader.isModLoaded("NotEnoughItems"); } - public static boolean isTCNodeTrackerInstalled() { - return Loader.isModLoaded("tcnodetracker"); - } - public static boolean isJourneyMapInstalled() { return Loader.isModLoaded("journeymap"); } @@ -57,15 +53,8 @@ public static boolean isXaerosMinimapInstalled() { return Loader.isModLoaded("XaeroMinimap"); } - public static boolean isVoxelMapInstalled() { - try { - // If a LiteLoader mod is present cannot be checked by calling Loader#isModLoaded. - // Instead, we check if the VoxelMap main class is present. - Class.forName("com.thevoxelbox.voxelmap.litemod.LiteModVoxelMap"); - return true; - } catch (Exception e) { - return false; - } + public static boolean isNavigatorInstalled() { + return Loader.isModLoaded("navigator"); } public static int coordBlockToChunk(int blockCoord) { diff --git a/src/main/java/com/sinthoras/visualprospecting/VP.java b/src/main/java/com/sinthoras/visualprospecting/VP.java index 1a178058..2321f7f3 100644 --- a/src/main/java/com/sinthoras/visualprospecting/VP.java +++ b/src/main/java/com/sinthoras/visualprospecting/VP.java @@ -2,8 +2,6 @@ import java.util.Random; -import net.minecraft.client.settings.KeyBinding; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -12,8 +10,6 @@ public class VP { public static SimpleNetworkWrapper network; - public static KeyBinding keyAction; - public static final Random randomGeneration = new Random(); private static Logger LOG = LogManager.getLogger(Tags.MODID); diff --git a/src/main/java/com/sinthoras/visualprospecting/VPMod.java b/src/main/java/com/sinthoras/visualprospecting/VPMod.java index 6b4e24a0..fc413c9d 100644 --- a/src/main/java/com/sinthoras/visualprospecting/VPMod.java +++ b/src/main/java/com/sinthoras/visualprospecting/VPMod.java @@ -13,7 +13,12 @@ import cpw.mods.fml.common.event.FMLServerStoppedEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; -@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]") +@Mod( + modid = Tags.MODID, + version = Tags.VERSION, + name = Tags.MODNAME, + acceptedMinecraftVersions = "[1.7.10]", + dependencies = "required-after:gregtech;" + "after:navigator;") public class VPMod { @SidedProxy(clientSide = Tags.GROUPNAME + ".hooks.HooksClient", serverSide = Tags.GROUPNAME + ".hooks.HooksShared") diff --git a/src/main/java/com/sinthoras/visualprospecting/VisualProspecting_API.java b/src/main/java/com/sinthoras/visualprospecting/VisualProspecting_API.java index caecef0f..227e9deb 100644 --- a/src/main/java/com/sinthoras/visualprospecting/VisualProspecting_API.java +++ b/src/main/java/com/sinthoras/visualprospecting/VisualProspecting_API.java @@ -1,8 +1,5 @@ package com.sinthoras.visualprospecting; -import static com.sinthoras.visualprospecting.Utils.isJourneyMapInstalled; -import static com.sinthoras.visualprospecting.Utils.isXaerosWorldMapInstalled; - import java.util.Collections; import java.util.List; @@ -14,15 +11,6 @@ import com.sinthoras.visualprospecting.database.OreVeinPosition; import com.sinthoras.visualprospecting.database.ServerCache; import com.sinthoras.visualprospecting.database.UndergroundFluidPosition; -import com.sinthoras.visualprospecting.integration.journeymap.JourneyMapState; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.journeymap.render.LayerRenderer; -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidLayerManager; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.XaeroWorldMapState; import com.sinthoras.visualprospecting.network.ProspectingNotification; import cpw.mods.fml.relauncher.Side; @@ -34,74 +22,6 @@ public class VisualProspecting_API { @SideOnly(Side.CLIENT) public static class LogicalClient { - // Register the logical button - public static void registerCustomButtonManager(ButtonManager customManager) { - MapState.instance.buttons.add(customManager); - } - - // Register the logical layer - public static void registerCustomLayer(LayerManager customLayer) { - MapState.instance.layers.add(customLayer); - } - - // Register visualization for logical button in JourneyMap - public static void registerJourneyMapButton(LayerButton customButton) { - if (isJourneyMapInstalled()) { - JourneyMapState.instance.buttons.add(customButton); - } - } - - // Register visualization for logical button in Xaero's World Map - public static void registerXaeroMapButton( - com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.LayerButton customButton) { - if (isXaerosWorldMapInstalled()) { - XaeroWorldMapState.instance.buttons.add(customButton); - } - } - - // Add the JourneyMap renderer for a layer - public static void registerJourneyMapRenderer(LayerRenderer customRenderer) { - if (isJourneyMapInstalled()) { - JourneyMapState.instance.renderers.add(customRenderer); - } - } - - // Add the Xaero's World Map renderer for a layer - public static void registerXaeroMapRenderer( - com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.LayerRenderer customRenderer) { - if (isXaerosWorldMapInstalled()) { - XaeroWorldMapState.instance.renderers.add(customRenderer); - } - } - - public static void openJourneyForOreVeinsMapAt(int blockX, int blockZ) { - if (isJourneyMapInstalled()) { - OreVeinLayerManager.instance.activateLayer(); - JourneyMapState.instance.openJourneyMapAt(blockX, blockZ); - } - } - - public static void openJourneyForOreVeinsMapAt(int blockX, int blockZ, int zoom) { - if (isJourneyMapInstalled()) { - OreVeinLayerManager.instance.activateLayer(); - JourneyMapState.instance.openJourneyMapAt(blockX, blockZ, zoom); - } - } - - public static void openJourneyMapForUndergroundFluidsAt(int blockX, int blockZ) { - if (isJourneyMapInstalled()) { - UndergroundFluidLayerManager.instance.activateLayer(); - JourneyMapState.instance.openJourneyMapAt(blockX, blockZ); - } - } - - public static void openJourneyMapForUndergroundFluidsAt(int blockX, int blockZ, int zoom) { - if (isJourneyMapInstalled()) { - UndergroundFluidLayerManager.instance.activateLayer(); - JourneyMapState.instance.openJourneyMapAt(blockX, blockZ, zoom); - } - } - // This mechanic is limited to blocks the player can touch public static void triggerProspectingForOreBlock(EntityPlayer player, World world, int blockX, int blockY, int blockZ) { @@ -121,7 +41,7 @@ public static UndergroundFluidPosition getUndergroundFluid(int dimensionId, int public static void setOreVeinDepleted(int dimensionId, int blockX, int blockZ) { final OreVeinPosition oreVeinPosition = ClientCache.instance .getOreVein(dimensionId, Utils.coordBlockToChunk(blockX), Utils.coordBlockToChunk(blockZ)); - if (oreVeinPosition.isDepleted() == false) { + if (!oreVeinPosition.isDepleted()) { oreVeinPosition.toggleDepleted(); } ClientCache.instance.putOreVeins(Collections.singletonList(oreVeinPosition)); diff --git a/src/main/java/com/sinthoras/visualprospecting/hooks/HooksClient.java b/src/main/java/com/sinthoras/visualprospecting/hooks/HooksClient.java index aa6ed389..4ac23cf0 100644 --- a/src/main/java/com/sinthoras/visualprospecting/hooks/HooksClient.java +++ b/src/main/java/com/sinthoras/visualprospecting/hooks/HooksClient.java @@ -1,17 +1,17 @@ package com.sinthoras.visualprospecting.hooks; -import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.input.Keyboard; - +import com.gtnewhorizons.navigator.api.NavigatorApi; +import com.gtnewhorizons.navigator.api.util.Util; import com.sinthoras.visualprospecting.Utils; -import com.sinthoras.visualprospecting.VP; import com.sinthoras.visualprospecting.database.ResetClientCacheCommand; +import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; +import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidChunkLayerManager; +import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidLayerManager; import com.sinthoras.visualprospecting.integration.voxelmap.VoxelMapEventHandler; -import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -28,12 +28,9 @@ public class HooksClient extends HooksShared { // load "Do your mod setup. Build whatever data structures you care about. Register recipes." public void fmlLifeCycleEvent(FMLPreInitializationEvent event) { super.fmlLifeCycleEvent(event); - - VP.keyAction = new KeyBinding( - "visualprospecting.key.action.name", - Keyboard.KEY_DELETE, - "visualprospecting.key.action.category"); - ClientRegistry.registerKeyBinding(VP.keyAction); + if (Utils.isNavigatorInstalled()) { + registerMapLayers(); + } } @Override @@ -48,9 +45,6 @@ public void fmlLifeCycleEvent(FMLInitializationEvent event) { public void fmlLifeCycleEvent(FMLPostInitializationEvent event) { super.fmlLifeCycleEvent(event); ClientCommandHandler.instance.registerCommand(new ResetClientCacheCommand()); - if (Utils.isVoxelMapInstalled()) { - MinecraftForge.EVENT_BUS.register(new VoxelMapEventHandler()); - } } @Override @@ -77,4 +71,15 @@ public void fmlLifeCycleEvent(FMLServerStoppingEvent event) { public void fmlLifeCycleEvent(FMLServerStoppedEvent event) { super.fmlLifeCycleEvent(event); } + + public void registerMapLayers() { + + NavigatorApi.registerLayerManager(OreVeinLayerManager.instance); + NavigatorApi.registerLayerManager(UndergroundFluidLayerManager.instance); + NavigatorApi.registerLayerManager(UndergroundFluidChunkLayerManager.instance); + + if (Util.isVoxelMapInstalled()) { + MinecraftForge.EVENT_BUS.register(new VoxelMapEventHandler()); + } + } } diff --git a/src/main/java/com/sinthoras/visualprospecting/hooks/HooksKey.java b/src/main/java/com/sinthoras/visualprospecting/hooks/HooksKey.java index e8af5e23..b885f210 100644 --- a/src/main/java/com/sinthoras/visualprospecting/hooks/HooksKey.java +++ b/src/main/java/com/sinthoras/visualprospecting/hooks/HooksKey.java @@ -1,13 +1,10 @@ package com.sinthoras.visualprospecting.hooks; -import static com.sinthoras.visualprospecting.Utils.isTCNodeTrackerInstalled; - import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; import com.sinthoras.visualprospecting.integration.model.buttons.OreVeinButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.ThaumcraftNodeButtonManager; import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; import cpw.mods.fml.client.registry.ClientRegistry; @@ -26,17 +23,10 @@ public class HooksKey { "visualprospecting.key.togglefluid.name", Keyboard.KEY_NONE, "visualprospecting.key.action.category"); - private final KeyBinding keyToggleNodes = new KeyBinding( - "visualprospecting.key.togglenode.name", - Keyboard.KEY_NONE, - "visualprospecting.key.action.category"); public HooksKey() { ClientRegistry.registerKeyBinding(keyToggleOres); ClientRegistry.registerKeyBinding(keyToggleFluids); - if (isTCNodeTrackerInstalled()) { - ClientRegistry.registerKeyBinding(keyToggleNodes); - } } @SideOnly(Side.CLIENT) @@ -52,8 +42,5 @@ private void checkAndToggleOverlays() { if (keyToggleFluids.isPressed()) { UndergroundFluidButtonManager.instance.toggle(); } - if (keyToggleNodes.isPressed() && isTCNodeTrackerInstalled()) { - ThaumcraftNodeButtonManager.instance.toggle(); - } } } diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/DrawUtils.java b/src/main/java/com/sinthoras/visualprospecting/integration/DrawUtils.java deleted file mode 100644 index 0ad18488..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/DrawUtils.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.sinthoras.visualprospecting.integration; - -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.client.lib.UtilsFX; - -public class DrawUtils { - - public static void drawGradientRect(double minPixelX, double minPixelY, double maxPixelX, double maxPixelY, - double z, int colorA, int colorB) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glShadeModel(GL11.GL_SMOOTH); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - - float alpha = (colorA >> 24 & 255) / 255.0f; - float red = (colorA >> 16 & 255) / 255.0f; - float green = (colorA >> 8 & 255) / 255.0f; - float blue = (colorA & 255) / 255.0f; - tessellator.setColorRGBA_F(red, green, blue, alpha); - tessellator.addVertex(maxPixelX, minPixelY, z); - tessellator.addVertex(minPixelX, minPixelY, z); - - alpha = (colorB >> 24 & 255) / 255.0f; - red = (colorB >> 16 & 255) / 255.0f; - green = (colorB >> 8 & 255) / 255.0f; - blue = (colorB & 255) / 255.0f; - tessellator.setColorRGBA_F(red, green, blue, alpha); - tessellator.addVertex(minPixelX, maxPixelY, z); - tessellator.addVertex(maxPixelX, maxPixelY, z); - - tessellator.draw(); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - public static void drawGradientRect(double minPixelX, double minPixelY, double maxPixelX, double maxPixelY, - int colorA, int colorB) { - drawGradientRect(minPixelX, minPixelY, maxPixelX, maxPixelY, 300, colorA, colorB); - } - - public static void drawQuad(ResourceLocation texture, double x, double y, double width, double height, int color, - float alpha) { - - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - - float[] c = floats(color); - GL11.glColor4f(c[0], c[1], c[2], alpha); - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y + height, 0.0, 0.0, 1.0); - tessellator.addVertexWithUV(x + width, y + height, 0.0, 1.0, 1.0); - tessellator.addVertexWithUV(x + width, y, 0.0, 1.0, 0.0); - tessellator.addVertexWithUV(x, y, 0.0, 0.0, 0.0); - tessellator.draw(); - } - - public static void drawQuad(IIcon icon, double x, double y, double width, double height, int color, float alpha) { - - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - - float[] c = floats(color); - GL11.glColor4f(c[0], c[1], c[2], alpha); - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y + height, 0.0, icon.getMinU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y + height, 0.0, icon.getMaxU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y, 0.0, icon.getMaxU(), icon.getMinV()); - tessellator.addVertexWithUV(x, y, 0.0, icon.getMinU(), icon.getMinV()); - tessellator.draw(); - } - - public static void drawAspect(double centerPixelX, double centerPixelY, double pixelSize, Aspect aspect, - int amount) { - final int textureSize = 16; - - GL11.glPushMatrix(); - final double scale = pixelSize / textureSize; - GL11.glScaled(scale, scale, scale); - UtilsFX.drawTag( - (centerPixelX - pixelSize / 2) / scale, - (centerPixelY - pixelSize / 2) / scale, - aspect, - amount, - 0, - 0, - GL11.GL_ONE_MINUS_SRC_ALPHA, - 1.0F, - false); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - - public static void drawSimpleLabel(GuiScreen gui, String text, double textX, double textY, int fontColor, - int bgColor, boolean centered) { - GL11.glPushMatrix(); - double dTextX = textX - (double) (int) textX; - double dTextY = textY - (double) (int) textY; - double textWidth = gui.mc.fontRenderer.getStringWidth(text); - double xOffsetL = centered ? -textWidth / 2.0 - 2 : -2; - double xOffsetR = centered ? textWidth / 2.0 + 2 : textWidth + 2; - GL11.glTranslated(dTextX, dTextY, 0.0); - drawGradientRect( - (int) textX + xOffsetL, - (int) textY - 2, - (int) textX + xOffsetR, - (int) textY + gui.mc.fontRenderer.FONT_HEIGHT + 2, - 0, - bgColor, - bgColor); - if (centered) gui.drawCenteredString(gui.mc.fontRenderer, text, (int) textX, (int) textY, fontColor); - else gui.drawString(gui.mc.fontRenderer, text, (int) textX, (int) textY, fontColor); - GL11.glPopMatrix(); - } - - public static void drawLabel(String text, double textX, double textY, int fontColor, int bgColor, boolean centered, - double fontScale) { - final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - - GL11.glPushMatrix(); - - if (fontScale != 1.0) { - textX /= fontScale; - textY /= fontScale; - GL11.glScaled(fontScale, fontScale, 0); - } - double dTextX = textX - (double) (int) textX; - double dTextY = textY - (double) (int) textY; - double textWidth = fontRenderer.getStringWidth(text); - double xOffsetL = centered ? -textWidth / 2.0 - 2 : -2; - double xOffsetR = centered ? textWidth / 2.0 + 2 : textWidth + 2; - GL11.glTranslated(dTextX, dTextY, 0.0); - drawGradientRect( - (int) textX + xOffsetL, - (int) textY - 2, - (int) textX + xOffsetR, - (int) textY + fontRenderer.FONT_HEIGHT + 2, - 0, - bgColor, - bgColor); - fontRenderer.drawStringWithShadow( - text, - (centered ? (int) (textX - textWidth / 2.0) : (int) textX), - (int) textY, - fontColor); - GL11.glPopMatrix(); - } - - public static void drawSimpleTooltip(GuiScreen gui, List text, double x, double y, int fontColor, - int bgColor) { - if (text.isEmpty()) return; - - int maxTextWidth = 0; - for (String str : text) { - int strWidth = gui.mc.fontRenderer.getStringWidth(str); - if (strWidth > maxTextWidth) maxTextWidth = strWidth; - } - - int boxWidth = maxTextWidth + 6; - int boxHeight = text.size() * (gui.mc.fontRenderer.FONT_HEIGHT + 2) + 6; - - double dx = x - (double) (int) x; - double dy = y - (double) (int) y; - - GL11.glPushMatrix(); - - drawGradientRect(x, y, x + boxWidth, y + boxHeight, bgColor, bgColor); - GL11.glTranslated(dx, dy, 301); - for (int i = 0; i < text.size(); i++) { - gui.drawString( - gui.mc.fontRenderer, - text.get(i), - (int) x + 3, - (int) y + 3 + i * (gui.mc.fontRenderer.FONT_HEIGHT + 2), - fontColor); - } - - GL11.glPopMatrix(); - } - - public static float[] floats(int rgb) { - return new float[] { (float) (rgb >> 16 & 255) / 255.0F, (float) (rgb >> 8 & 255) / 255.0F, - (float) (rgb & 255) / 255.0F }; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/JourneyMapState.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/JourneyMapState.java deleted file mode 100644 index 7cc47477..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/JourneyMapState.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap; - -import static com.sinthoras.visualprospecting.Utils.isTCNodeTrackerInstalled; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.Config; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.DirtyChunkButton; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.OreVeinButton; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.ThaumcraftNodeButton; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.UndergroundFluidButton; -import com.sinthoras.visualprospecting.integration.journeymap.render.DirtyChunkRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.LayerRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.OreVeinRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.ThaumcraftNodeRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.UndergroundFluidChunkRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.UndergroundFluidRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.waypoints.OreVeinWaypointManager; -import com.sinthoras.visualprospecting.integration.journeymap.waypoints.ThaumcraftNodeWaypointManager; -import com.sinthoras.visualprospecting.integration.journeymap.waypoints.WaypointManager; -import com.sinthoras.visualprospecting.mixins.late.journeymap.FullscreenAccessor; - -import journeymap.client.render.map.GridRenderer; - -public class JourneyMapState { - - public static JourneyMapState instance = new JourneyMapState(); - - public final List buttons = new ArrayList<>(); - public final List renderers = new ArrayList<>(); - public final List waypointManagers = new ArrayList<>(); - - public JourneyMapState() { - if (isTCNodeTrackerInstalled()) { - buttons.add(ThaumcraftNodeButton.instance); - renderers.add(ThaumcraftNodeRenderer.instance); - waypointManagers.add(ThaumcraftNodeWaypointManager.instance); - } - - buttons.add(UndergroundFluidButton.instance); - renderers.add(UndergroundFluidRenderer.instance); - renderers.add(UndergroundFluidChunkRenderer.instance); - - buttons.add(OreVeinButton.instance); - renderers.add(OreVeinRenderer.instance); - waypointManagers.add(OreVeinWaypointManager.instance); - - if (Config.enableDeveloperOverlays) { - buttons.add(DirtyChunkButton.instance); - renderers.add(DirtyChunkRenderer.instance); - } - } - - public void openJourneyMapAt(int blockX, int blockZ) { - final GridRenderer gridRenderer = FullscreenAccessor.getGridRenderer(); - assert gridRenderer != null; - gridRenderer.center(gridRenderer.getMapType(), blockX, blockZ, gridRenderer.getZoom()); - } - - public void openJourneyMapAt(int blockX, int blockZ, int zoom) { - final GridRenderer gridRenderer = FullscreenAccessor.getGridRenderer(); - assert gridRenderer != null; - gridRenderer.center(gridRenderer.getMapType(), blockX, blockZ, zoom); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/ResetClientCacheConfirmation.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/ResetClientCacheConfirmation.java deleted file mode 100644 index a6a6a890..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/ResetClientCacheConfirmation.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.IChatComponent; - -import com.sinthoras.visualprospecting.database.ClientCache; - -import journeymap.client.ui.UIManager; -import journeymap.client.ui.component.Button; -import journeymap.client.ui.component.ButtonList; -import journeymap.client.ui.component.JmUI; - -public class ResetClientCacheConfirmation extends JmUI { - - private Button confirmButton; - private Button cancelButton; - - public ResetClientCacheConfirmation() { - super(I18n.format("visualprospecting.resetprogress.title")); - } - - public void func_73866_w_() { - buttonList.clear(); - confirmButton = new Button(I18n.format("visualprospecting.resetprogress.confirm")); - cancelButton = new Button(I18n.format("visualprospecting.resetprogress.cancel")); - buttonList.add(confirmButton); - buttonList.add(cancelButton); - } - - protected void layoutButtons() { - if (buttonList.isEmpty()) { - func_73866_w_(); - } - final int x = width / 2; - final int y = height / 2; - drawCenteredString(getFontRenderer(), I18n.format("visualprospecting.resetprogress.prompt"), x, y, 0xFFFFFF); - final ButtonList row = new ButtonList(confirmButton, cancelButton); - row.layoutCenteredHorizontal(x, y + 18, true, 4); - } - - protected void func_146284_a(GuiButton guibutton) { - if (guibutton == confirmButton) { - ClientCache.instance.resetPlayerProgression(); - final IChatComponent confirmation = new ChatComponentTranslation( - "visualprospecting.resetprogress.confirmation"); - confirmation.getChatStyle().setItalic(true); - Minecraft.getMinecraft().thePlayer.addChatMessage(confirmation); - UIManager.getInstance().openFullscreenMap(); - } else if (guibutton == cancelButton) { - UIManager.getInstance().openMapActions(); - } - } - - protected void func_73869_a(char c, int i) { - switch (i) { - case 1: - UIManager.getInstance().openMapActions(); - default: - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/DirtyChunkButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/DirtyChunkButton.java deleted file mode 100644 index cfb61f5d..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/DirtyChunkButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.DirtyChunkButtonManager; - -public class DirtyChunkButton extends LayerButton { - - public static final DirtyChunkButton instance = new DirtyChunkButton(); - - public DirtyChunkButton() { - super(DirtyChunkButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/LayerButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/LayerButton.java deleted file mode 100644 index 4e179a9f..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/LayerButton.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.buttons; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; - -import journeymap.client.ui.theme.ThemeToggle; - -public class LayerButton extends com.sinthoras.visualprospecting.integration.model.buttons.LayerButton { - - private ThemeToggle button; - private final ButtonManager manager; - - private boolean isActive = false; - - public LayerButton(ButtonManager manager) { - super(manager, SupportedMods.JourneyMap); - this.manager = manager; - } - - @Override - public void updateState(boolean active) { - isActive = active; - if (button != null) { - button.setToggled(active, false); - } - } - - public void setButton(ThemeToggle button) { - this.button = button; - } - - public String getButtonTextKey() { - return manager.getButtonTextKey(); - } - - public String getIconName() { - return manager.getIconName(); - } - - public boolean isActive() { - return isActive; - } - - public void toggle() { - manager.toggle(); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/OreVeinButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/OreVeinButton.java deleted file mode 100644 index cea077ee..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/OreVeinButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.OreVeinButtonManager; - -public class OreVeinButton extends LayerButton { - - public static final OreVeinButton instance = new OreVeinButton(); - - public OreVeinButton() { - super(OreVeinButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/ThaumcraftNodeButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/ThaumcraftNodeButton.java deleted file mode 100644 index 3ac64db9..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/ThaumcraftNodeButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.ThaumcraftNodeButtonManager; - -public class ThaumcraftNodeButton extends LayerButton { - - public static final ThaumcraftNodeButton instance = new ThaumcraftNodeButton(); - - public ThaumcraftNodeButton() { - super(ThaumcraftNodeButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/UndergroundFluidButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/UndergroundFluidButton.java deleted file mode 100644 index edd40a15..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/buttons/UndergroundFluidButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; - -public class UndergroundFluidButton extends LayerButton { - - public static final UndergroundFluidButton instance = new UndergroundFluidButton(); - - public UndergroundFluidButton() { - super(UndergroundFluidButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ClickableDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ClickableDrawStep.java deleted file mode 100644 index f8c04d55..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ClickableDrawStep.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.drawsteps; - -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; - -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; - -import journeymap.client.render.draw.DrawStep; - -public interface ClickableDrawStep extends DrawStep { - - List getTooltip(); - - void drawTooltip(FontRenderer fontRenderer, int mouseX, int mouseY, int displayWidth, int displayHeight); - - boolean isMouseOver(int mouseX, int mouseY); - - void onActionKeyPressed(); - - IWaypointAndLocationProvider getLocationProvider(); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/DirtyChunkDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/DirtyChunkDrawStep.java deleted file mode 100644 index 580524db..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/DirtyChunkDrawStep.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.drawsteps; - -import java.awt.geom.Point2D; - -import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.model.locations.DirtyChunkLocation; - -import journeymap.client.render.draw.DrawStep; -import journeymap.client.render.draw.DrawUtil; -import journeymap.client.render.map.GridRenderer; - -public class DirtyChunkDrawStep implements DrawStep { - - private final DirtyChunkLocation dirtyChunkLocation; - - public DirtyChunkDrawStep(DirtyChunkLocation dirtyChunkLocation) { - this.dirtyChunkLocation = dirtyChunkLocation; - } - - @Override - public void draw(double draggedPixelX, double draggedPixelY, GridRenderer gridRenderer, float drawScale, - double fontScale, double rotation) { - final int zoom = gridRenderer.getZoom(); - double blockSize = Math.pow(2, zoom); - final Point2D.Double blockAsPixel = gridRenderer - .getBlockPixelInGrid(dirtyChunkLocation.getBlockX(), dirtyChunkLocation.getBlockZ()); - final Point2D.Double pixel = new Point2D.Double( - blockAsPixel.getX() + draggedPixelX, - blockAsPixel.getY() + draggedPixelY); - float alpha = 0.5f; - alpha *= alpha * 204; - int color = dirtyChunkLocation.isDirty() ? 0xFF0000 : 0x00FFAA; - DrawUtil.drawRectangle( - pixel.getX(), - pixel.getY(), - VP.chunkWidth * blockSize, - VP.chunkDepth * blockSize, - color, - (int) alpha); - - if (dirtyChunkLocation.isDirty()) { - final int borderColor = 0xFFD700; - final int borderAlpha = 204; - DrawUtil.drawRectangle(pixel.getX(), pixel.getY(), 15 * blockSize, blockSize, borderColor, borderAlpha); - DrawUtil.drawRectangle( - pixel.getX() + 15 * blockSize, - pixel.getY(), - blockSize, - 15 * blockSize, - borderColor, - borderAlpha); - DrawUtil.drawRectangle( - pixel.getX() + 1 * blockSize, - pixel.getY() + 15 * blockSize, - 15 * blockSize, - blockSize, - borderColor, - borderAlpha); - DrawUtil.drawRectangle( - pixel.getX(), - pixel.getY() + 1 * blockSize, - blockSize, - 15 * blockSize, - borderColor, - borderAlpha); - - DrawUtil.drawLabel( - "D", - pixel.getX() + 13 * blockSize, - pixel.getY() + 13 * blockSize, - DrawUtil.HAlign.Left, - DrawUtil.VAlign.Above, - 0, - 180, - 0x00FFFFFF, - 255, - fontScale, - false, - rotation); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/OreVeinDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/OreVeinDrawStep.java index fbab57e1..8e4898f8 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/OreVeinDrawStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/OreVeinDrawStep.java @@ -1,7 +1,6 @@ package com.sinthoras.visualprospecting.integration.journeymap.drawsteps; import java.awt.geom.Point2D; -import java.util.ArrayList; import java.util.List; import net.minecraft.client.gui.FontRenderer; @@ -9,16 +8,17 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; +import com.gtnewhorizons.navigator.api.journeymap.drawsteps.JMInteractableStep; +import com.gtnewhorizons.navigator.api.model.locations.IWaypointAndLocationProvider; +import com.gtnewhorizons.navigator.api.util.DrawUtils; import com.sinthoras.visualprospecting.Config; import com.sinthoras.visualprospecting.Tags; -import com.sinthoras.visualprospecting.integration.DrawUtils; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; import journeymap.client.render.draw.DrawUtil; import journeymap.client.render.map.GridRenderer; -public class OreVeinDrawStep implements ClickableDrawStep { +public class OreVeinDrawStep implements JMInteractableStep { private static final ResourceLocation depletedTextureLocation = new ResourceLocation( Tags.MODID, @@ -35,8 +35,7 @@ public OreVeinDrawStep(OreVeinLocation oreVeinLocation) { } @Override - public List getTooltip() { - final List tooltip = new ArrayList<>(); + public void getTooltip(List tooltip) { if (oreVeinLocation.isDepleted()) { tooltip.add(oreVeinLocation.getDepletedHint()); } @@ -44,15 +43,15 @@ public List getTooltip() { tooltip.add(oreVeinLocation.getActiveWaypointHint()); } tooltip.add(oreVeinLocation.getName()); - if (oreVeinLocation.isDepleted() == false) { + if (!oreVeinLocation.isDepleted()) { tooltip.addAll(oreVeinLocation.getMaterialNames()); } tooltip.add(oreVeinLocation.getToggleDepletedHint()); - return tooltip; } @Override - public void drawTooltip(FontRenderer fontRenderer, int mouseX, int mouseY, int displayWidth, int displayHeight) {} + public void drawCustomTooltip(FontRenderer fontRenderer, int mouseX, int mouseY, int displayWidth, + int displayHeight) {} @Override public boolean isMouseOver(int mouseX, int mouseY) { @@ -80,7 +79,7 @@ public void draw(double draggedPixelX, double draggedPixelY, GridRenderer gridRe blockAsPixel.getX() + draggedPixelX, blockAsPixel.getY() + draggedPixelY); - if (gridRenderer.getZoom() >= Config.minZoomLevelForOreLabel && oreVeinLocation.isDepleted() == false) { + if (gridRenderer.getZoom() >= Config.minZoomLevelForOreLabel && !oreVeinLocation.isDepleted()) { final int fontColor = oreVeinLocation.drawSearchHighlight() ? 0xFFFFFF : 0x7F7F7F; DrawUtil.drawLabel( oreVeinLocation.getName(), @@ -111,7 +110,7 @@ public void draw(double draggedPixelX, double draggedPixelY, GridRenderer gridRe oreVeinLocation.getColor(), 255); - if (oreVeinLocation.drawSearchHighlight() == false || oreVeinLocation.isDepleted()) { + if (!oreVeinLocation.drawSearchHighlight() || oreVeinLocation.isDepleted()) { DrawUtil.drawRectangle(iconX, iconY, iconSize, iconSize, 0x000000, 150); if (oreVeinLocation.isDepleted()) { DrawUtils.drawQuad(depletedTextureLocation, iconX, iconY, iconSize, iconSize, 0xFFFFFF, 255); diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ThaumcraftNodeDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ThaumcraftNodeDrawStep.java deleted file mode 100644 index 47539d54..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/ThaumcraftNodeDrawStep.java +++ /dev/null @@ -1,265 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.drawsteps; - -import java.awt.geom.Point2D; -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import com.sinthoras.visualprospecting.Tags; -import com.sinthoras.visualprospecting.integration.DrawUtils; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.ThaumcraftNodeLocation; - -import journeymap.client.render.map.GridRenderer; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.client.lib.UtilsFX; - -public class ThaumcraftNodeDrawStep implements ClickableDrawStep { - - private static final ResourceLocation markedTextureLocation = new ResourceLocation( - Tags.MODID, - "textures/node_marked.png"); - private static final ResourceLocation unmarkedTextureLocation = new ResourceLocation( - Tags.MODID, - "textures/node_unmarked.png"); - - private final ThaumcraftNodeLocation thaumcraftNodeLocation; - - private double centerPixelX = 0; - private double centerPixelY = 0; - private double clickableRadiusPixelSquared = 0; - - public ThaumcraftNodeDrawStep(ThaumcraftNodeLocation thaumcraftNodeLocation) { - this.thaumcraftNodeLocation = thaumcraftNodeLocation; - } - - @Override - public void draw(double draggedPixelX, double draggedPixelY, GridRenderer gridRenderer, float drawScale, - double fontScale, double rotation) { - final double borderSize = 44 * drawScale; - final double borderSizeHalf = borderSize / 2; - final Point2D.Double blockAsPixel = gridRenderer - .getBlockPixelInGrid(thaumcraftNodeLocation.getBlockX(), thaumcraftNodeLocation.getBlockZ()); - final Point2D.Double pixel = new Point2D.Double( - blockAsPixel.getX() + draggedPixelX, - blockAsPixel.getY() + draggedPixelY); - centerPixelX = pixel.getX(); - centerPixelY = pixel.getY(); - clickableRadiusPixelSquared = borderSizeHalf * borderSizeHalf; - - final int alpha = 204; - DrawUtils.drawQuad( - thaumcraftNodeLocation.isActiveAsWaypoint() ? markedTextureLocation : unmarkedTextureLocation, - pixel.getX() - borderSizeHalf, - pixel.getY() - borderSizeHalf, - borderSize, - borderSize, - 0xFFFFFF, - alpha); - - final int aspectPixelDiameter = 32; - DrawUtils.drawAspect( - pixel.getX(), - pixel.getY(), - aspectPixelDiameter, - thaumcraftNodeLocation.getStrongestAspect(), - 0); - } - - public List getTooltip() { - return null; - } - - public boolean isMouseOver(int mouseX, int mouseY) { - final double deltaX = mouseX - centerPixelX; - final double deltaY = mouseY - centerPixelY; - return deltaX * deltaX + deltaY * deltaY <= clickableRadiusPixelSquared; - } - - public void onActionKeyPressed() { - ThaumcraftNodeLayerManager.instance.deleteNode(thaumcraftNodeLocation); - } - - @Override - public IWaypointAndLocationProvider getLocationProvider() { - return thaumcraftNodeLocation; - } - - public void drawTooltip(FontRenderer fontRenderer, int mouseX, int mouseY, int displayWidth, int displayHeight) { - final boolean isWaypoint = thaumcraftNodeLocation.isActiveAsWaypoint(); - final String activeWaypointHint = thaumcraftNodeLocation.getActiveWaypointHint(); - final String title = thaumcraftNodeLocation.getTitle(); - final String nodeDescription = thaumcraftNodeLocation.getDescription(); - final String deleteHint = thaumcraftNodeLocation.getDeleteHint(); - - int maxTextWidth = Math.max( - Math.max(fontRenderer.getStringWidth(title), fontRenderer.getStringWidth(nodeDescription)), - fontRenderer.getStringWidth(deleteHint)); - if (isWaypoint) { - maxTextWidth = Math.max(maxTextWidth, fontRenderer.getStringWidth(activeWaypointHint)); - } - if (fontRenderer.getBidiFlag()) { - maxTextWidth = (int) Math.ceil(maxTextWidth * 1.25f); - } - - final int aspectRows = (thaumcraftNodeLocation.getAspects().size() + 4) / 5; // Equivalent to Math.ceil(size / - // 5) - final int aspectColumns = Math.min(thaumcraftNodeLocation.getAspects().size(), 5); - - int pixelX = mouseX + 12; - int pixelY = mouseY - 12; - final int tooltipHeight = (isWaypoint ? 44 : 32) + aspectRows * 16; - final int tooltipWidth = Math.max(aspectColumns * 16, maxTextWidth); - if (pixelX + tooltipWidth > displayWidth) { - pixelX -= 28 + tooltipWidth; - } - if (pixelY + tooltipHeight + 6 > displayHeight) { - pixelY = displayHeight - tooltipHeight - 6; - } - - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - // Draw background - final int backgroundColor = 0xF0100010; - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 4, - pixelX + tooltipWidth + 3, - pixelY - 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY + tooltipHeight + 3, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 4, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 3, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 4, - pixelY - 3, - pixelX - 3, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX + tooltipWidth + 3, - pixelY - 3, - pixelX + tooltipWidth + 4, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - - int verdunGreen = 0x505000FF; - int borderColor = 0x5028007F; - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 3 + 1, - pixelX - 3 + 1, - pixelY + tooltipHeight + 3 - 1, - verdunGreen, - borderColor); - DrawUtils.drawGradientRect( - pixelX + tooltipWidth + 2, - pixelY - 3 + 1, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 3 - 1, - verdunGreen, - borderColor); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 3, - pixelX + tooltipWidth + 3, - pixelY - 3 + 1, - verdunGreen, - verdunGreen); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY + tooltipHeight + 2, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 3, - borderColor, - borderColor); - - // Draw text - int offset = 0; - if (fontRenderer.getBidiFlag()) { - if (isWaypoint) { - final int asWaypointWidth = (int) Math.ceil(fontRenderer.getStringWidth(activeWaypointHint) * 1.1f); - fontRenderer.drawString(title, pixelX + tooltipWidth - asWaypointWidth, pixelY, 0xFFFFFFFF); - offset += 12; - } - final int titleWidth = (int) Math.ceil(fontRenderer.getStringWidth(title) * 1.1f); - fontRenderer.drawString(title, pixelX + tooltipWidth - titleWidth, pixelY + offset, 0xFFFFFFFF); - offset += 12; - final int nodeDescriptonWidth = (int) Math.ceil(fontRenderer.getStringWidth(nodeDescription) * 1.1f); - fontRenderer.drawString( - nodeDescription, - pixelX + nodeDescriptonWidth - titleWidth, - pixelY + offset, - 0xFFFFFFFF); - - final int deleteHintWidth = (int) Math.ceil(fontRenderer.getStringWidth(deleteHint) * 1.1f); - fontRenderer.drawString( - deleteHint, - pixelX + tooltipWidth - deleteHintWidth, - pixelY + aspectRows * 16 + offset + 12, - 0xFFFFFFFF); - } else { - if (isWaypoint) { - fontRenderer.drawString(activeWaypointHint, pixelX, pixelY, 0xFFFFFFFF); - offset += 12; - } - fontRenderer.drawString(title, pixelX, pixelY + offset, 0xFFFFFFFF); - offset += 12; - fontRenderer.drawString(nodeDescription, pixelX, pixelY + offset, 0xFFFFFFFF); - - fontRenderer.drawString(deleteHint, pixelX, pixelY + aspectRows * 16 + offset + 12, 0xFFFFFFFF); - } - - // Draw aspects - int aspectX = 0; - int aspectY = 0; - - for (Aspect aspect : thaumcraftNodeLocation.getAspects().getAspectsSortedAmount()) { - GL11.glPushMatrix(); - UtilsFX.drawTag( - pixelX + aspectX * 16, - pixelY + aspectY * 16 + offset + 10, - aspect, - thaumcraftNodeLocation.getAspects().getAmount(aspect), - 0, - 0.01, - 1, - 1, - false); - GL11.glPopMatrix(); - ++aspectX; - if (aspectX >= 5) { - aspectX = 0; - ++aspectY; - } - } - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - RenderHelper.enableStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidChunkDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidChunkDrawStep.java index 8ec22120..8a49662e 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidChunkDrawStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidChunkDrawStep.java @@ -2,15 +2,15 @@ import java.awt.geom.Point2D; +import com.gtnewhorizons.navigator.api.journeymap.drawsteps.JMRenderStep; import com.sinthoras.visualprospecting.Config; import com.sinthoras.visualprospecting.VP; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidChunkLocation; -import journeymap.client.render.draw.DrawStep; import journeymap.client.render.draw.DrawUtil; import journeymap.client.render.map.GridRenderer; -public class UndergroundFluidChunkDrawStep implements DrawStep { +public class UndergroundFluidChunkDrawStep implements JMRenderStep { private final UndergroundFluidChunkLocation undergroundFluidChunkLocation; diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidDrawStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidDrawStep.java index 5162fd64..467099b7 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidDrawStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/UndergroundFluidDrawStep.java @@ -4,14 +4,14 @@ import net.minecraft.client.resources.I18n; +import com.gtnewhorizons.navigator.api.journeymap.drawsteps.JMRenderStep; import com.sinthoras.visualprospecting.VP; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidLocation; -import journeymap.client.render.draw.DrawStep; import journeymap.client.render.draw.DrawUtil; import journeymap.client.render.map.GridRenderer; -public class UndergroundFluidDrawStep implements DrawStep { +public class UndergroundFluidDrawStep implements JMRenderStep { private final UndergroundFluidLocation undergroundFluidLocation; diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/DirtyChunkRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/DirtyChunkRenderer.java deleted file mode 100644 index a2476eb6..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/DirtyChunkRenderer.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.render; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.DirtyChunkDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.DirtyChunkLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.DirtyChunkLocation; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -import journeymap.client.render.draw.DrawStep; - -public class DirtyChunkRenderer extends LayerRenderer { - - public static final DirtyChunkRenderer instance = new DirtyChunkRenderer(); - - public DirtyChunkRenderer() { - super(DirtyChunkLayerManager.instance); - } - - @Override - public List mapLocationProviderToDrawStep(List visibleElements) { - final List drawSteps = new ArrayList<>(); - visibleElements.stream().map(element -> (DirtyChunkLocation) element) - .forEach(location -> drawSteps.add(new DirtyChunkDrawStep(location))); - return drawSteps; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMOreVeinRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMOreVeinRenderer.java new file mode 100644 index 00000000..1f53a50e --- /dev/null +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMOreVeinRenderer.java @@ -0,0 +1,26 @@ +package com.sinthoras.visualprospecting.integration.journeymap.render; + +import java.util.ArrayList; +import java.util.List; + +import com.gtnewhorizons.navigator.api.journeymap.render.JMInteractableLayerRenderer; +import com.gtnewhorizons.navigator.api.model.layers.InteractableLayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.steps.RenderStep; +import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.OreVeinDrawStep; +import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; + +public class JMOreVeinRenderer extends JMInteractableLayerRenderer { + + public JMOreVeinRenderer(InteractableLayerManager manager) { + super(manager); + } + + @Override + protected List generateRenderSteps(List visibleElements) { + final List drawSteps = new ArrayList<>(); + visibleElements.stream().map(element -> (OreVeinLocation) element) + .forEach(location -> drawSteps.add(new OreVeinDrawStep(location))); + return drawSteps; + } +} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidChunkRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidChunkRenderer.java similarity index 51% rename from src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidChunkRenderer.java rename to src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidChunkRenderer.java index 1dfcc956..de0245d9 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidChunkRenderer.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidChunkRenderer.java @@ -3,23 +3,21 @@ import java.util.ArrayList; import java.util.List; +import com.gtnewhorizons.navigator.api.journeymap.render.JMLayerRenderer; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.steps.RenderStep; import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.UndergroundFluidChunkDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidChunkLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidChunkLocation; -import journeymap.client.render.draw.DrawStep; +public class JMUndergroundFluidChunkRenderer extends JMLayerRenderer { -public class UndergroundFluidChunkRenderer extends LayerRenderer { - - public static final UndergroundFluidChunkRenderer instance = new UndergroundFluidChunkRenderer(); - - public UndergroundFluidChunkRenderer() { - super(UndergroundFluidChunkLayerManager.instance); + public JMUndergroundFluidChunkRenderer(LayerManager manager) { + super(manager); } @Override - public List mapLocationProviderToDrawStep(List visibleElements) { + protected List generateRenderSteps(List visibleElements) { final List drawSteps = new ArrayList<>(); visibleElements.stream().map(element -> (UndergroundFluidChunkLocation) element) .forEach(location -> drawSteps.add(new UndergroundFluidChunkDrawStep(location))); diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidRenderer.java similarity index 51% rename from src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidRenderer.java rename to src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidRenderer.java index d4978646..62acc735 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/UndergroundFluidRenderer.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/JMUndergroundFluidRenderer.java @@ -3,23 +3,21 @@ import java.util.ArrayList; import java.util.List; +import com.gtnewhorizons.navigator.api.journeymap.render.JMLayerRenderer; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.steps.RenderStep; import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.UndergroundFluidDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidLocation; -import journeymap.client.render.draw.DrawStep; +public class JMUndergroundFluidRenderer extends JMLayerRenderer { -public class UndergroundFluidRenderer extends LayerRenderer { - - public static final UndergroundFluidRenderer instance = new UndergroundFluidRenderer(); - - public UndergroundFluidRenderer() { - super(UndergroundFluidLayerManager.instance); + public JMUndergroundFluidRenderer(LayerManager manager) { + super(manager); } @Override - public List mapLocationProviderToDrawStep(List visibleElements) { + protected List generateRenderSteps(List visibleElements) { final List drawSteps = new ArrayList<>(); visibleElements.stream().map(element -> (UndergroundFluidLocation) element) .forEach(location -> drawSteps.add(new UndergroundFluidDrawStep(location))); diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/LayerRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/LayerRenderer.java deleted file mode 100644 index 8f539c56..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/LayerRenderer.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.render; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -import journeymap.client.render.draw.DrawStep; - -public abstract class LayerRenderer extends com.sinthoras.visualprospecting.integration.model.layers.LayerRenderer { - - private final LayerManager manager; - - protected List drawSteps = new ArrayList<>(); - - public LayerRenderer(LayerManager manager) { - super(manager, SupportedMods.JourneyMap); - this.manager = manager; - } - - public boolean isLayerActive() { - return manager.isLayerActive(); - } - - public List getDrawStepsCachedForInteraction() { - return drawSteps; - } - - public List getDrawStepsCachedForRendering() { - return drawSteps; - } - - @Override - public void updateVisibleElements(List visibleElements) { - drawSteps = (List) mapLocationProviderToDrawStep(visibleElements); - } - - protected abstract List mapLocationProviderToDrawStep( - List visibleElements); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/OreVeinRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/OreVeinRenderer.java deleted file mode 100644 index 410172bc..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/OreVeinRenderer.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.render; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.ClickableDrawStep; -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.OreVeinDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; - -public class OreVeinRenderer extends WaypointProviderLayerRenderer { - - public static final OreVeinRenderer instance = new OreVeinRenderer(); - - public OreVeinRenderer() { - super(OreVeinLayerManager.instance); - } - - @Override - public List mapLocationProviderToDrawStep( - List visibleElements) { - final List drawSteps = new ArrayList<>(); - visibleElements.stream().map(element -> (OreVeinLocation) element) - .forEach(location -> drawSteps.add(new OreVeinDrawStep(location))); - return drawSteps; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/ThaumcraftNodeRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/ThaumcraftNodeRenderer.java deleted file mode 100644 index 408188f8..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/ThaumcraftNodeRenderer.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.render; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.ClickableDrawStep; -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.ThaumcraftNodeDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.ThaumcraftNodeLocation; - -public class ThaumcraftNodeRenderer extends WaypointProviderLayerRenderer { - - public static ThaumcraftNodeRenderer instance = new ThaumcraftNodeRenderer(); - - public ThaumcraftNodeRenderer() { - super(ThaumcraftNodeLayerManager.instance); - } - - @Override - public List mapLocationProviderToDrawStep( - List visibleElements) { - final List drawSteps = new ArrayList<>(); - visibleElements.stream().map(element -> (ThaumcraftNodeLocation) element) - .forEach(location -> drawSteps.add(new ThaumcraftNodeDrawStep(location))); - return drawSteps; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/WaypointProviderLayerRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/WaypointProviderLayerRenderer.java deleted file mode 100644 index 147b15dc..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/render/WaypointProviderLayerRenderer.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.render; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; - -import com.sinthoras.visualprospecting.integration.journeymap.drawsteps.ClickableDrawStep; -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -import journeymap.client.model.BlockCoordIntPair; - -public abstract class WaypointProviderLayerRenderer extends LayerRenderer { - - private final WaypointProviderManager manager; - - private List drawSteps = new ArrayList<>(); - private List drawStepsReversed = new ArrayList<>(); - - private ClickableDrawStep hoveredDrawStep = null; - - public WaypointProviderLayerRenderer(WaypointProviderManager manager) { - super(manager); - this.manager = manager; - } - - @Override - public List getDrawStepsCachedForInteraction() { - return drawSteps; - } - - @Override - public List getDrawStepsCachedForRendering() { - return drawStepsReversed; - } - - @Override - public void updateVisibleElements(List visibleElements) { - drawSteps = (List) mapLocationProviderToDrawStep(visibleElements); - drawStepsReversed = new ArrayList<>(drawSteps); - Collections.reverse(drawStepsReversed); - } - - protected abstract List mapLocationProviderToDrawStep( - List visibleElements); - - public void onMouseMove(int mouseX, int mouseY) { - hoveredDrawStep = null; - for (ClickableDrawStep drawStep : getDrawStepsCachedForInteraction()) { - if (drawStep.isMouseOver(mouseX, mouseY)) { - hoveredDrawStep = drawStep; - return; - } - } - } - - public boolean onMouseAction(boolean isDoubleClick) { - if (hoveredDrawStep != null) { - if (isDoubleClick) { - if (hoveredDrawStep.getLocationProvider().isActiveAsWaypoint()) { - manager.clearActiveWaypoint(); - } else { - manager.setActiveWaypoint(hoveredDrawStep.getLocationProvider().toWaypoint()); - } - } - return true; - } - return false; - } - - public boolean onMouseActionOutsideLayer(boolean isDoubleClick, BlockCoordIntPair blockCoord) { - if (isLayerActive() && isDoubleClick) { - return manager.doActionOutsideLayer(blockCoord); - } - return false; - } - - public List getTextTooltip() { - if (hoveredDrawStep != null) { - return hoveredDrawStep.getTooltip(); - } - return null; - } - - public void drawCustomTooltip(FontRenderer fontRenderer, int mouseX, int mouseY, int displayWidth, - int displayHeight) { - if (hoveredDrawStep != null) { - hoveredDrawStep.drawTooltip(fontRenderer, mouseX, mouseY, displayWidth, displayHeight); - } - } - - public void onActionKeyPressed() { - if (manager.isLayerActive() && hoveredDrawStep != null) { - hoveredDrawStep.onActionKeyPressed(); - manager.forceRefresh(); - } - } - - public boolean isLayerActive() { - return manager.isLayerActive(); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/OreVeinWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/OreVeinWaypointManager.java deleted file mode 100644 index 2c0ad2a2..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/OreVeinWaypointManager.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.waypoints; - -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; - -public class OreVeinWaypointManager extends WaypointManager { - - public static final OreVeinWaypointManager instance = new OreVeinWaypointManager(); - - public OreVeinWaypointManager() { - super(OreVeinLayerManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/ThaumcraftNodeWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/ThaumcraftNodeWaypointManager.java deleted file mode 100644 index c32a6f02..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/ThaumcraftNodeWaypointManager.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.waypoints; - -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; - -public class ThaumcraftNodeWaypointManager extends WaypointManager { - - public static final ThaumcraftNodeWaypointManager instance = new ThaumcraftNodeWaypointManager(); - - public ThaumcraftNodeWaypointManager() { - super(ThaumcraftNodeLayerManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/WaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/WaypointManager.java deleted file mode 100644 index 74883e64..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/journeymap/waypoints/WaypointManager.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sinthoras.visualprospecting.integration.journeymap.waypoints; - -import java.awt.Color; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -public class WaypointManager extends com.sinthoras.visualprospecting.integration.model.waypoints.WaypointManager { - - private journeymap.client.model.Waypoint jmWaypoint; - - public WaypointManager(WaypointProviderManager layerManager) { - super(layerManager, SupportedMods.JourneyMap); - } - - @Override - public void clearActiveWaypoint() { - jmWaypoint = null; - } - - public boolean hasWaypoint() { - return jmWaypoint != null; - } - - public journeymap.client.model.Waypoint getJmWaypoint() { - return jmWaypoint; - } - - @Override - public void updateActiveWaypoint(Waypoint waypoint) { - if (hasWaypoint() == false || waypoint.blockX != jmWaypoint.getX() - || waypoint.blockY != jmWaypoint.getY() - || waypoint.blockZ != jmWaypoint.getZ() - || jmWaypoint.getDimensions().contains(waypoint.dimensionId) == false) { - jmWaypoint = new journeymap.client.model.Waypoint( - waypoint.label, - waypoint.blockX, - waypoint.blockY, - waypoint.blockZ, - new Color(waypoint.color), - journeymap.client.model.Waypoint.Type.Normal, - waypoint.dimensionId); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/MapState.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/MapState.java deleted file mode 100644 index dd46261e..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/MapState.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model; - -import static com.sinthoras.visualprospecting.Utils.*; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.Config; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.DirtyChunkButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.OreVeinButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.ThaumcraftNodeButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; -import com.sinthoras.visualprospecting.integration.model.layers.DirtyChunkLayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidChunkLayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidLayerManager; -import com.sinthoras.visualprospecting.integration.tcnodetracker.NTNodeTrackerWaypointManager; -import com.sinthoras.visualprospecting.integration.xaerominimap.XaeroMiniMapState; - -public class MapState { - - public static final MapState instance = new MapState(); - - public final List buttons = new ArrayList<>(); - public final List layers = new ArrayList<>(); - - public MapState() { - if (isTCNodeTrackerInstalled()) { - buttons.add(ThaumcraftNodeButtonManager.instance); - layers.add(ThaumcraftNodeLayerManager.instance); - new NTNodeTrackerWaypointManager(); - } - - buttons.add(UndergroundFluidButtonManager.instance); - layers.add(UndergroundFluidLayerManager.instance); - layers.add(UndergroundFluidChunkLayerManager.instance); - - buttons.add(OreVeinButtonManager.instance); - layers.add(OreVeinLayerManager.instance); - - if (Config.enableDeveloperOverlays) { - buttons.add(DirtyChunkButtonManager.instance); - layers.add(DirtyChunkLayerManager.instance); - } - - if (isXaerosMinimapInstalled()) { - // need to classload XaeroMiniMapState in order for its waypoint manager to get registered - XaeroMiniMapState.instance.toString(); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/SupportedMods.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/SupportedMods.java deleted file mode 100644 index 551b6719..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/SupportedMods.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model; - -public enum SupportedMods { - TCNodeTracker, - JourneyMap, - XaeroWorldMap, - XaeroMiniMap; - - // TODO: Open Map at here -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ButtonManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ButtonManager.java deleted file mode 100644 index 40c09867..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ButtonManager.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.buttons; - -import java.util.EnumMap; -import java.util.Map; - -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.SupportedMods; - -public class ButtonManager { - - private final String buttonTextKey; - private final String iconName; - - private Map buttons = new EnumMap<>(SupportedMods.class); - private boolean isActive = false; - - /* - * Provide textures in assets/journeymap/icon/theme/Vault/icon/.png and - * assets/journeymap/icon/theme/Victorian/icon/.png for JourneyMap and provide a texture in - * assets/xaeroworldmap/textures/.png for XaeroWorldMap. - */ - public ButtonManager(String buttonTextKey, String iconName) { - this.buttonTextKey = buttonTextKey; - this.iconName = iconName; - } - - public void registerButton(SupportedMods map, LayerButton layerButton) { - buttons.put(map, layerButton); - } - - public void updateState(boolean active) { - buttons.values().forEach(button -> button.updateState(active)); - } - - public boolean containsButton(LayerButton button) { - return buttons.containsValue(button); - } - - public String getButtonTextKey() { - return buttonTextKey; - } - - public String getIconName() { - return iconName; - } - - public boolean isActive() { - return isActive; - } - - public void activate() { - MapState.instance.buttons.forEach(ButtonManager::deactivate); - isActive = true; - updateState(true); - } - - public void deactivate() { - isActive = false; - updateState(false); - } - - public void toggle() { - if (isActive) { - deactivate(); - } else { - activate(); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/DirtyChunkButtonManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/DirtyChunkButtonManager.java deleted file mode 100644 index cadcec51..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/DirtyChunkButtonManager.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.buttons; - -public class DirtyChunkButtonManager extends ButtonManager { - - public static final DirtyChunkButtonManager instance = new DirtyChunkButtonManager(); - - public DirtyChunkButtonManager() { - super("visualprospecting.button.dirtychunk", "nodes"); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/LayerButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/LayerButton.java deleted file mode 100644 index 0845cf0d..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/LayerButton.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.buttons; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; - -public abstract class LayerButton { - - public LayerButton(ButtonManager manager, SupportedMods map) { - manager.registerButton(map, this); - // Grab lang key and texture information from manager in extended constructor - } - - public abstract void updateState(boolean active); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/OreVeinButtonManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/OreVeinButtonManager.java index 5ab7d819..537ad4f8 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/OreVeinButtonManager.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/OreVeinButtonManager.java @@ -1,10 +1,23 @@ package com.sinthoras.visualprospecting.integration.model.buttons; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import com.gtnewhorizons.navigator.api.model.SupportedMods; +import com.gtnewhorizons.navigator.api.model.buttons.ButtonManager; +import com.sinthoras.visualprospecting.Tags; + public class OreVeinButtonManager extends ButtonManager { public static final OreVeinButtonManager instance = new OreVeinButtonManager(); - public OreVeinButtonManager() { - super("visualprospecting.button.orevein", "oreveins"); + @Override + public ResourceLocation getIcon(SupportedMods mod, String theme) { + return new ResourceLocation(Tags.MODID, "textures/icons/oreveins.png"); + } + + @Override + public String getButtonText() { + return StatCollector.translateToLocal("visualprospecting.button.orevein"); } } diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ThaumcraftNodeButtonManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ThaumcraftNodeButtonManager.java deleted file mode 100644 index b2da7182..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/ThaumcraftNodeButtonManager.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.buttons; - -public class ThaumcraftNodeButtonManager extends ButtonManager { - - public static final ThaumcraftNodeButtonManager instance = new ThaumcraftNodeButtonManager(); - - public ThaumcraftNodeButtonManager() { - super("visualprospecting.button.nodes", "nodes"); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/UndergroundFluidButtonManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/UndergroundFluidButtonManager.java index 7c7836d5..5a566c2c 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/UndergroundFluidButtonManager.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/buttons/UndergroundFluidButtonManager.java @@ -1,10 +1,23 @@ package com.sinthoras.visualprospecting.integration.model.buttons; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import com.gtnewhorizons.navigator.api.model.SupportedMods; +import com.gtnewhorizons.navigator.api.model.buttons.ButtonManager; +import com.sinthoras.visualprospecting.Tags; + public class UndergroundFluidButtonManager extends ButtonManager { public static final UndergroundFluidButtonManager instance = new UndergroundFluidButtonManager(); - public UndergroundFluidButtonManager() { - super("visualprospecting.button.undergroundfluid", "undergroundfluid"); + @Override + public ResourceLocation getIcon(SupportedMods mod, String theme) { + return new ResourceLocation(Tags.MODID, "textures/icons/undergroundfluid.png"); + } + + @Override + public String getButtonText() { + return StatCollector.translateToLocal("visualprospecting.button.undergroundfluid"); } } diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/DirtyChunkLayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/DirtyChunkLayerManager.java deleted file mode 100644 index de9204ca..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/DirtyChunkLayerManager.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.layers; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import com.sinthoras.visualprospecting.Utils; -import com.sinthoras.visualprospecting.integration.model.buttons.DirtyChunkButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.DirtyChunkLocation; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -public class DirtyChunkLayerManager extends LayerManager { - - public static final DirtyChunkLayerManager instance = new DirtyChunkLayerManager(); - - public DirtyChunkLayerManager() { - super(DirtyChunkButtonManager.instance); - } - - @Override - protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - return true; - } - - @Override - protected List generateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, - int maxBlockZ) { - final int minX = Utils.coordBlockToChunk(minBlockX); - final int minZ = Utils.coordBlockToChunk(minBlockZ); - final int maxX = Utils.coordBlockToChunk(maxBlockX); - final int maxZ = Utils.coordBlockToChunk(maxBlockZ); - final EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; - final int playerDimensionId = player.dimension; - - ArrayList dirtyChunks = new ArrayList<>(); - - if (MinecraftServer.getServer() == null - || MinecraftServer.getServer().worldServerForDimension(playerDimensionId) == null) { - return dirtyChunks; - } - - World w = MinecraftServer.getServer().worldServerForDimension(playerDimensionId); - IChunkProvider chunkProvider = w.getChunkProvider(); - - for (int chunkX = minX; chunkX <= maxX; chunkX++) { - for (int chunkZ = minZ; chunkZ <= maxZ; chunkZ++) { - if (!chunkProvider.chunkExists(chunkX, chunkZ)) { - continue; - } - final boolean dirty = w.getChunkFromChunkCoords(chunkX, chunkZ).isModified; - dirtyChunks.add(new DirtyChunkLocation(chunkX, chunkZ, playerDimensionId, dirty)); - } - } - - return dirtyChunks; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerManager.java deleted file mode 100644 index 947fce88..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerManager.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.layers; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; -import com.sinthoras.visualprospecting.integration.model.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -public abstract class LayerManager { - - private final ButtonManager buttonManager; - - protected boolean forceRefresh = false; - private List visibleElements = new ArrayList<>(); - protected Map layerRenderer = new EnumMap<>(SupportedMods.class); - private int miniMapWidth = 0; - private int miniMapHeight = 0; - private int fullscreenMapWidth = 0; - private int fullscreenMapHeight = 0; - - public LayerManager(ButtonManager buttonManager) { - this.buttonManager = buttonManager; - } - - public void onButtonClicked(LayerButton button) { - if (buttonManager.containsButton(button)) { - toggleLayer(); - } - } - - public boolean isLayerActive() { - return buttonManager.isActive(); - } - - public void activateLayer() { - buttonManager.activate(); - } - - public void deactivateLayer() { - buttonManager.deactivate(); - } - - public void toggleLayer() { - buttonManager.toggle(); - } - - public void forceRefresh() { - forceRefresh = true; - } - - public void onOpenMap() {} - - protected abstract List generateVisibleElements(int minBlockX, int minBlockZ, - int maxBlockX, int maxBlockZ); - - protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - return true; - } - - public void recacheMiniMap(int centerBlockX, int centerBlockZ, int blockRadius) { - recacheMiniMap(centerBlockX, centerBlockZ, blockRadius, blockRadius); - } - - public void recacheMiniMap(int centerBlockX, int centerBlockZ, int blockWidth, int blockHeight) { - miniMapWidth = blockWidth; - miniMapHeight = blockHeight; - recacheVisibleElements(centerBlockX, centerBlockZ); - } - - public void recacheFullscreenMap(int centerBlockX, int centerBlockZ, int blockWidth, int blockHeight) { - fullscreenMapWidth = blockWidth; - fullscreenMapHeight = blockHeight; - recacheVisibleElements(centerBlockX, centerBlockZ); - } - - private void recacheVisibleElements(int centerBlockX, int centerBlockZ) { - final int radiusBlockX = (Math.max(miniMapWidth, fullscreenMapWidth) + 1) >> 1; - final int radiusBlockZ = (Math.max(miniMapHeight, fullscreenMapHeight) + 1) >> 1; - - final int minBlockX = centerBlockX - radiusBlockX; - final int minBlockZ = centerBlockZ - radiusBlockZ; - final int maxBlockX = centerBlockX + radiusBlockX; - final int maxBlockZ = centerBlockZ + radiusBlockZ; - - checkAndUpdateElements(minBlockX, minBlockZ, maxBlockX, maxBlockZ); - } - - protected void checkAndUpdateElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - if (forceRefresh || needsRegenerateVisibleElements(minBlockX, minBlockZ, maxBlockX, maxBlockZ)) { - visibleElements = generateVisibleElements(minBlockX, minBlockZ, maxBlockX, maxBlockZ); - layerRenderer.values().forEach(layer -> layer.updateVisibleElements(visibleElements)); - forceRefresh = false; - } - } - - public void registerLayerRenderer(SupportedMods map, LayerRenderer renderer) { - layerRenderer.put(map, renderer); - } - - public LayerRenderer getLayerRenderer(SupportedMods map) { - return layerRenderer.get(map); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerRenderer.java deleted file mode 100644 index 89c335d8..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/LayerRenderer.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.layers; - -import java.util.List; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; - -public abstract class LayerRenderer { - - public LayerRenderer(LayerManager manager, SupportedMods map) { - manager.registerLayerRenderer(map, this); - } - - public abstract void updateVisibleElements(List visibleElements); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/OreVeinLayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/OreVeinLayerManager.java index 5d06c9e4..bc64634d 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/OreVeinLayerManager.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/OreVeinLayerManager.java @@ -5,16 +5,26 @@ import net.minecraft.client.Minecraft; +import org.jetbrains.annotations.Nullable; + +import com.gtnewhorizons.navigator.api.journeymap.waypoints.JMWaypointManager; +import com.gtnewhorizons.navigator.api.model.SupportedMods; +import com.gtnewhorizons.navigator.api.model.layers.InteractableLayerManager; +import com.gtnewhorizons.navigator.api.model.layers.LayerRenderer; +import com.gtnewhorizons.navigator.api.model.locations.IWaypointAndLocationProvider; +import com.gtnewhorizons.navigator.api.model.waypoints.WaypointManager; import com.sinthoras.visualprospecting.Utils; import com.sinthoras.visualprospecting.database.ClientCache; import com.sinthoras.visualprospecting.database.OreVeinPosition; import com.sinthoras.visualprospecting.database.veintypes.VeinType; import com.sinthoras.visualprospecting.database.veintypes.VeinTypeCaching; +import com.sinthoras.visualprospecting.integration.journeymap.render.JMOreVeinRenderer; import com.sinthoras.visualprospecting.integration.model.buttons.OreVeinButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; +import com.sinthoras.visualprospecting.integration.xaerominimap.OreVeinWaypointManager; +import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.XaeroOreVeinRenderer; -public class OreVeinLayerManager extends WaypointProviderManager { +public class OreVeinLayerManager extends InteractableLayerManager { public static final OreVeinLayerManager instance = new OreVeinLayerManager(); @@ -51,6 +61,26 @@ protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, i return false; } + @Nullable + @Override + protected LayerRenderer addLayerRenderer(InteractableLayerManager manager, SupportedMods mod) { + return switch (mod) { + case JourneyMap -> new JMOreVeinRenderer(manager); + case XaeroWorldMap -> new XaeroOreVeinRenderer(manager); + default -> null; + }; + } + + @Nullable + @Override + protected WaypointManager addWaypointManager(InteractableLayerManager manager, SupportedMods mod) { + return switch (mod) { + case JourneyMap -> new JMWaypointManager(manager); + case XaeroWorldMap -> new OreVeinWaypointManager(manager); + default -> null; + }; + } + @Override protected List generateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/ThaumcraftNodeLayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/ThaumcraftNodeLayerManager.java deleted file mode 100644 index a51ba352..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/ThaumcraftNodeLayerManager.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.layers; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; - -import com.dyonovan.tcnodetracker.TCNodeTracker; -import com.dyonovan.tcnodetracker.lib.NodeList; -import com.sinthoras.visualprospecting.integration.model.buttons.ThaumcraftNodeButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.ThaumcraftNodeLocation; - -public class ThaumcraftNodeLayerManager extends WaypointProviderManager { - - public static final ThaumcraftNodeLayerManager instance = new ThaumcraftNodeLayerManager(); - - private int oldMinBlockX = 0; - private int oldMinBlockZ = 0; - private int oldMaxBlockX = 0; - private int oldMaxBlockZ = 0; - - public ThaumcraftNodeLayerManager() { - super(ThaumcraftNodeButtonManager.instance); - } - - @Override - protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - if (minBlockX != oldMinBlockX || minBlockZ != oldMinBlockZ - || maxBlockX != oldMaxBlockX - || maxBlockZ != oldMaxBlockZ) { - oldMinBlockX = minBlockX; - oldMinBlockZ = minBlockZ; - oldMaxBlockX = maxBlockX; - oldMaxBlockZ = maxBlockZ; - return true; - } - return false; - } - - @Override - protected List generateVisibleElements(int minBlockX, int minBlockZ, - int maxBlockX, int maxBlockZ) { - final int playerDimensionId = Minecraft.getMinecraft().thePlayer.dimension; - - ArrayList thaumcraftNodeLocations = new ArrayList<>(); - - for (NodeList node : TCNodeTracker.nodelist) { - if (node.dim == playerDimensionId && node.x >= minBlockX - && node.x <= maxBlockX - && node.z >= minBlockZ - && node.z <= maxBlockZ) { - thaumcraftNodeLocations.add(new ThaumcraftNodeLocation(node)); - } - } - - return thaumcraftNodeLocations; - } - - public void deleteNode(ThaumcraftNodeLocation thaumcraftNodeLocation) { - TCNodeTracker.nodelist.removeIf(thaumcraftNodeLocation::belongsToNode); - if (thaumcraftNodeLocation.isActiveAsWaypoint()) { - clearActiveWaypoint(); - } - forceRefresh(); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidChunkLayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidChunkLayerManager.java index 9a547697..ba0a8409 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidChunkLayerManager.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidChunkLayerManager.java @@ -5,13 +5,20 @@ import net.minecraft.client.Minecraft; +import org.jetbrains.annotations.Nullable; + +import com.gtnewhorizons.navigator.api.model.SupportedMods; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.layers.LayerRenderer; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.Utils; import com.sinthoras.visualprospecting.VP; import com.sinthoras.visualprospecting.database.ClientCache; import com.sinthoras.visualprospecting.database.UndergroundFluidPosition; +import com.sinthoras.visualprospecting.integration.journeymap.render.JMUndergroundFluidChunkRenderer; import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidChunkLocation; +import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.XaeroUndergroundFluidChunkRenderer; public class UndergroundFluidChunkLayerManager extends LayerManager { @@ -48,6 +55,16 @@ protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, i return false; } + @Nullable + @Override + protected LayerRenderer addLayerRenderer(LayerManager manager, SupportedMods mods) { + return switch (mods) { + case JourneyMap -> new JMUndergroundFluidChunkRenderer(manager); + case XaeroWorldMap -> new XaeroUndergroundFluidChunkRenderer(manager); + default -> null; + }; + } + @Override protected List generateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidLayerManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidLayerManager.java index 6cab439b..6a1995e3 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidLayerManager.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/UndergroundFluidLayerManager.java @@ -5,13 +5,20 @@ import net.minecraft.client.Minecraft; +import org.jetbrains.annotations.Nullable; + +import com.gtnewhorizons.navigator.api.model.SupportedMods; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.layers.LayerRenderer; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.Utils; import com.sinthoras.visualprospecting.VP; import com.sinthoras.visualprospecting.database.ClientCache; import com.sinthoras.visualprospecting.database.UndergroundFluidPosition; +import com.sinthoras.visualprospecting.integration.journeymap.render.JMUndergroundFluidRenderer; import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidLocation; +import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.XaeroUndergroundFluidRenderer; public class UndergroundFluidLayerManager extends LayerManager { @@ -48,6 +55,16 @@ protected boolean needsRegenerateVisibleElements(int minBlockX, int minBlockZ, i return false; } + @Nullable + @Override + protected LayerRenderer addLayerRenderer(LayerManager manager, SupportedMods mod) { + return switch (mod) { + case JourneyMap -> new JMUndergroundFluidRenderer(manager); + case XaeroWorldMap -> new XaeroUndergroundFluidRenderer(manager); + default -> null; + }; + } + @Override protected List generateVisibleElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/WaypointProviderManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/WaypointProviderManager.java deleted file mode 100644 index b2a594be..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/layers/WaypointProviderManager.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.layers; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; -import com.sinthoras.visualprospecting.integration.model.waypoints.WaypointManager; - -import journeymap.client.model.BlockCoordIntPair; - -public abstract class WaypointProviderManager extends LayerManager { - - private List visibleElements = new ArrayList<>(); - private Map waypointManagers = new EnumMap<>(SupportedMods.class); - - protected Waypoint activeWaypoint = null; - - public WaypointProviderManager(ButtonManager buttonManager) { - super(buttonManager); - } - - public void setActiveWaypoint(Waypoint waypoint) { - activeWaypoint = waypoint; - visibleElements.forEach(element -> element.onWaypointUpdated(waypoint)); - waypointManagers.values().forEach(translator -> translator.updateActiveWaypoint(waypoint)); - } - - public void clearActiveWaypoint() { - activeWaypoint = null; - visibleElements.forEach(IWaypointAndLocationProvider::onWaypointCleared); - waypointManagers.values().forEach(WaypointManager::clearActiveWaypoint); - } - - public boolean hasActiveWaypoint() { - return activeWaypoint != null; - } - - public boolean doActionOutsideLayer(BlockCoordIntPair blockCoord) { - return false; - } - - public void registerWaypointManager(SupportedMods map, WaypointManager waypointManager) { - waypointManagers.put(map, waypointManager); - } - - public WaypointManager getWaypointManager(SupportedMods map) { - return waypointManagers.get(map); - } - - protected abstract List generateVisibleElements(int minBlockX, - int minBlockZ, int maxBlockX, int maxBlockZ); - - @Override - protected void checkAndUpdateElements(int minBlockX, int minBlockZ, int maxBlockX, int maxBlockZ) { - if (forceRefresh || needsRegenerateVisibleElements(minBlockX, minBlockZ, maxBlockX, maxBlockZ)) { - visibleElements = generateVisibleElements(minBlockX, minBlockZ, maxBlockX, maxBlockZ); - - if (hasActiveWaypoint()) { - for (IWaypointAndLocationProvider element : visibleElements) { - element.onWaypointUpdated(activeWaypoint); - } - } - - layerRenderer.values().forEach(layer -> layer.updateVisibleElements(visibleElements)); - forceRefresh = false; - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/DirtyChunkLocation.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/DirtyChunkLocation.java deleted file mode 100644 index 75066c31..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/DirtyChunkLocation.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.locations; - -import com.sinthoras.visualprospecting.Utils; - -public class DirtyChunkLocation implements ILocationProvider { - - private final int blockX; - private final int blockZ; - private final int dimensionId; - private final boolean dirty; - - public DirtyChunkLocation(int chunkX, int chunkZ, int dimensionId, boolean dirty) { - blockX = Utils.coordChunkToBlock(chunkX); - blockZ = Utils.coordChunkToBlock(chunkZ); - this.dimensionId = dimensionId; - this.dirty = dirty; - } - - public double getBlockX() { - return blockX + 0.5; - } - - public double getBlockZ() { - return blockZ + 0.5; - } - - public int getDimensionId() { - return dimensionId; - } - - public boolean isDirty() { - return dirty; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ILocationProvider.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ILocationProvider.java deleted file mode 100644 index d069df51..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ILocationProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.locations; - -public interface ILocationProvider { - - int getDimensionId(); - - double getBlockX(); - - double getBlockZ(); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/IWaypointAndLocationProvider.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/IWaypointAndLocationProvider.java deleted file mode 100644 index e8a2d998..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/IWaypointAndLocationProvider.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.locations; - -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -public interface IWaypointAndLocationProvider extends ILocationProvider { - - Waypoint toWaypoint(); - - boolean isActiveAsWaypoint(); - - void onWaypointCleared(); - - void onWaypointUpdated(Waypoint waypoint); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/OreVeinLocation.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/OreVeinLocation.java index 5520c785..f9a62ee4 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/OreVeinLocation.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/OreVeinLocation.java @@ -9,18 +9,19 @@ import org.lwjgl.input.Keyboard; -import com.sinthoras.visualprospecting.VP; +import com.gtnewhorizons.navigator.api.NavigatorApi; +import com.gtnewhorizons.navigator.api.model.locations.IWaypointAndLocationProvider; +import com.gtnewhorizons.navigator.api.model.waypoints.Waypoint; import com.sinthoras.visualprospecting.database.ClientCache; import com.sinthoras.visualprospecting.database.OreVeinPosition; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; public class OreVeinLocation implements IWaypointAndLocationProvider { private static final String depletedHint = EnumChatFormatting.RED + I18n.format("visualprospecting.depleted"); private static final String activeWaypointHint = EnumChatFormatting.GOLD + I18n.format("visualprospecting.iswaypoint"); - private static final String toggleDepletedHint = EnumChatFormatting.DARK_GRAY - + I18n.format("visualprospecting.node.deletehint", Keyboard.getKeyName(VP.keyAction.getKeyCode())); + private static final String toggleDepletedHint = EnumChatFormatting.DARK_GRAY + I18n + .format("visualprospecting.node.deletehint", Keyboard.getKeyName(NavigatorApi.ACTION_KEY.getKeyCode())); private final OreVeinPosition oreVeinPosition; private final String name; diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ThaumcraftNodeLocation.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ThaumcraftNodeLocation.java deleted file mode 100644 index 7d04c409..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/ThaumcraftNodeLocation.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.locations; - -import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; - -import org.lwjgl.input.Keyboard; - -import com.dyonovan.tcnodetracker.lib.NodeList; -import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.nodes.NodeType; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.tiles.TileNode; - -public class ThaumcraftNodeLocation implements IWaypointAndLocationProvider { - - private static final String deleteHint = EnumChatFormatting.DARK_GRAY - + I18n.format("visualprospecting.node.deletehint", Keyboard.getKeyName(VP.keyAction.getKeyCode()));; - private static final String activeWaypointHint = EnumChatFormatting.GOLD - + I18n.format("visualprospecting.iswaypoint"); - private static final String title = EnumChatFormatting.BOLD + I18n.format("tile.blockAiry.0.name"); - - private final NodeList node; - private final TileNode nodeTile; - private final String description; - - private boolean isActiveAsWaypoint; - - public ThaumcraftNodeLocation(NodeList node) { - this.node = node; - - nodeTile = new TileNode(); - final AspectList aspectList = new AspectList(); - for (String aspectTag : node.aspect.keySet()) { - aspectList.add(Aspect.getAspect(aspectTag), node.aspect.get(aspectTag)); - } - nodeTile.setAspects(aspectList); - switch (node.type) { - case "NORMAL": - nodeTile.setNodeType(NodeType.NORMAL); - break; - case "UNSTABLE": - nodeTile.setNodeType(NodeType.UNSTABLE); - break; - case "DARK": - nodeTile.setNodeType(NodeType.DARK); - break; - case "TAINTED": - nodeTile.setNodeType(NodeType.TAINTED); - break; - case "PURE": - nodeTile.setNodeType(NodeType.PURE); - break; - case "HUNGRY": - nodeTile.setNodeType(NodeType.HUNGRY); - break; - } - nodeTile.blockType = ConfigBlocks.blockAiry; - nodeTile.blockMetadata = 0; - - description = node.mod.equals("BLANK") - ? EnumChatFormatting.GRAY + I18n.format("nodetype." + node.type + ".name") - : EnumChatFormatting.GRAY + I18n.format("nodetype." + node.type + ".name") - + ", " - + I18n.format("nodemod." + node.mod + ".name"); - } - - @Override - public double getBlockX() { - return node.x + 0.5; - } - - public double getBlockY() { - return node.y + 0.5; - } - - @Override - public double getBlockZ() { - return node.z + 0.5; - } - - @Override - public int getDimensionId() { - return node.dim; - } - - @Override - public Waypoint toWaypoint() { - return new Waypoint( - node.x, - node.y, - node.z, - node.dim, - I18n.format("visualprospecting.tracked", I18n.format("tile.blockAiry.0.name")), - nodeTile.targetColor.getRGB()); - } - - @Override - public boolean isActiveAsWaypoint() { - return isActiveAsWaypoint; - } - - @Override - public void onWaypointCleared() { - isActiveAsWaypoint = false; - } - - @Override - public void onWaypointUpdated(Waypoint waypoint) { - isActiveAsWaypoint = waypoint.dimensionId == node.dim && waypoint.blockX == node.x - && waypoint.blockY == node.y - && waypoint.blockZ == node.z; - } - - public boolean belongsToNode(NodeList other) { - return node.x == other.x && node.y == other.y && node.z == other.z && node.dim == other.dim; - } - - public Aspect getStrongestAspect() { - return nodeTile.getAspects().getAspectsSortedAmount()[0]; - } - - public AspectList getAspects() { - return nodeTile.getAspects(); - } - - public String getDescription() { - return description; - } - - public String getDeleteHint() { - return deleteHint; - } - - public String getActiveWaypointHint() { - return activeWaypointHint; - } - - public String getTitle() { - return title; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidChunkLocation.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidChunkLocation.java index 78713f61..02c148c5 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidChunkLocation.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidChunkLocation.java @@ -2,6 +2,7 @@ import net.minecraftforge.fluids.Fluid; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.Utils; public class UndergroundFluidChunkLocation implements ILocationProvider { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidLocation.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidLocation.java index a4fe404b..cf82972e 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidLocation.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/model/locations/UndergroundFluidLocation.java @@ -2,6 +2,7 @@ import net.minecraftforge.fluids.Fluid; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; import com.sinthoras.visualprospecting.database.UndergroundFluidPosition; public class UndergroundFluidLocation implements ILocationProvider { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/Waypoint.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/Waypoint.java deleted file mode 100644 index 971b8725..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/Waypoint.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.waypoints; - -public class Waypoint { - - public final int blockX; - public final int blockY; - public final int blockZ; - public final int dimensionId; - public final String label; - public final int color; - - public Waypoint(int blockX, int blockY, int blockZ, int dimensionId, String label, int color) { - this.blockX = blockX; - this.blockY = blockY; - this.blockZ = blockZ; - this.dimensionId = dimensionId; - this.label = label; - this.color = color; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/WaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/WaypointManager.java deleted file mode 100644 index 1e6643f7..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/model/waypoints/WaypointManager.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.sinthoras.visualprospecting.integration.model.waypoints; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; - -public abstract class WaypointManager { - - public WaypointManager(WaypointProviderManager layerManager, SupportedMods map) { - layerManager.registerWaypointManager(map, this); - } - - public abstract void clearActiveWaypoint(); - - public abstract void updateActiveWaypoint(Waypoint waypoint); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/tcnodetracker/NTNodeTrackerWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/tcnodetracker/NTNodeTrackerWaypointManager.java deleted file mode 100644 index fc610d3b..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/tcnodetracker/NTNodeTrackerWaypointManager.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sinthoras.visualprospecting.integration.tcnodetracker; - -import com.dyonovan.tcnodetracker.TCNodeTracker; -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -public class NTNodeTrackerWaypointManager - extends com.sinthoras.visualprospecting.integration.model.waypoints.WaypointManager { - - public NTNodeTrackerWaypointManager() { - super(ThaumcraftNodeLayerManager.instance, SupportedMods.TCNodeTracker); - } - - @Override - public void clearActiveWaypoint() { - TCNodeTracker.yMarker = -1; - } - - @Override - public void updateActiveWaypoint(Waypoint waypoint) { - TCNodeTracker.xMarker = waypoint.blockX; - TCNodeTracker.yMarker = waypoint.blockY; - TCNodeTracker.zMarker = waypoint.blockZ; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/IWaypointManagerReflection.java b/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/IWaypointManagerReflection.java deleted file mode 100644 index 1d77761d..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/IWaypointManagerReflection.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.sinthoras.visualprospecting.integration.voxelmap; - -import java.lang.reflect.Method; - -import com.sinthoras.visualprospecting.VP; -import com.thevoxelbox.voxelmap.interfaces.IWaypointManager; - -public class IWaypointManagerReflection { - - private static Method getCurrentSubworldDescriptor; - - public static String getCurrentSubworldDescriptor(IWaypointManager obj, boolean arg) { - try { - return (String) getCurrentSubworldDescriptor.invoke(obj, arg); - } catch (Exception e) { - VP.error( - "Could not invoke IWaypointManager#if. If it failed due to a NullPointerException, look for an error message starting with \"Getting the method IWaypointManager#if failed\" further up."); - e.printStackTrace(); - } - return ""; - } - - static { - try { - getCurrentSubworldDescriptor = IWaypointManager.class.getMethod("if", boolean.class); - } catch (Exception e) { - VP.error( - "Getting the method IWaypointManager#if failed, any calls to IWaypointManagerReflection#getCurrentSubworldDescriptor will return an empty String."); - e.printStackTrace(); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/VoxelMapEventHandler.java b/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/VoxelMapEventHandler.java index e9f384c6..aaf8d451 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/VoxelMapEventHandler.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/voxelmap/VoxelMapEventHandler.java @@ -7,14 +7,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; +import com.gtnewhorizons.navigator.api.voxelmap.VoxelMapWaypointManager; import com.sinthoras.visualprospecting.Config; import com.sinthoras.visualprospecting.Utils; import com.sinthoras.visualprospecting.database.OreVeinPosition; import com.sinthoras.visualprospecting.database.UndergroundFluidPosition; import com.sinthoras.visualprospecting.hooks.ProspectingNotificationEvent; -import com.thevoxelbox.voxelmap.interfaces.AbstractVoxelMap; -import com.thevoxelbox.voxelmap.interfaces.IWaypointManager; -import com.thevoxelbox.voxelmap.util.Waypoint; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.GregTech_API; @@ -28,24 +26,20 @@ public void onVeinProspected(ProspectingNotificationEvent.OreVein event) { } OreVeinPosition pos = event.getPosition(); - IWaypointManager waypointManager = AbstractVoxelMap.getInstance().getWaypointManager(); short[] color = GregTech_API.sGeneratedMaterials[pos.veinType.primaryOreMeta].getRGBA(); TreeSet dim = new TreeSet<>(); dim.add(pos.dimensionId); - - waypointManager.addWaypoint( - new Waypoint( - StatCollector.translateToLocal(pos.veinType.name), // name - pos.getBlockX(), // X - pos.getBlockZ(), // Z - getY(), // Y - Config.enableVoxelMapWaypointsByDefault, // enabled - (float) color[0] / 255.0f, // red - (float) color[1] / 255.0f, // green - (float) color[2] / 255.0f, // blue - "Pickaxe", // icon - IWaypointManagerReflection.getCurrentSubworldDescriptor(waypointManager, false), // world - dim)); // dimension + VoxelMapWaypointManager.addVoxelMapWaypoint( + StatCollector.translateToLocal(pos.veinType.name), // name + pos.getBlockX(), // X + pos.getBlockZ(), // Z + getY(), // Y + Config.enableVoxelMapWaypointsByDefault, // enabled + (float) color[0] / 255.0f, // red + (float) color[1] / 255.0f, // green + (float) color[2] / 255.0f, // blue + "Pickaxe", // icon + dim); } @SuppressWarnings("deprecation") @@ -56,26 +50,23 @@ public void onFluidProspected(ProspectingNotificationEvent.UndergroundFluid even } UndergroundFluidPosition pos = event.getPosition(); - IWaypointManager waypointManager = AbstractVoxelMap.getInstance().getWaypointManager(); int x = Utils.coordChunkToBlock(pos.chunkX); int z = Utils.coordChunkToBlock(pos.chunkZ); int color = pos.fluid.getColor(); TreeSet dim = new TreeSet<>(); dim.add(pos.dimensionId); - waypointManager.addWaypoint( - new Waypoint( - pos.fluid.getLocalizedName(), // name - x, // X - z, // Z - Minecraft.getMinecraft().theWorld.getHeightValue(x, z), // Y - Config.enableVoxelMapWaypointsByDefault, // enabled - (float) (color >> 16 & 0xFF) / 255.0f, // red - (float) (color >> 8 & 0xFF) / 255.0f, // green - (float) (color & 0xFF) / 255.0f, // blue - "Science", // icon - IWaypointManagerReflection.getCurrentSubworldDescriptor(waypointManager, false), // world - dim)); // dimension + VoxelMapWaypointManager.addVoxelMapWaypoint( + pos.fluid.getLocalizedName(), // name + x, // X + z, // Z + Minecraft.getMinecraft().theWorld.getHeightValue(x, z), // Y + Config.enableVoxelMapWaypointsByDefault, // enabled + (float) (color >> 16 & 0xFF) / 255.0f, // red + (float) (color >> 8 & 0xFF) / 255.0f, // green + (float) (color & 0xFF) / 255.0f, // blue + "Science", // icon + dim); // dimension } private static int getY() { diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/OreVeinWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/OreVeinWaypointManager.java new file mode 100644 index 00000000..c9c85185 --- /dev/null +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/OreVeinWaypointManager.java @@ -0,0 +1,17 @@ +package com.sinthoras.visualprospecting.integration.xaerominimap; + +import com.gtnewhorizons.navigator.api.model.layers.InteractableLayerManager; +import com.gtnewhorizons.navigator.api.model.waypoints.Waypoint; +import com.gtnewhorizons.navigator.api.xaero.waypoints.XaeroWaypointManager; + +public class OreVeinWaypointManager extends XaeroWaypointManager { + + public OreVeinWaypointManager(InteractableLayerManager manager) { + super(manager); + } + + @Override + protected String getSymbol(Waypoint waypoint) { + return "!"; + } +} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/XaeroMiniMapState.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/XaeroMiniMapState.java deleted file mode 100644 index f9191bf9..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/XaeroMiniMapState.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap; - -import static com.sinthoras.visualprospecting.Utils.isTCNodeTrackerInstalled; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.xaerominimap.waypoints.OreVeinWaypointManager; -import com.sinthoras.visualprospecting.integration.xaerominimap.waypoints.ThaumcraftNodeWaypointManager; -import com.sinthoras.visualprospecting.integration.xaerominimap.waypoints.WaypointManager; - -public class XaeroMiniMapState { - - public static XaeroMiniMapState instance = new XaeroMiniMapState(); - - public final List waypointManagers = new ArrayList<>(); - - public XaeroMiniMapState() { - waypointManagers.add(OreVeinWaypointManager.instance); - - if (isTCNodeTrackerInstalled()) { - waypointManagers.add(ThaumcraftNodeWaypointManager.instance); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/OreVeinWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/OreVeinWaypointManager.java deleted file mode 100644 index 441d6dc2..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/OreVeinWaypointManager.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap.waypoints; - -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -public class OreVeinWaypointManager extends WaypointManager { - - public static OreVeinWaypointManager instance = new OreVeinWaypointManager(); - - public OreVeinWaypointManager() { - super(OreVeinLayerManager.instance, WaypointType.ORE_VEINS_WAYPOINT); - } - - @Override - protected String getSymbol(Waypoint waypoint) { - return "!"; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/ThaumcraftNodeWaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/ThaumcraftNodeWaypointManager.java deleted file mode 100644 index 2c30aa97..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/ThaumcraftNodeWaypointManager.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap.waypoints; - -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -public class ThaumcraftNodeWaypointManager extends WaypointManager { - - public static ThaumcraftNodeWaypointManager instance = new ThaumcraftNodeWaypointManager(); - - public ThaumcraftNodeWaypointManager() { - super(ThaumcraftNodeLayerManager.instance, WaypointType.TC_NODES_WAYPOINT); - } - - @Override - protected String getSymbol(Waypoint waypoint) { - return "@"; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointManager.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointManager.java deleted file mode 100644 index ae20e658..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointManager.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap.waypoints; - -import java.util.Hashtable; - -import com.sinthoras.visualprospecting.Tags; -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -import xaero.common.minimap.waypoints.WaypointsManager; - -public class WaypointManager extends com.sinthoras.visualprospecting.integration.model.waypoints.WaypointManager { - - private static final Hashtable xWaypointTable = WaypointsManager - .getCustomWaypoints(Tags.MODID); - - private WaypointWithDimension xWaypoint; - private final WaypointType waypointType; - - public WaypointManager(WaypointProviderManager layerManager, WaypointType waypointType) { - super(layerManager, SupportedMods.XaeroMiniMap); - this.waypointType = waypointType; - } - - @Override - public void clearActiveWaypoint() { - xWaypoint = null; - xWaypointTable.remove(waypointType.ordinal()); - } - - public boolean hasWaypoint() { - return xWaypoint != null; - } - - public WaypointWithDimension getXWaypoint() { - return xWaypoint; - } - - @Override - public void updateActiveWaypoint(Waypoint waypoint) { - if (!hasWaypoint() || waypoint.blockX != xWaypoint.getX() - || waypoint.blockY != xWaypoint.getY() - || waypoint.blockZ != xWaypoint.getZ() - || waypoint.dimensionId != xWaypoint.getDimID()) { - xWaypoint = new WaypointWithDimension( - waypoint.blockX, - waypoint.blockY, - waypoint.blockZ, - waypoint.label, - getSymbol(waypoint), - 15, - waypoint.dimensionId); - xWaypointTable.put(waypointType.ordinal(), xWaypoint); - } - } - - protected String getSymbol(Waypoint waypoint) { - return waypoint.label.substring(0, 1); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointType.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointType.java deleted file mode 100644 index 7a9e69f5..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap.waypoints; - -public enum WaypointType { - ORE_VEINS_WAYPOINT, - TC_NODES_WAYPOINT -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointWithDimension.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointWithDimension.java deleted file mode 100644 index d24c0e37..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaerominimap/waypoints/WaypointWithDimension.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaerominimap.waypoints; - -import xaero.common.minimap.waypoints.Waypoint; - -public class WaypointWithDimension extends Waypoint { - - private final int dimID; - private int currentDim; - - public WaypointWithDimension(int x, int y, int z, String name, String symbol, int color, int dimID) { - super(x, y, z, name, symbol, color); - this.dimID = dimID; - this.currentDim = dimID; - } - - public void notifyDimension(int newDimID) { - currentDim = newDimID; - } - - public int getDimID() { - return dimID; - } - - @Override - public boolean isDisabled() { - return super.isDisabled() || currentDim != dimID; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/XaeroWorldMapState.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/XaeroWorldMapState.java deleted file mode 100644 index f21f27bd..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/XaeroWorldMapState.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap; - -import static com.sinthoras.visualprospecting.Utils.isTCNodeTrackerInstalled; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.OreVeinButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.ThaumcraftNodeButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.UndergroundFluidButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.LayerRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.OreVeinRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.ThaumcraftNodeRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.UndergroundFluidChunkRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.UndergroundFluidRenderer; - -public class XaeroWorldMapState { - - public static XaeroWorldMapState instance = new XaeroWorldMapState(); - - public final List buttons = new ArrayList<>(); - public final List renderers = new ArrayList<>(); - - public XaeroWorldMapState() { - buttons.add(OreVeinButton.instance); - renderers.add(OreVeinRenderer.instance); - - buttons.add(UndergroundFluidButton.instance); - renderers.add(UndergroundFluidChunkRenderer.instance); - renderers.add(UndergroundFluidRenderer.instance); - - if (isTCNodeTrackerInstalled()) { - buttons.add(ThaumcraftNodeButton.instance); - renderers.add(ThaumcraftNodeRenderer.instance); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/LayerButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/LayerButton.java deleted file mode 100644 index 869e3acb..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/LayerButton.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons; - -import net.minecraft.util.ResourceLocation; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.buttons.ButtonManager; - -public class LayerButton extends com.sinthoras.visualprospecting.integration.model.buttons.LayerButton { - - private final ButtonManager manager; - private SizedGuiTexturedButton button; - - public final ResourceLocation textureLocation; - - public LayerButton(ButtonManager manager) { - super(manager, SupportedMods.XaeroWorldMap); - this.manager = manager; - textureLocation = new ResourceLocation("xaeroworldmap", "textures/" + getIconName() + ".png"); - } - - @Override - public void updateState(boolean active) { - if (button != null) { - button.setActive(active); - } - } - - public void setButton(SizedGuiTexturedButton button) { - this.button = button; - updateState(manager.isActive()); - } - - public String getButtonTextKey() { - return manager.getButtonTextKey(); - } - - public String getIconName() { - return manager.getIconName(); - } - - public void toggle() { - manager.toggle(); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/OreVeinButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/OreVeinButton.java deleted file mode 100644 index 952a3c17..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/OreVeinButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.OreVeinButtonManager; - -public class OreVeinButton extends LayerButton { - - public static final OreVeinButton instance = new OreVeinButton(); - - public OreVeinButton() { - super(OreVeinButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/SizedGuiTexturedButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/SizedGuiTexturedButton.java deleted file mode 100644 index 8498fbd3..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/SizedGuiTexturedButton.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons; - -import java.util.function.Consumer; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import xaero.map.gui.CursorBox; -import xaero.map.gui.GuiTexturedButton; - -public class SizedGuiTexturedButton extends GuiTexturedButton { - - private static final int BUTTON_WIDTH = 20; - private static final int BUTTON_HEIGHT = 20; - private static final int ICON_WIDTH = 16; - private static final int ICON_HEIGHT = 16; - - protected boolean active; - - public SizedGuiTexturedButton(int x, int y, ResourceLocation texture, Consumer action, - CursorBox tooltip) { - super(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, 0, 0, ICON_WIDTH, ICON_HEIGHT, texture, action, tooltip); - active = false; - } - - @Override - public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { - minecraft.getTextureManager().bindTexture(texture); - int iconX = xPosition + width / 2 - textureW / 2; - int iconY = yPosition + height / 2 - textureH / 2; - if (enabled) { - if (active) { - if (isMouseOver(mouseX, mouseY)) { - iconY--; - GL11.glColor4f(0.5F, 0.9F, 0.5F, 1.0F); - } else { - GL11.glColor4f(0.5882F, 0.9882F, 0.5882F, 1.0F); - } - } else { - if (isMouseOver(mouseX, mouseY)) { - iconY--; - GL11.glColor4f(0.9F, 0.9F, 0.9F, 1.0F); - } else { - GL11.glColor4f(0.9882F, 0.9882F, 0.9882F, 1.0F); - } - } - } else { - GL11.glColor4f(0.25F, 0.25F, 0.25F, 1.0F); - } - - Gui.func_146110_a(iconX, iconY, textureX, textureY, textureW, textureH, textureW, textureH); - } - - public boolean isMouseOver(int mouseX, int mouseY) { - return mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height; - } - - public void setActive(boolean active) { - this.active = active; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/ThaumcraftNodeButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/ThaumcraftNodeButton.java deleted file mode 100644 index ff065052..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/ThaumcraftNodeButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.ThaumcraftNodeButtonManager; - -public class ThaumcraftNodeButton extends LayerButton { - - public static final ThaumcraftNodeButton instance = new ThaumcraftNodeButton(); - - public ThaumcraftNodeButton() { - super(ThaumcraftNodeButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/UndergroundFluidButton.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/UndergroundFluidButton.java deleted file mode 100644 index a3155643..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/buttons/UndergroundFluidButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons; - -import com.sinthoras.visualprospecting.integration.model.buttons.UndergroundFluidButtonManager; - -public class UndergroundFluidButton extends LayerButton { - - public static final UndergroundFluidButton instance = new UndergroundFluidButton(); - - public UndergroundFluidButton() { - super(UndergroundFluidButtonManager.instance); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/InteractableLayerRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/InteractableLayerRenderer.java deleted file mode 100644 index 14ada20a..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/InteractableLayerRenderer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers; - -import java.util.List; - -import net.minecraft.client.gui.GuiScreen; - -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.InteractableRenderStep; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.RenderStep; - -public abstract class InteractableLayerRenderer extends LayerRenderer { - - private double mouseX; - private double mouseY; - protected WaypointProviderManager manager; - protected InteractableRenderStep hovered; - - public InteractableLayerRenderer(WaypointProviderManager manager) { - super(manager); - this.manager = manager; - hovered = null; - } - - @Override - protected abstract List generateRenderSteps( - List visibleElements); - - public void updateHovered(double mouseX, double mouseY, double scale) { - this.mouseX = mouseX; - this.mouseY = mouseY; - for (RenderStep step : renderStepsReversed) { - if (step instanceof InteractableRenderStep - && ((InteractableRenderStep) step).isMouseOver(mouseX, mouseY, scale)) { - hovered = (InteractableRenderStep) step; - return; - } - } - hovered = null; - } - - public void drawTooltip(GuiScreen gui, double scale, int scaleAdj) { - if (hovered != null) { - hovered.drawTooltip(gui, mouseX, mouseY, scale, scaleAdj); - } - } - - public void doActionKeyPress() { - if (manager.isLayerActive() && hovered != null) { - hovered.onActionButton(); - manager.forceRefresh(); - } - } - - public void doDoubleClick() { - if (hovered != null) { - if (hovered.getLocationProvider().isActiveAsWaypoint()) { - manager.clearActiveWaypoint(); - } else { - manager.setActiveWaypoint(hovered.getLocationProvider().toWaypoint()); - } - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/LayerRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/LayerRenderer.java deleted file mode 100644 index cd0edc47..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/LayerRenderer.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.model.SupportedMods; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.RenderStep; - -public abstract class LayerRenderer extends com.sinthoras.visualprospecting.integration.model.layers.LayerRenderer { - - private final LayerManager manager; - protected List renderSteps = new ArrayList<>(); - protected List renderStepsReversed = new ArrayList<>(); - - public LayerRenderer(LayerManager manager) { - super(manager, SupportedMods.XaeroWorldMap); - this.manager = manager; - } - - public List getRenderSteps() { - return renderSteps; - } - - public List getRenderStepsReversed() { - return renderStepsReversed; - } - - public boolean isLayerActive() { - return manager.isLayerActive(); - } - - @Override - public void updateVisibleElements(List visibleElements) { - // noinspection unchecked - renderSteps = (List) generateRenderSteps(visibleElements); - renderStepsReversed = new ArrayList<>(renderSteps); - Collections.reverse(renderStepsReversed); - } - - protected abstract List generateRenderSteps( - List visibleElements); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/ThaumcraftNodeRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/ThaumcraftNodeRenderer.java deleted file mode 100644 index a511fee0..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/ThaumcraftNodeRenderer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers; - -import java.util.ArrayList; -import java.util.List; - -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.ThaumcraftNodeLocation; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.ThaumcraftNodeRenderStep; - -public class ThaumcraftNodeRenderer extends InteractableLayerRenderer { - - public static ThaumcraftNodeRenderer instance = new ThaumcraftNodeRenderer(); - - public ThaumcraftNodeRenderer() { - super(ThaumcraftNodeLayerManager.instance); - } - - @Override - protected List generateRenderSteps(List visibleElements) { - final List renderSteps = new ArrayList<>(); - visibleElements.stream().map(element -> (ThaumcraftNodeLocation) element) - .forEach(location -> renderSteps.add(new ThaumcraftNodeRenderStep(location))); - return renderSteps; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/OreVeinRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroOreVeinRenderer.java similarity index 63% rename from src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/OreVeinRenderer.java rename to src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroOreVeinRenderer.java index 53f5d261..e3c4be11 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/OreVeinRenderer.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroOreVeinRenderer.java @@ -3,17 +3,16 @@ import java.util.ArrayList; import java.util.List; -import com.sinthoras.visualprospecting.integration.model.layers.OreVeinLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.layers.InteractableLayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.xaero.renderers.XaeroInteractableLayerRenderer; import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.OreVeinRenderStep; -public class OreVeinRenderer extends InteractableLayerRenderer { +public class XaeroOreVeinRenderer extends XaeroInteractableLayerRenderer { - public static OreVeinRenderer instance = new OreVeinRenderer(); - - public OreVeinRenderer() { - super(OreVeinLayerManager.instance); + public XaeroOreVeinRenderer(InteractableLayerManager manager) { + super(manager); } @Override diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidChunkRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidChunkRenderer.java similarity index 64% rename from src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidChunkRenderer.java rename to src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidChunkRenderer.java index 7b46e3c7..80c35436 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidChunkRenderer.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidChunkRenderer.java @@ -3,17 +3,16 @@ import java.util.ArrayList; import java.util.List; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidChunkLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.xaero.renderers.XaeroLayerRenderer; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidChunkLocation; import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.UndergroundFluidChunkRenderStep; -public class UndergroundFluidChunkRenderer extends LayerRenderer { +public class XaeroUndergroundFluidChunkRenderer extends XaeroLayerRenderer { - public static UndergroundFluidChunkRenderer instance = new UndergroundFluidChunkRenderer(); - - public UndergroundFluidChunkRenderer() { - super(UndergroundFluidChunkLayerManager.instance); + public XaeroUndergroundFluidChunkRenderer(LayerManager manager) { + super(manager); } @Override diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidRenderer.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidRenderer.java similarity index 64% rename from src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidRenderer.java rename to src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidRenderer.java index 8883a833..2d4e7e03 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/UndergroundFluidRenderer.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/renderers/XaeroUndergroundFluidRenderer.java @@ -3,17 +3,16 @@ import java.util.ArrayList; import java.util.List; -import com.sinthoras.visualprospecting.integration.model.layers.UndergroundFluidLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.model.layers.LayerManager; +import com.gtnewhorizons.navigator.api.model.locations.ILocationProvider; +import com.gtnewhorizons.navigator.api.xaero.renderers.XaeroLayerRenderer; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidLocation; import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.UndergroundFluidRenderStep; -public class UndergroundFluidRenderer extends LayerRenderer { +public class XaeroUndergroundFluidRenderer extends XaeroLayerRenderer { - public static UndergroundFluidRenderer instance = new UndergroundFluidRenderer(); - - public UndergroundFluidRenderer() { - super(UndergroundFluidLayerManager.instance); + public XaeroUndergroundFluidRenderer(LayerManager manager) { + super(manager); } @Override diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/InteractableRenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/InteractableRenderStep.java deleted file mode 100644 index 0a5e1856..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/InteractableRenderStep.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps; - -import net.minecraft.client.gui.GuiScreen; - -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; - -public interface InteractableRenderStep extends RenderStep { - - boolean isMouseOver(double mouseX, double mouseY, double scale); - - void drawTooltip(GuiScreen gui, double mouseX, double mouseY, double scale, int scaleAdj); - - void onActionButton(); - - IWaypointAndLocationProvider getLocationProvider(); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/OreVeinRenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/OreVeinRenderStep.java index c31b0918..53bb6b02 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/OreVeinRenderStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/OreVeinRenderStep.java @@ -1,6 +1,5 @@ package com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps; -import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; @@ -14,14 +13,15 @@ import org.lwjgl.opengl.GL11; +import com.gtnewhorizons.navigator.api.model.locations.IWaypointAndLocationProvider; +import com.gtnewhorizons.navigator.api.util.DrawUtils; +import com.gtnewhorizons.navigator.api.xaero.rendersteps.XaeroInteractableStep; import com.sinthoras.visualprospecting.Config; import com.sinthoras.visualprospecting.Tags; import com.sinthoras.visualprospecting.Utils; -import com.sinthoras.visualprospecting.integration.DrawUtils; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; import com.sinthoras.visualprospecting.integration.model.locations.OreVeinLocation; -public class OreVeinRenderStep implements InteractableRenderStep { +public class OreVeinRenderStep implements XaeroInteractableStep { private final OreVeinLocation oreVeinLocation; private final ResourceLocation depletedTextureLocation = new ResourceLocation(Tags.MODID, "textures/depleted.png"); @@ -139,32 +139,27 @@ public boolean isMouseOver(double mouseX, double mouseY, double scale) { } @Override - public void drawTooltip(GuiScreen gui, double mouseX, double mouseY, double scale, int scaleAdj) { - // correct for gl matrix differences - mouseX = mouseX * scale + (gui.mc.displayWidth >> 1); - mouseY = mouseY * scale + (gui.mc.displayHeight >> 1); - - final List tooltip = new ArrayList<>(); + public void getTooltip(List list) { if (oreVeinLocation.isDepleted()) { - tooltip.add(oreVeinLocation.getDepletedHint()); + list.add(oreVeinLocation.getDepletedHint()); } + if (oreVeinLocation.isActiveAsWaypoint()) { - tooltip.add(oreVeinLocation.getActiveWaypointHint()); + list.add(oreVeinLocation.getActiveWaypointHint()); } - tooltip.add(oreVeinLocation.getName()); - if (!oreVeinLocation.isDepleted()) { - tooltip.addAll(oreVeinLocation.getMaterialNames()); - } - tooltip.add(oreVeinLocation.getToggleDepletedHint()); - GL11.glPushMatrix(); + list.add(oreVeinLocation.getName()); - DrawUtils - .drawSimpleTooltip(gui, tooltip, mouseX / scaleAdj + 6, mouseY / scaleAdj - 12, 0xFFFFFFFF, 0x86000000); + if (!oreVeinLocation.isDepleted()) { + list.addAll(oreVeinLocation.getMaterialNames()); + } - GL11.glPopMatrix(); + list.add(oreVeinLocation.getToggleDepletedHint()); } + @Override + public void drawCustomTooltip(GuiScreen gui, double mouseX, double mouseY, double scale, int scaleAdj) {} + @Override public void onActionButton() { oreVeinLocation.toggleOreVein(); diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/RenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/RenderStep.java deleted file mode 100644 index 2c4be5ca..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/RenderStep.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps; - -import javax.annotation.Nullable; - -import net.minecraft.client.gui.GuiScreen; - -public interface RenderStep { - - void draw(@Nullable GuiScreen gui, double cameraX, double cameraZ, double scale); -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/ThaumcraftNodeRenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/ThaumcraftNodeRenderStep.java deleted file mode 100644 index 3a47c484..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/ThaumcraftNodeRenderStep.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps; - -import javax.annotation.Nullable; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import com.sinthoras.visualprospecting.Tags; -import com.sinthoras.visualprospecting.integration.DrawUtils; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.locations.IWaypointAndLocationProvider; -import com.sinthoras.visualprospecting.integration.model.locations.ThaumcraftNodeLocation; - -import thaumcraft.api.aspects.Aspect; -import thaumcraft.client.lib.UtilsFX; - -public class ThaumcraftNodeRenderStep implements InteractableRenderStep { - - private static final ResourceLocation markedTextureLocation = new ResourceLocation( - Tags.MODID, - "textures/node_marked.png"); - private static final ResourceLocation unmarkedTextureLocation = new ResourceLocation( - Tags.MODID, - "textures/node_unmarked.png"); - - private final ThaumcraftNodeLocation thaumcraftNodeLocation; - - private double centerPixelX = 0; - private double centerPixelY = 0; - private double clickableRadiusPixelSquared = 0; - - public ThaumcraftNodeRenderStep(ThaumcraftNodeLocation thaumcraftNodeLocation) { - this.thaumcraftNodeLocation = thaumcraftNodeLocation; - } - - @Override - public void draw(@Nullable GuiScreen gui, double cameraX, double cameraZ, double scale) { - final double borderSize = 44; - final double borderSizeHalf = borderSize / 2; - final double scaleForGui = Math.max(0.5, scale); - centerPixelX = (thaumcraftNodeLocation.getBlockX() - cameraX) * scaleForGui; - centerPixelY = (thaumcraftNodeLocation.getBlockZ() - cameraZ) * scaleForGui; - clickableRadiusPixelSquared = borderSizeHalf * borderSizeHalf; - - GL11.glPushMatrix(); - GL11.glTranslated( - thaumcraftNodeLocation.getBlockX() - cameraX, - thaumcraftNodeLocation.getBlockZ() - cameraZ, - 0); - GL11.glScaled(1 / scaleForGui, 1 / scaleForGui, 1); - - final int alpha = 204; - DrawUtils.drawQuad( - thaumcraftNodeLocation.isActiveAsWaypoint() ? markedTextureLocation : unmarkedTextureLocation, - -borderSizeHalf, - -borderSizeHalf, - borderSize, - borderSize, - 0xFFFFFF, - alpha); - - final int aspectPixelDiameter = 32; - DrawUtils.drawAspect(0, 0, aspectPixelDiameter, thaumcraftNodeLocation.getStrongestAspect(), 0); - - GL11.glPopMatrix(); - } - - @Override - public boolean isMouseOver(double mouseX, double mouseY, double scale) { - final double scaleForGui = Math.max(0.5, scale); - final double deltaX = mouseX * scaleForGui - centerPixelX; - final double deltaY = mouseY * scaleForGui - centerPixelY; - return deltaX * deltaX + deltaY * deltaY <= clickableRadiusPixelSquared; - } - - @Override - public void drawTooltip(GuiScreen gui, double mouseX, double mouseY, double scale, int scaleAdj) { - - GL11.glPushMatrix(); - - mouseX = (mouseX * scale + (gui.mc.displayWidth >> 1)) / scaleAdj; - mouseY = (mouseY * scale + (gui.mc.displayHeight >> 1)) / scaleAdj; - - final boolean isWaypoint = thaumcraftNodeLocation.isActiveAsWaypoint(); - final String asWaypoint = thaumcraftNodeLocation.getActiveWaypointHint(); - final String title = thaumcraftNodeLocation.getTitle(); - final String nodeDescription = thaumcraftNodeLocation.getDescription(); - final String deleteHint = thaumcraftNodeLocation.getDeleteHint(); - - int maxTextWidth = Math.max( - Math.max( - gui.mc.fontRenderer.getStringWidth(title), - gui.mc.fontRenderer.getStringWidth(nodeDescription)), - gui.mc.fontRenderer.getStringWidth(deleteHint)); - if (isWaypoint) { - maxTextWidth = Math.max(maxTextWidth, gui.mc.fontRenderer.getStringWidth(asWaypoint)); - } - if (gui.mc.fontRenderer.getBidiFlag()) { - maxTextWidth = (int) Math.ceil(maxTextWidth * 1.25f); - } - - final int aspectRows = (thaumcraftNodeLocation.getAspects().size() + 4) / 5; // Equivalent to Math.ceil(size / - // 5) - final int aspectColumns = Math.min(thaumcraftNodeLocation.getAspects().size(), 5); - - int pixelX = (int) (mouseX + 12); - int pixelY = (int) (mouseY - 12); - final int tooltipHeight = (isWaypoint ? 44 : 32) + aspectRows * 16; - final int tooltipWidth = Math.max(aspectColumns * 16, maxTextWidth); - if (pixelX + tooltipWidth > gui.mc.displayWidth) { - pixelX -= 28 + tooltipWidth; - } - if (pixelY + tooltipHeight + 6 > gui.mc.displayHeight) { - pixelY = gui.mc.displayHeight - tooltipHeight - 6; - } - - GL11.glDisable(GL11.GL_DEPTH_TEST); - - // Draw background - final int backgroundColor = 0xF0100010; - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 4, - pixelX + tooltipWidth + 3, - pixelY - 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY + tooltipHeight + 3, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 4, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 3, - pixelY - 3, - pixelX + tooltipWidth + 3, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX - 4, - pixelY - 3, - pixelX - 3, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - DrawUtils.drawGradientRect( - pixelX + tooltipWidth + 3, - pixelY - 3, - pixelX + tooltipWidth + 4, - pixelY + tooltipHeight + 3, - backgroundColor, - backgroundColor); - - // Draw text - int offset = 0; - if (gui.mc.fontRenderer.getBidiFlag()) { - if (isWaypoint) { - final int asWaypointWidth = (int) Math.ceil(gui.mc.fontRenderer.getStringWidth(asWaypoint) * 1.1f); - gui.mc.fontRenderer.drawString(title, pixelX + tooltipWidth - asWaypointWidth, pixelY, 0xFFFFFFFF); - offset += 12; - } - final int titleWidth = (int) Math.ceil(gui.mc.fontRenderer.getStringWidth(title) * 1.1f); - gui.mc.fontRenderer.drawString(title, pixelX + tooltipWidth - titleWidth, pixelY + offset, 0xFFFFFFFF); - offset += 12; - final int nodeDescriptonWidth = (int) Math.ceil(gui.mc.fontRenderer.getStringWidth(nodeDescription) * 1.1f); - gui.mc.fontRenderer.drawString( - nodeDescription, - pixelX + nodeDescriptonWidth - titleWidth, - pixelY + offset, - 0xFFFFFFFF); - - final int deleteHintWidth = (int) Math.ceil(gui.mc.fontRenderer.getStringWidth(deleteHint) * 1.1f); - gui.mc.fontRenderer.drawString( - deleteHint, - pixelX + tooltipWidth - deleteHintWidth, - pixelY + aspectRows * 16 + offset + 12, - 0xFFFFFFFF); - } else { - if (isWaypoint) { - gui.mc.fontRenderer.drawString(asWaypoint, pixelX, pixelY, 0xFFFFFFFF); - offset += 12; - } - gui.mc.fontRenderer.drawString(title, pixelX, pixelY + offset, 0xFFFFFFFF); - offset += 12; - gui.mc.fontRenderer.drawString(nodeDescription, pixelX, pixelY + offset, 0xFFFFFFFF); - - gui.mc.fontRenderer.drawString(deleteHint, pixelX, pixelY + aspectRows * 16 + offset + 12, 0xFFFFFFFF); - } - - // Draw aspects - int aspectX = 0; - int aspectY = 0; - - for (Aspect aspect : thaumcraftNodeLocation.getAspects().getAspectsSortedAmount()) { - GL11.glPushMatrix(); - UtilsFX.drawTag( - pixelX + aspectX * 16, - pixelY + aspectY * 16 + offset + 10, - aspect, - thaumcraftNodeLocation.getAspects().getAmount(aspect), - 0, - 0.01, - 1, - 1, - false); - GL11.glPopMatrix(); - ++aspectX; - if (aspectX >= 5) { - aspectX = 0; - ++aspectY; - } - } - - GL11.glDisable(GL11.GL_LIGHTING); - - GL11.glPopMatrix(); - } - - @Override - public void onActionButton() { - ThaumcraftNodeLayerManager.instance.deleteNode(thaumcraftNodeLocation); - } - - @Override - public IWaypointAndLocationProvider getLocationProvider() { - return thaumcraftNodeLocation; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidChunkRenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidChunkRenderStep.java index 47e477ef..0dc58c99 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidChunkRenderStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidChunkRenderStep.java @@ -6,13 +6,14 @@ import org.lwjgl.opengl.GL11; +import com.gtnewhorizons.navigator.api.util.DrawUtils; +import com.gtnewhorizons.navigator.api.xaero.rendersteps.XaeroRenderStep; import com.sinthoras.visualprospecting.Config; import com.sinthoras.visualprospecting.Utils; import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.DrawUtils; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidChunkLocation; -public class UndergroundFluidChunkRenderStep implements RenderStep { +public class UndergroundFluidChunkRenderStep implements XaeroRenderStep { private final UndergroundFluidChunkLocation undergroundFluidChunkLocation; diff --git a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidRenderStep.java b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidRenderStep.java index 507031b6..64cbe4ca 100644 --- a/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidRenderStep.java +++ b/src/main/java/com/sinthoras/visualprospecting/integration/xaeroworldmap/rendersteps/UndergroundFluidRenderStep.java @@ -7,11 +7,12 @@ import org.lwjgl.opengl.GL11; +import com.gtnewhorizons.navigator.api.util.DrawUtils; +import com.gtnewhorizons.navigator.api.xaero.rendersteps.XaeroRenderStep; import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.DrawUtils; import com.sinthoras.visualprospecting.integration.model.locations.UndergroundFluidLocation; -public class UndergroundFluidRenderStep implements RenderStep { +public class UndergroundFluidRenderStep implements XaeroRenderStep { private final UndergroundFluidLocation undergroundFluidLocation; diff --git a/src/main/java/com/sinthoras/visualprospecting/mixinplugin/Mixins.java b/src/main/java/com/sinthoras/visualprospecting/mixinplugin/Mixins.java index a95efcdd..8ec8c144 100644 --- a/src/main/java/com/sinthoras/visualprospecting/mixinplugin/Mixins.java +++ b/src/main/java/com/sinthoras/visualprospecting/mixinplugin/Mixins.java @@ -22,26 +22,8 @@ public enum Mixins { GT_MetaTileEntity_ScannerMixin("gregtech.GT_MetaTileEntity_ScannerMixin", GT5U), GT_WorldGenContainerMixin("gregtech.WorldGenContainerMixin", GT5U), - // Journeymap mixins - DisplayVarsAccessorMixin("journeymap.DisplayVarsAccessor", Side.CLIENT, JOURNEYMAP), - FullscreenAccessorMixin("journeymap.FullscreenAccessor", Side.CLIENT, JOURNEYMAP), - FullscreenMixin("journeymap.FullscreenMixin", Side.CLIENT, JOURNEYMAP), - FullscreenActionsMixin("journeymap.FullscreenActionsMixin", Side.CLIENT, JOURNEYMAP), - MiniMapMixin("journeymap.MiniMapMixin", Side.CLIENT, JOURNEYMAP), - RenderWaypointBeaconMixin("journeymap.RenderWaypointBeaconMixin", Side.CLIENT, JOURNEYMAP), - WaypointManagerMixin("journeymap.WaypointManagerMixin", Side.CLIENT, JOURNEYMAP), - - // TC node tracker mixins - GuiMainMixin("tcnodetracker.GuiMainMixin", Side.CLIENT, TCNODETRACKER), - - // Xaerosworldmap & Xaerosminimap mixins - GuiMapMixin("xaerosworldmap.GuiMapMixin", Side.CLIENT, XAEROWORLDMAP), - WaypointsIngameRendererMixin("xaerosminimap.WaypointsIngameRendererMixin", Side.CLIENT, XAEROMINIMAP), - MinimapRendererMixin("xaerosminimap.MinimapRendererMixin", Side.CLIENT, XAEROMINIMAP, XAEROWORLDMAP), - // Vanilla Mixins MinecraftServerAccessorMixin("minecraft.MinecraftServerAccessor", Phase.EARLY, Side.BOTH, VANILLA), - ForgeHooksClientMixin("minecraft.ForgeHooksClientMixin", Phase.EARLY, Side.CLIENT, XAEROMINIMAP, XAEROWORLDMAP), ItemEditableBookMixin("minecraft.ItemEditableBookMixin", Phase.EARLY, VANILLA); public final String mixinClass; diff --git a/src/main/java/com/sinthoras/visualprospecting/mixinplugin/TargetedMod.java b/src/main/java/com/sinthoras/visualprospecting/mixinplugin/TargetedMod.java index 3297d630..454bac18 100644 --- a/src/main/java/com/sinthoras/visualprospecting/mixinplugin/TargetedMod.java +++ b/src/main/java/com/sinthoras/visualprospecting/mixinplugin/TargetedMod.java @@ -5,11 +5,7 @@ public enum TargetedMod { BARTWORKS("BartWorks", "com.github.bartimaeusnek.bartworks.ASM.BWCorePlugin", "bartworks"), GALACTICGREG("Galactic Greg", null, "galacticgreg"), GT5U("GregTech5u", null, "gregtech"), // Also matches GT6. - JOURNEYMAP("JourneyMap", null, "journeymap"), - TCNODETRACKER("TC Node Tracker", null, "tcnodetracker"), - VANILLA("Minecraft", null), - XAEROMINIMAP("Xaero's Minimap", "xaero.common.core.XaeroMinimapPlugin", "XaeroMinimap"), - XAEROWORLDMAP("Xaero's World Map", "xaero.map.core.XaeroWorldMapPlugin", "XaeroWorldMap"); + VANILLA("Minecraft", null); /** The "name" in the @Mod annotation */ public final String modName; diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/early/minecraft/ForgeHooksClientMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/early/minecraft/ForgeHooksClientMixin.java deleted file mode 100644 index 7969a83d..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/early/minecraft/ForgeHooksClientMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.early.minecraft; - -import net.minecraftforge.client.ForgeHooksClient; - -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; - -// used to enable the stencil buffer for on-minimap rendering -@Mixin(value = ForgeHooksClient.class, remap = false) -public class ForgeHooksClientMixin { - - // this is only a mixin because it needs to run before the minecraft window is created - @Inject(method = "createDisplay", at = @At("HEAD")) - private static void visualprospecting$enableStencilBuffer(CallbackInfo ci) { - // give me my stencil buffer, forge. - System.setProperty("forge.forceDisplayStencil", "true"); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/DisplayVarsAccessor.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/DisplayVarsAccessor.java deleted file mode 100644 index c4d1ba06..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/DisplayVarsAccessor.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import journeymap.client.ui.minimap.DisplayVars; -import journeymap.client.ui.minimap.Shape; - -@Mixin(DisplayVars.class) -public interface DisplayVarsAccessor { - - @Accessor(remap = false) - float getDrawScale(); - - @Accessor(remap = false) - double getFontScale(); - - @Accessor(remap = false) - Shape getShape(); - - @Accessor(remap = false) - int getMinimapWidth(); - -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenAccessor.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenAccessor.java deleted file mode 100644 index 823ed72b..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenAccessor.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import journeymap.client.render.map.GridRenderer; -import journeymap.client.ui.fullscreen.Fullscreen; - -@Mixin(Fullscreen.class) -public interface FullscreenAccessor { - - @Accessor(remap = false) - static GridRenderer getGridRenderer() { - throw new IllegalStateException("Mixin accessor failed to apply"); - } - -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenActionsMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenActionsMixin.java deleted file mode 100644 index c4eccd06..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenActionsMixin.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.resources.I18n; - -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.LocalCapture; - -import com.sinthoras.visualprospecting.integration.journeymap.ResetClientCacheConfirmation; - -import journeymap.client.ui.UIManager; -import journeymap.client.ui.component.Button; -import journeymap.client.ui.component.ButtonList; -import journeymap.client.ui.component.JmUI; -import journeymap.client.ui.dialog.FullscreenActions; - -@Mixin(FullscreenActions.class) -public abstract class FullscreenActionsMixin extends JmUI { - - @Shadow(remap = false) - Button buttonAbout; - - private Button resetVisualProspectingCacheButton; - - public FullscreenActionsMixin() { - super(""); - } - - @Inject( - method = "func_73866_w_", - at = @At(value = "INVOKE", target = "Ljourneymap/client/ui/component/Button;setDrawFrame(Z)V"), - remap = false, - require = 1) - private void visualprospecting$onInitGui(CallbackInfo ci) { - resetVisualProspectingCacheButton = new Button(I18n.format("visualprospecting.button.resetprogress")); - resetVisualProspectingCacheButton.setTooltip(I18n.format("visualprospecting.button.resetprogress.tooltip")); - buttonList.add(resetVisualProspectingCacheButton); - } - - @Inject(method = "layoutButtons", at = @At("RETURN"), remap = false, require = 1) - private void visualprospecting$onLayoutButtons(CallbackInfo ci) { - final ButtonList row = new ButtonList(buttonAbout, resetVisualProspectingCacheButton); - row.layoutCenteredHorizontal(width / 2, height / 4, true, 4); - } - - @Inject( - method = "func_146284_a", - at = @At("HEAD"), - remap = false, - cancellable = true, - require = 1, - locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void visualprospecting$onButtonClicked(GuiButton guibutton, CallbackInfo ci) { - if (guibutton == resetVisualProspectingCacheButton) { - UIManager.getInstance().open(ResetClientCacheConfirmation.class); - ci.cancel(); - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenMixin.java deleted file mode 100644 index 1cc9af4c..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/FullscreenMixin.java +++ /dev/null @@ -1,319 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.RenderHelper; - -import org.apache.logging.log4j.Level; -import org.lwjgl.input.Mouse; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -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.LocalCapture; - -import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.journeymap.JourneyMapState; -import com.sinthoras.visualprospecting.integration.journeymap.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.journeymap.render.LayerRenderer; -import com.sinthoras.visualprospecting.integration.journeymap.render.WaypointProviderLayerRenderer; -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; - -import journeymap.client.Constants; -import journeymap.client.io.ThemeFileHandler; -import journeymap.client.log.LogFormatter; -import journeymap.client.log.StatTimer; -import journeymap.client.model.BlockCoordIntPair; -import journeymap.client.render.map.GridRenderer; -import journeymap.client.ui.UIManager; -import journeymap.client.ui.component.Button; -import journeymap.client.ui.component.ButtonList; -import journeymap.client.ui.component.JmUI; -import journeymap.client.ui.fullscreen.Fullscreen; -import journeymap.client.ui.fullscreen.MapChat; -import journeymap.client.ui.fullscreen.layer.LayerDelegate; -import journeymap.client.ui.theme.Theme; -import journeymap.client.ui.theme.ThemeButton; -import journeymap.client.ui.theme.ThemeToggle; -import journeymap.client.ui.theme.ThemeToolbar; - -@Mixin(value = Fullscreen.class, remap = false) -public abstract class FullscreenMixin extends JmUI { - - @Unique - private int oldMouseX = 0; - @Unique - private int oldMouseY = 0; - @Unique - private long timeLastClick = 0; - - @Final - @Shadow - static GridRenderer gridRenderer; - - @Shadow - ThemeToolbar mapTypeToolbar; - - @Shadow - ThemeButton buttonCaves; - - @Shadow - ThemeButton buttonNight; - - @Shadow - ThemeButton buttonDay; - - @Shadow - StatTimer drawScreenTimer; - - @Shadow() - MapChat chat; - - @Final - @Shadow - LayerDelegate layerDelegate; - - @Shadow - boolean firstLayoutPass; - - @Shadow - int mx; - - @Shadow - int my; - - public FullscreenMixin() { - super(""); - } - - @Inject(method = "*", at = @At("RETURN"), require = 1) - private void visualprospecting$init(CallbackInfo ci) { - MapState.instance.layers.forEach(LayerManager::forceRefresh); - } - - @Shadow - private int getMapFontScale() { - throw new IllegalStateException("Mixin failed to shadow getMapFontScale()"); - } - - @Shadow - void drawMap() { - throw new IllegalStateException("Mixin failed to shadow drawMap()"); - } - - @Shadow - public abstract void drawBackground(int layer); - - @Inject(method = "*", at = @At("RETURN"), require = 1) - private void visualprospecting$onConstructed(CallbackInfo ci) { - MapState.instance.layers.forEach(LayerManager::onOpenMap); - } - - @Inject( - method = "drawMap", - at = @At( - value = "INVOKE", - target = "Ljourneymap/client/model/MapState;getDrawWaypointSteps()Ljava/util/List;"), - remap = false, - require = 1, - locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void visualprospecting$onBeforeDrawJourneyMapWaypoints(CallbackInfo ci, boolean refreshReady, - StatTimer timer, int xOffset, int yOffset, float drawScale) { - final int fontScale = getMapFontScale(); - final Minecraft minecraft = Minecraft.getMinecraft(); - final int centerBlockX = (int) Math.round(gridRenderer.getCenterBlockX()); - final int centerBlockZ = (int) Math.round(gridRenderer.getCenterBlockZ()); - final int widthBlocks = minecraft.displayWidth >> gridRenderer.getZoom(); - final int heightBlocks = minecraft.displayHeight >> gridRenderer.getZoom(); - for (LayerManager layerManager : MapState.instance.layers) { - if (layerManager.isLayerActive()) { - layerManager.recacheFullscreenMap(centerBlockX, centerBlockZ, widthBlocks, heightBlocks); - } - } - - for (LayerRenderer layerRenderer : JourneyMapState.instance.renderers) { - if (layerRenderer.isLayerActive()) { - gridRenderer.draw( - layerRenderer.getDrawStepsCachedForRendering(), - xOffset, - yOffset, - drawScale, - fontScale, - 0.0); - } - } - } - - @Redirect( - method = "initButtons", - at = @At( - value = "FIELD", - target = "Ljourneymap/client/ui/fullscreen/Fullscreen;mapTypeToolbar:Ljourneymap/client/ui/theme/ThemeToolbar;", - opcode = Opcodes.PUTFIELD), - require = 1) - private void visualprospecting$OnCreateMapTypeToolbar(Fullscreen owner, ThemeToolbar value) { - final Theme theme = ThemeFileHandler.getCurrentTheme(); - final ButtonList buttonList = new ButtonList(); - - for (LayerButton layerButton : JourneyMapState.instance.buttons) { - final ThemeToggle button = new ThemeToggle( - theme, - layerButton.getButtonTextKey(), - layerButton.getIconName()); - layerButton.setButton(button); - button.setToggled(layerButton.isActive(), false); - button.addToggleListener((unused, toggled) -> { - layerButton.toggle(); - return true; - }); - buttonList.add(button); - } - - buttonList.add(buttonCaves); - buttonList.add(buttonNight); - buttonList.add(buttonDay); - mapTypeToolbar = new ThemeToolbar(theme, buttonList); - } - - @Override - public void drawScreen(int width, int height, float f) { - try { - drawBackground(0); - drawMap(); - drawScreenTimer.start(); - layoutButtons(); - List tooltip = null; - if (firstLayoutPass) { - layoutButtons(); - firstLayoutPass = false; - } else { - for (int k = 0; k < buttonList.size(); ++k) { - GuiButton guibutton = buttonList.get(k); - guibutton.drawButton(mc, width, height); - if (tooltip == null && guibutton instanceof Button) { - Button button = (Button) guibutton; - if (button.mouseOver(mx, my)) { - tooltip = button.getTooltip(); - } - } - } - } - - final int scaledMouseX = (mx * mc.displayWidth) / this.width; - final int scaledMouseY = (my * mc.displayHeight) / this.height; - for (LayerRenderer layer : JourneyMapState.instance.renderers) { - if (layer instanceof WaypointProviderLayerRenderer) { - final WaypointProviderLayerRenderer waypointProviderLayer = (WaypointProviderLayerRenderer) layer; - waypointProviderLayer.onMouseMove(scaledMouseX, scaledMouseY); - } - } - - if (tooltip == null) { - for (LayerRenderer layer : JourneyMapState.instance.renderers) { - if (layer instanceof WaypointProviderLayerRenderer) { - final WaypointProviderLayerRenderer waypointProviderLayer = (WaypointProviderLayerRenderer) layer; - if (waypointProviderLayer.isLayerActive()) { - tooltip = waypointProviderLayer.getTextTooltip(); - } - } - } - } - - if (chat != null) { - chat.drawScreen(width, height, f); - } - - if (tooltip != null && !tooltip.isEmpty()) { - drawHoveringText(tooltip, mx, my, getFontRenderer()); - RenderHelper.disableStandardItemLighting(); - } else { - for (LayerRenderer layer : JourneyMapState.instance.renderers) { - if (layer instanceof WaypointProviderLayerRenderer) { - final WaypointProviderLayerRenderer waypointProviderLayer = (WaypointProviderLayerRenderer) layer; - if (waypointProviderLayer.isLayerActive()) { - waypointProviderLayer.drawCustomTooltip(getFontRenderer(), mx, my, this.width, this.height); - } - } - } - } - - } catch (Throwable var11) { - logger.log( - Level.ERROR, - "Unexpected exception in jm.fullscreen.drawScreen(): " + LogFormatter.toString(var11)); - UIManager.getInstance().closeAll(); - } finally { - drawScreenTimer.stop(); - } - } - - @Inject(method = "keyTyped", at = @At(value = "HEAD"), remap = true, require = 1, cancellable = true) - private void visualprospecting$onKeyPress(CallbackInfo ci) { - if ((chat == null || chat.isHidden()) && Constants.isPressed(VP.keyAction)) { - for (LayerRenderer layer : JourneyMapState.instance.renderers) { - if (layer instanceof WaypointProviderLayerRenderer) { - ((WaypointProviderLayerRenderer) layer).onActionKeyPressed(); - } - } - ci.cancel(); - } - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { - if (chat != null && !chat.isHidden()) { - chat.mouseClicked(mouseX, mouseY, mouseButton); - } - - super.mouseClicked(mouseX, mouseY, mouseButton); - if (!this.isMouseOverButton(mouseX, mouseY)) { - final int scaledMouseX = mx * mc.displayWidth / width; - final int scaledMouseY = my * mc.displayHeight / height; - final double blockSize = Math.pow(2.0D, gridRenderer.getZoom()); - BlockCoordIntPair blockCoord = gridRenderer - .getBlockUnderMouse(Mouse.getEventX(), Mouse.getEventY(), mc.displayWidth, mc.displayHeight); - if (!visualprospecting$onMapClicked(mouseButton, scaledMouseX, scaledMouseY, blockSize, blockCoord)) { - layerDelegate.onMouseClicked( - mc, - Mouse.getEventX(), - Mouse.getEventY(), - gridRenderer.getWidth(), - gridRenderer.getHeight(), - blockCoord, - mouseButton); - } - } - } - - private boolean visualprospecting$onMapClicked(int mouseButton, int mouseX, int mouseY, double blockSize, - BlockCoordIntPair blockCoord) { - final long timestamp = System.currentTimeMillis(); - final boolean isDoubleClick = mouseX == oldMouseX && mouseY == oldMouseY && timestamp - timeLastClick < 500; - oldMouseX = mouseX; - oldMouseY = mouseY; - timeLastClick = isDoubleClick ? 0 : timestamp; - if (mouseButton != 0) { - return false; - } - boolean layerHit = false; - boolean clickOutside = false; - for (LayerRenderer layer : JourneyMapState.instance.renderers) { - if (layer instanceof WaypointProviderLayerRenderer wpLayerRender) { - wpLayerRender.onMouseMove(mouseX, mouseY); - layerHit |= wpLayerRender.onMouseAction(isDoubleClick); - if (!layerHit) { - clickOutside |= wpLayerRender.onMouseActionOutsideLayer(isDoubleClick, blockCoord); - } - } - } - return layerHit || clickOutside; - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/MiniMapMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/MiniMapMixin.java deleted file mode 100644 index 572c7992..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/MiniMapMixin.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import net.minecraft.client.Minecraft; - -import org.spongepowered.asm.mixin.Final; -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 com.sinthoras.visualprospecting.integration.journeymap.JourneyMapState; -import com.sinthoras.visualprospecting.integration.journeymap.render.LayerRenderer; -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; - -import journeymap.client.render.draw.DrawStep; -import journeymap.client.render.map.GridRenderer; -import journeymap.client.ui.minimap.DisplayVars; -import journeymap.client.ui.minimap.MiniMap; -import journeymap.client.ui.minimap.Shape; - -@Mixin(MiniMap.class) -public abstract class MiniMapMixin { - - @Final - @Shadow(remap = false) - private static GridRenderer gridRenderer; - - @Final - @Shadow(remap = false) - private Minecraft mc; - - @Shadow(remap = false) - private DisplayVars dv; - - @Inject(method = "drawOnMapWaypoints", at = @At(value = "HEAD"), remap = false, require = 1) - private void visualprospecting$onBeforeDrawWaypoints(double rotation, CallbackInfo ci) { - for (LayerManager layerManager : MapState.instance.layers) { - if (layerManager.isLayerActive()) { - if (((DisplayVarsAccessor) dv).getShape() == Shape.Circle) { - layerManager.recacheMiniMap( - (int) mc.thePlayer.posX, - (int) mc.thePlayer.posZ, - ((DisplayVarsAccessor) dv).getMinimapWidth()); - } else { - layerManager.recacheMiniMap( - (int) mc.thePlayer.posX, - (int) mc.thePlayer.posZ, - gridRenderer.getWidth(), - gridRenderer.getHeight()); - } - } - } - - for (LayerRenderer layerRenderer : JourneyMapState.instance.renderers) { - if (layerRenderer.isLayerActive()) { - for (DrawStep drawStep : layerRenderer.getDrawStepsCachedForRendering()) { - drawStep.draw( - 0.0D, - 0.0D, - gridRenderer, - ((DisplayVarsAccessor) dv).getDrawScale(), - ((DisplayVarsAccessor) dv).getFontScale(), - rotation); - } - } - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/RenderWaypointBeaconMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/RenderWaypointBeaconMixin.java deleted file mode 100644 index 9982d486..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/RenderWaypointBeaconMixin.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -import net.minecraft.client.Minecraft; - -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 com.sinthoras.visualprospecting.integration.journeymap.JourneyMapState; -import com.sinthoras.visualprospecting.integration.journeymap.waypoints.WaypointManager; - -import journeymap.client.model.Waypoint; -import journeymap.client.render.ingame.RenderWaypointBeacon; - -@Mixin(RenderWaypointBeacon.class) -public class RenderWaypointBeaconMixin { - - @Shadow(remap = false) - static Minecraft mc; - - @Shadow(remap = false) - static void doRender(Waypoint waypoint) { - throw new IllegalStateException("Mixin failed to shadow doRender()"); - } - - @Inject( - method = "renderAll", - at = @At( - value = "INVOKE", - target = "Ljourneymap/client/waypoint/WaypointStore;instance()Ljourneymap/client/waypoint/WaypointStore;"), - remap = false, - require = 1) - private static void visualprospecting$onRenderAll(CallbackInfo ci) { - for (WaypointManager waypointManager : JourneyMapState.instance.waypointManagers) { - if (waypointManager.hasWaypoint()) { - final Waypoint waypoint = waypointManager.getJmWaypoint(); - if (waypoint.getDimensions().contains(mc.thePlayer.dimension)) { - doRender(waypoint); - } - } - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/WaypointManagerMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/WaypointManagerMixin.java deleted file mode 100644 index 597cad96..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/journeymap/WaypointManagerMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.journeymap; - -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.CallbackInfoReturnable; - -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.model.layers.WaypointProviderManager; - -import journeymap.client.ui.waypoint.WaypointManager; - -@Mixin(WaypointManager.class) -public class WaypointManagerMixin { - - @Inject(method = "toggleItems", at = @At("HEAD"), remap = false, require = 1) - private void visualprospecting$onToggleAllWaypoints(boolean enable, CallbackInfoReturnable cir) { - if (!enable) { - for (LayerManager layer : MapState.instance.layers) { - if (layer instanceof WaypointProviderManager) { - ((WaypointProviderManager) layer).clearActiveWaypoint(); - } - } - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/tcnodetracker/GuiMainMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/tcnodetracker/GuiMainMixin.java deleted file mode 100644 index c3e057fe..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/tcnodetracker/GuiMainMixin.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.tcnodetracker; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.resources.I18n; - -import org.objectweb.asm.Opcodes; -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.LocalCapture; - -import com.dyonovan.tcnodetracker.gui.GuiMain; -import com.dyonovan.tcnodetracker.lib.AspectLoc; -import com.sinthoras.visualprospecting.integration.model.layers.ThaumcraftNodeLayerManager; -import com.sinthoras.visualprospecting.integration.model.waypoints.Waypoint; - -@Mixin(GuiMain.class) -public class GuiMainMixin { - - @Shadow(remap = false) - private int low; - - @Inject( - method = "actionPerformed", - at = @At( - value = "FIELD", - target = "Lcom/dyonovan/tcnodetracker/TCNodeTracker;zMarker:I", - opcode = Opcodes.PUTSTATIC, - shift = At.Shift.AFTER, - remap = false), - require = 1, - locals = LocalCapture.CAPTURE_FAILEXCEPTION, - cancellable = true) - private void visualprospecting$onWaypointSet(GuiButton button, CallbackInfo ci, int i) { - final AspectLoc aspect = GuiMain.aspectList.get(low + i); - GuiMain.aspectList.clear(); - ThaumcraftNodeLayerManager.instance.setActiveWaypoint( - new Waypoint( - aspect.x, - aspect.y, - aspect.z, - aspect.dimID, - I18n.format("visualprospecting.tracked", I18n.format("tile.blockAiry.0.name")), - 0xFFFFFF)); - ci.cancel(); - } - - @Inject( - method = "actionPerformed", - at = @At( - value = "FIELD", - target = "Lcom/dyonovan/tcnodetracker/TCNodeTracker;doGui:Z", - opcode = Opcodes.PUTSTATIC, - ordinal = 0, - remap = false), - require = 1) - private void visualprospecting$onWaypointClear(CallbackInfo ci) { - ThaumcraftNodeLayerManager.instance.clearActiveWaypoint(); - } - - @Inject( - method = "actionPerformed", - at = @At( - value = "FIELD", - target = "Lcom/dyonovan/tcnodetracker/TCNodeTracker;doGui:Z", - opcode = Opcodes.PUTSTATIC, - ordinal = 1, - remap = false), - require = 1, - locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void visualprospecting$onWaypointDelete(GuiButton button, CallbackInfo ci, int i, int k, int j) { - ThaumcraftNodeLayerManager.instance.clearActiveWaypoint(); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/MinimapRendererMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/MinimapRendererMixin.java deleted file mode 100644 index 448a9a6b..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/MinimapRendererMixin.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.xaerosminimap; - -import java.util.ArrayList; - -import net.minecraft.client.Minecraft; -import net.minecraftforge.client.MinecraftForgeClient; - -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Slice; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.XaeroWorldMapState; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.LayerRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.RenderStep; - -import xaero.common.XaeroMinimapSession; -import xaero.common.minimap.MinimapProcessor; -import xaero.common.minimap.render.MinimapRenderer; -import xaero.common.settings.ModSettings; - -@Mixin(value = MinimapRenderer.class, remap = false) -public class MinimapRendererMixin { - - @Unique - private boolean stencilEnabled = true; - - @Shadow - protected Minecraft mc; - - @Shadow - protected double zoom; - - @Inject( - method = "renderMinimap", - at = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/waypoints/render/WaypointsGuiRenderer;render(Lxaero/common/XaeroMinimapSession;Lxaero/common/minimap/render/MinimapRendererHelper;DDIIDDFDZFZ)V"), - locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void visualprospecting$injectDraw(XaeroMinimapSession minimapSession, MinimapProcessor minimap, int x, - int y, int width, int height, int scale, int size, float partial, CallbackInfo ci, ModSettings settings, - ArrayList underText, int mapSize, int bufferSize, float minimapScale, float mapScale, float sizeFix, - int shape, boolean lockedNorth, double angle, double ps, double pc, boolean useWorldMap, int lightLevel, - boolean cave, boolean circleShape, int scaledX, int scaledY, int minimapFrameSize, int circleSides, - int frameType, boolean renderFrame, int frameTextureX, int halfFrame, int rightCornerStartX, int specH, - boolean safeMode, double playerX, double playerZ) { - for (LayerManager layerManager : MapState.instance.layers) { - if (layerManager.isLayerActive()) { - if (circleShape) { - layerManager.recacheMiniMap((int) mc.thePlayer.posX, (int) mc.thePlayer.posZ, minimapFrameSize * 2); - } else { - layerManager.recacheMiniMap( - (int) mc.thePlayer.posX, - (int) mc.thePlayer.posZ, - minimapFrameSize * 2, - minimapFrameSize * 2); - } - } - } - - if (stencilEnabled) { - double mapZoom = zoom * (double) minimapScale / 2.0; - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_STENCIL_TEST); - GL11.glRotated(Math.toDegrees(angle) - 90, 0.0, 0.0, 1.0); - GL11.glScaled(mapZoom, mapZoom, 0); - GL11.glStencilFunc(GL11.GL_EQUAL, 1, 1); - for (LayerRenderer renderer : XaeroWorldMapState.instance.renderers) { - if (renderer.isLayerActive()) { - for (RenderStep renderStep : renderer.getRenderSteps()) { - renderStep.draw(null, playerX, playerZ, mapZoom); - } - } - } - GL11.glDisable(GL11.GL_STENCIL_TEST); - GL11.glPopMatrix(); - } - } - - @Inject( - method = "renderMinimap", - at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glScalef(FFF)V", shift = At.Shift.AFTER), - slice = @Slice( - to = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapRendererHelper;drawTexturedElipseInsideRectangle(IFFIIFF)V"))) - private void visualprospecting$injectBeginStencil(XaeroMinimapSession minimapSession, MinimapProcessor minimap, - int x, int y, int width, int height, int scale, int size, float partial, CallbackInfo ci) { - if (stencilEnabled && MinecraftForgeClient.getStencilBits() == 0) { - stencilEnabled = false; - VP.warn("Could not enable stencils! Xaero's minimap overlays will not render"); - } - // if stencil is not enabled, this code will do nothing - GL11.glEnable(GL11.GL_STENCIL_TEST); - GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 1); - GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); - GL11.glStencilMask(0xFF); - GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); - } - - @Inject( - method = "renderMinimap", - at = @At(value = "INVOKE", target = "Lxaero/common/minimap/MinimapInterface;usingFBO()Z"), - slice = @Slice( - from = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/render/MinimapRendererHelper;drawTexturedElipseInsideRectangle(IFFIIFF)V"))) - private void visualprospecting$injectEndStencil(XaeroMinimapSession minimapSession, MinimapProcessor minimap, int x, - int y, int width, int height, int scale, int size, float partial, CallbackInfo ci) { - GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); - GL11.glStencilMask(0x00); - GL11.glDisable(GL11.GL_STENCIL_TEST); - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/WaypointsIngameRendererMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/WaypointsIngameRendererMixin.java deleted file mode 100644 index 78c4e4f3..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosminimap/WaypointsIngameRendererMixin.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.xaerosminimap; - -import net.minecraft.client.Minecraft; - -import org.objectweb.asm.Opcodes; -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.Slice; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import com.sinthoras.visualprospecting.integration.xaerominimap.XaeroMiniMapState; -import com.sinthoras.visualprospecting.integration.xaerominimap.waypoints.WaypointManager; - -import xaero.common.XaeroMinimapSession; -import xaero.common.minimap.waypoints.render.WaypointsIngameRenderer; - -@Mixin(value = WaypointsIngameRenderer.class, remap = false) -public class WaypointsIngameRendererMixin { - - @Inject( - method = "render", - at = @At( - value = "INVOKE", - target = "Lxaero/common/minimap/waypoints/render/WaypointsIngameRenderer;renderWaypointsList(Ljava/util/Collection;DDDLnet/minecraft/entity/Entity;Lnet/minecraft/client/renderer/Tessellator;DDDDFFDIFFLnet/minecraft/util/Vec3;D)V"), - slice = @Slice( - from = @At( - value = "FIELD", - target = "Lxaero/common/minimap/waypoints/WaypointsManager;customWaypoints:Ljava/util/Hashtable;", - opcode = Opcodes.GETSTATIC))) - private void visualprospecting$injectPreRenderCustomWaypoints(XaeroMinimapSession sets, float modCustomWaypoints, - CallbackInfo ci) { - for (WaypointManager manager : XaeroMiniMapState.instance.waypointManagers) { - if (manager.hasWaypoint()) { - manager.getXWaypoint().notifyDimension(Minecraft.getMinecraft().renderViewEntity.dimension); - } - } - } -} diff --git a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosworldmap/GuiMapMixin.java b/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosworldmap/GuiMapMixin.java deleted file mode 100644 index bda178cd..00000000 --- a/src/main/java/com/sinthoras/visualprospecting/mixins/late/xaerosworldmap/GuiMapMixin.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.sinthoras.visualprospecting.mixins.late.xaerosworldmap; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.Entity; - -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Slice; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import com.sinthoras.visualprospecting.VP; -import com.sinthoras.visualprospecting.integration.model.MapState; -import com.sinthoras.visualprospecting.integration.model.layers.LayerManager; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.XaeroWorldMapState; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.LayerButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.buttons.SizedGuiTexturedButton; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.InteractableLayerRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.renderers.LayerRenderer; -import com.sinthoras.visualprospecting.integration.xaeroworldmap.rendersteps.RenderStep; - -import xaero.map.MapProcessor; -import xaero.map.gui.CursorBox; -import xaero.map.gui.GuiMap; -import xaero.map.gui.ScreenBase; -import xaero.map.misc.Misc; - -@Mixin(value = GuiMap.class, remap = false) -public abstract class GuiMapMixin extends ScreenBase { - - @Unique - private int oldMouseX = 0; - - @Unique - private int oldMouseY = 0; - - @Unique - private long timeLastClick = 0; - - protected GuiMapMixin(GuiScreen parent, GuiScreen escape) { - super(parent, escape); - } - - @Shadow - private double cameraX; - - @Shadow - private double cameraZ; - - @Shadow - private double scale; - - @Shadow - public abstract void addGuiButton(GuiButton b); - - @Shadow - private int screenScale; - - @Inject(method = "", at = @At("RETURN")) - private void visualprospecting$injectConstruct(GuiScreen parent, GuiScreen escape, MapProcessor mapProcessor, - Entity player, CallbackInfo ci) { - MapState.instance.layers.forEach(LayerManager::onOpenMap); - } - - // apparently mixin can read the obfuscated names even with the deobf jar loaded. weird - // i guess all the errors mcdev shows here aren't real? - // deobf method = "drawScreen" - @Inject( - method = "func_73863_a", - at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glPushMatrix()V", ordinal = 1), - locals = LocalCapture.CAPTURE_FAILEXCEPTION) - private void visualprospecting$injectPreRender(int scaledMouseX, int scaledMouseY, float partialTicks, - CallbackInfo ci, Minecraft mc) { - // snap the camera to whole pixel values. works around a rendering issue but causes another when framerate is - // uncapped - if (mc.gameSettings.limitFramerate < 255 || mc.gameSettings.enableVsync) { - cameraX = Math.round(cameraX * scale) / scale; - cameraZ = Math.round(cameraZ * scale) / scale; - } - - // there's some nice local variables for exactly this but the local table for this function is hell - double mousePosX = (double) ((int) Misc.getMouseX(mc) - mc.displayWidth / 2) / this.scale; - double mousePosZ = (double) ((int) Misc.getMouseY(mc) - mc.displayHeight / 2) / this.scale; - - for (LayerRenderer layer : XaeroWorldMapState.instance.renderers) { - if (layer instanceof InteractableLayerRenderer) { - ((InteractableLayerRenderer) layer).updateHovered(mousePosX, mousePosZ, scale); - } - } - } - - // deobf method = "drawScreen" - @Inject( - method = "func_73863_a", - at = @At( - value = "INVOKE", - target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", - ordinal = 1, - shift = At.Shift.AFTER), - slice = @Slice( - from = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL14;glBlendFuncSeparate(IIII)V"), - to = @At( - value = "INVOKE", - target = "Lxaero/map/mods/SupportXaeroMinimap;renderWaypoints(Lnet/minecraft/client/gui/GuiScreen;DDIIDDDDLjava/util/regex/Pattern;Ljava/util/regex/Pattern;FLxaero/map/mods/gui/Waypoint;Lnet/minecraft/client/Minecraft;Lnet/minecraft/client/gui/ScaledResolution;)Lxaero/map/mods/gui/Waypoint;"))) - private void visualprospecting$injectDraw(int scaledMouseX, int scaledMouseY, float partialTicks, CallbackInfo ci) { - for (LayerManager layerManager : MapState.instance.layers) { - if (layerManager.isLayerActive()) { - // +20s are to work around precision loss from casting to int and right-shifting - layerManager.recacheFullscreenMap( - (int) cameraX, - (int) cameraZ, - (int) (mc.displayWidth / scale) + 20, - (int) (mc.displayHeight / scale) + 20); - } - } - - for (LayerRenderer renderer : XaeroWorldMapState.instance.renderers) { - if (renderer.isLayerActive()) { - for (RenderStep step : renderer.getRenderSteps()) { - step.draw(this, cameraX, cameraZ, scale); - } - } - } - } - - // deobf method = drawScreen - @Inject( - method = "func_73863_a", - at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslated(DDD)V"), - slice = @Slice( - from = @At( - value = "FIELD", - // deobf target = - // "Lnet/minecraft/client/Minecraft;currentScreen:Lnet/minecraft/client/gui/GuiScreen;" - target = "Lnet/minecraft/client/Minecraft;field_71462_r:Lnet/minecraft/client/gui/GuiScreen;", - opcode = Opcodes.GETFIELD), - to = @At(value = "INVOKE", target = "Lxaero/map/gui/CursorBox;drawBox(IIII)V"))) - private void visualprospecting$injectDrawTooltip(int scaledMouseX, int scaledMouseY, float partialTicks, - CallbackInfo ci) { - for (LayerRenderer layer : XaeroWorldMapState.instance.renderers) { - if (layer instanceof InteractableLayerRenderer && layer.isLayerActive()) { - ((InteractableLayerRenderer) layer).drawTooltip(this, scale, screenScale); - } - } - } - - // deobf method = "initGui" - @Inject( - method = "func_73866_w_", - at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;enableRepeatEvents(Z)V")) - private void visualprospecting$injectInitButtons(CallbackInfo ci) { - int numBtns = XaeroWorldMapState.instance.buttons.size(); - int totalHeight = numBtns * 20; - for (int i = 0; i < numBtns; i++) { - LayerButton layerButton = XaeroWorldMapState.instance.buttons.get(i); - SizedGuiTexturedButton button = new SizedGuiTexturedButton( - 0, - (height / 2 + totalHeight / 2) - 20 - 20 * i, - layerButton.textureLocation, - (btn) -> layerButton.toggle(), - new CursorBox(layerButton.getButtonTextKey())); - layerButton.setButton(button); - addGuiButton(button); - } - } - - @Inject(method = "onInputPress", at = @At("TAIL")) - private void visualprospecting$injectListenKeypress(boolean mouse, int code, CallbackInfoReturnable cir) { - if (Misc.inputMatchesKeyBinding(mouse, code, VP.keyAction)) { - for (LayerRenderer layer : XaeroWorldMapState.instance.renderers) { - if (layer instanceof InteractableLayerRenderer) { - ((InteractableLayerRenderer) layer).doActionKeyPress(); - } - } - } - } - - @Inject(method = "mapClicked", at = @At("TAIL")) - private void visualprospecting$injectListenClick(int button, int x, int y, CallbackInfo ci) { - if (button == 0) { - final long timestamp = System.currentTimeMillis(); - final boolean isDoubleClick = x == oldMouseX && y == oldMouseY && timestamp - timeLastClick < 500; - oldMouseX = x; - oldMouseY = y; - timeLastClick = isDoubleClick ? 0 : timestamp; - - if (isDoubleClick) { - for (LayerRenderer layer : XaeroWorldMapState.instance.renderers) { - if (layer instanceof InteractableLayerRenderer && layer.isLayerActive()) { - ((InteractableLayerRenderer) layer).doDoubleClick(); - } - } - } - } - } -} diff --git a/src/main/resources/assets/journeymap/icon/theme/Vault/icon/nodes.png b/src/main/resources/assets/journeymap/icon/theme/Vault/icon/nodes.png deleted file mode 100644 index dd9193dc..00000000 Binary files a/src/main/resources/assets/journeymap/icon/theme/Vault/icon/nodes.png and /dev/null differ diff --git a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/nodes.png b/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/nodes.png deleted file mode 100644 index dd9193dc..00000000 Binary files a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/nodes.png and /dev/null differ diff --git a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/oreveins.png b/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/oreveins.png deleted file mode 100644 index 08cf2ea2..00000000 Binary files a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/oreveins.png and /dev/null differ diff --git a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/undergroundfluid.png b/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/undergroundfluid.png deleted file mode 100644 index ee4dc50b..00000000 Binary files a/src/main/resources/assets/journeymap/icon/theme/Victorian/icon/undergroundfluid.png and /dev/null differ diff --git a/src/main/resources/assets/visualprospecting/lang/en_US.lang b/src/main/resources/assets/visualprospecting/lang/en_US.lang index 282df4d0..cd96c795 100644 --- a/src/main/resources/assets/visualprospecting/lang/en_US.lang +++ b/src/main/resources/assets/visualprospecting/lang/en_US.lang @@ -7,7 +7,6 @@ visualprospecting.undergroundfluid.prospected.newandupdated=You found %s new and visualprospecting.button.dirtychunk=Show Dirty Chunks (Developer, Singleplayer only) visualprospecting.button.orevein=Show GT Ore Veins visualprospecting.button.undergroundfluid=Show GT Underground Fluids -visualprospecting.button.nodes=Show TC Nodes visualprospecting.button.resetprogress=Reset VisualProspecting visualprospecting.button.resetprogress.tooltip=Reset found ore veins and underground fluids for this player only visualprospecting.resetprogress.title=Delete VisualProspecting Progress @@ -31,7 +30,6 @@ visualprospecting.empty=Empty visualprospecting.key.action.name=Action button visualprospecting.key.toggleore.name=Toggle ore overlay visualprospecting.key.togglefluid.name=Toggle fluid overlay -visualprospecting.key.togglenode.name=Toggle node overlay visualprospecting.key.action.category=VisualProspecting item.visualprospecting.prospectorslog.name=Prospector's Log item.visualprospecting.prospectorslog.author=Author: %s diff --git a/src/main/resources/assets/visualprospecting/lang/zh_CN.lang b/src/main/resources/assets/visualprospecting/lang/zh_CN.lang index 685b4c49..1cb7cbc3 100644 --- a/src/main/resources/assets/visualprospecting/lang/zh_CN.lang +++ b/src/main/resources/assets/visualprospecting/lang/zh_CN.lang @@ -7,7 +7,6 @@ visualprospecting.undergroundfluid.prospected.newandupdated=你找到了 %s 新 visualprospecting.button.dirtychunk=显示未写盘区块(仅限开发者,单机游戏) visualprospecting.button.orevein=显示GT矿脉 visualprospecting.button.undergroundfluid=显示GT地下流体 -visualprospecting.button.nodes=显示灵气节点 visualprospecting.button.resetprogress=重置VisualProspecting visualprospecting.button.resetprogress.tooltip=仅重置此玩家发现的矿脉与地下流体 visualprospecting.resetprogress.title=删除VisualProspecting记录 diff --git a/src/main/resources/assets/journeymap/icon/theme/Vault/icon/oreveins.png b/src/main/resources/assets/visualprospecting/textures/icons/oreveins.png similarity index 100% rename from src/main/resources/assets/journeymap/icon/theme/Vault/icon/oreveins.png rename to src/main/resources/assets/visualprospecting/textures/icons/oreveins.png diff --git a/src/main/resources/assets/journeymap/icon/theme/Vault/icon/undergroundfluid.png b/src/main/resources/assets/visualprospecting/textures/icons/undergroundfluid.png similarity index 100% rename from src/main/resources/assets/journeymap/icon/theme/Vault/icon/undergroundfluid.png rename to src/main/resources/assets/visualprospecting/textures/icons/undergroundfluid.png diff --git a/src/main/resources/assets/xaeroworldmap/textures/nodes.png b/src/main/resources/assets/xaeroworldmap/textures/nodes.png deleted file mode 100644 index 7a1b5154..00000000 Binary files a/src/main/resources/assets/xaeroworldmap/textures/nodes.png and /dev/null differ diff --git a/src/main/resources/assets/xaeroworldmap/textures/oreveins.png b/src/main/resources/assets/xaeroworldmap/textures/oreveins.png deleted file mode 100644 index 1d10b72b..00000000 Binary files a/src/main/resources/assets/xaeroworldmap/textures/oreveins.png and /dev/null differ diff --git a/src/main/resources/assets/xaeroworldmap/textures/undergroundfluid.png b/src/main/resources/assets/xaeroworldmap/textures/undergroundfluid.png deleted file mode 100644 index 921c2595..00000000 Binary files a/src/main/resources/assets/xaeroworldmap/textures/undergroundfluid.png and /dev/null differ