mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 14:34:36 +00:00
Delete wiki code. Fix cacophonium recipe.
This commit is contained in:
1 parent
3e9314d4f0
commit
073730dbcd
15 files changed
+5
-269
No files matched your search
@@ -31,12 +31,6 @@ public class IMC {
|
||||
*/
|
||||
public static final String REGISTER_NETHER_ORE_WEIGHT = "register_nether_ore_weight";
|
||||
|
||||
/**
|
||||
* Registers a Wiki provider for a mod so it uses that instead of the fallback FTB wiki.<br />
|
||||
* The argument should be a {@link ModWikiMessage}, any other types are ignored.
|
||||
*/
|
||||
public static final String REGISTER_MOD_WIKI = "register_mod_wiki";
|
||||
|
||||
/**
|
||||
* Registers a block as paintable under the paint lens.<br />
|
||||
* The argument should be a {@link PaintableBlockMessage}, any other types are ignored.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package vazkii.botania.api.imc;
|
||||
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
|
||||
public class ModWikiMessage {
|
||||
private final String modid;
|
||||
private final IWikiProvider wiki;
|
||||
|
||||
public ModWikiMessage(String modid, IWikiProvider wiki) {
|
||||
this.modid = modid;
|
||||
this.wiki = wiki;
|
||||
}
|
||||
|
||||
public String getModId() {
|
||||
return modid;
|
||||
}
|
||||
|
||||
public IWikiProvider getWiki() {
|
||||
return wiki;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Sep 2, 2014, 5:57:35 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.wiki;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* An interface for a Wiki Provider, these are registered to allow a mod to provide a wiki
|
||||
* for all the blocks in them, used for the world interaction with the Lexica Botania.
|
||||
* A simple, mostly all-inclusive implementation can be found on SimpleWikiProvider.
|
||||
*/
|
||||
public interface IWikiProvider {
|
||||
|
||||
/**
|
||||
* Gets the name of the block being looked at for display.
|
||||
*/
|
||||
public String getBlockName(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
/**
|
||||
* Gets the URL to open when the block is clicked.
|
||||
*/
|
||||
public String getWikiURL(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
/**
|
||||
* Gets the name of the wiki for display.
|
||||
*/
|
||||
public String getWikiName(World world, BlockRayTraceResult pos, PlayerEntity player);
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Sep 2, 2014, 5:58:39 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.wiki;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
public class SimpleWikiProvider implements IWikiProvider {
|
||||
|
||||
private final String name, urlBase, replacement;
|
||||
private final boolean lowercase;
|
||||
|
||||
public SimpleWikiProvider(String name, String urlBase) {
|
||||
this(name, urlBase, "%20");
|
||||
}
|
||||
|
||||
public SimpleWikiProvider(String name, String urlBase, boolean lowercase) {
|
||||
this(name, urlBase, "%20", lowercase);
|
||||
}
|
||||
|
||||
public SimpleWikiProvider(String name, String urlBase, String replacement) {
|
||||
this.name = name;
|
||||
this.urlBase = urlBase;
|
||||
this.replacement = replacement;
|
||||
lowercase = false;
|
||||
}
|
||||
|
||||
public SimpleWikiProvider(String name, String urlBase, String replacement, boolean lowercase) {
|
||||
this.name = name;
|
||||
this.urlBase = urlBase;
|
||||
this.replacement = replacement;
|
||||
this.lowercase = lowercase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
BlockPos bPos = pos.getPos();
|
||||
BlockState state = world.getBlockState(bPos);
|
||||
|
||||
ItemStack stack = state.getBlock().getPickBlock(state, pos, world, bPos, player);
|
||||
|
||||
if(stack.isEmpty())
|
||||
stack = new ItemStack(state.getBlock());
|
||||
|
||||
if(stack.isEmpty())
|
||||
return null;
|
||||
|
||||
return stack.getDisplayName().getString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWikiURL(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
String name = getBlockName(world, pos, player);
|
||||
if(name == null)
|
||||
return null;
|
||||
|
||||
if(lowercase) {
|
||||
return String.format(urlBase, name.toLowerCase().replaceAll(" ", replacement));
|
||||
} else {
|
||||
return String.format(urlBase, WordUtils.capitalizeFully(name).replaceAll(" ", replacement));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWikiName(World world, BlockRayTraceResult pos, PlayerEntity player) {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Sep 2, 2014, 6:05:03 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.wiki;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WikiHooks {
|
||||
|
||||
private static final IWikiProvider FALLBACK_PROVIDER = new SimpleWikiProvider("FTB Wiki", "https://ftb.gamepedia.com/%s");
|
||||
|
||||
public static Map<String, IWikiProvider> modWikis = Collections.emptyMap();
|
||||
|
||||
public static IWikiProvider getWikiFor(Block block) {
|
||||
ResourceLocation mod = block.getRegistryName();
|
||||
return getWikiFor(mod == null ? "" : mod.getNamespace().toLowerCase());
|
||||
}
|
||||
|
||||
public static IWikiProvider getWikiFor(String mod) {
|
||||
return modWikis.getOrDefault(mod, FALLBACK_PROVIDER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,8 +50,6 @@ import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -401,21 +399,6 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(!ConfigHandler.CLIENT.lexicaOfflineMode.get() && !draw) {
|
||||
profiler.startSection("wikiLookup");
|
||||
if(!block.isAir(state, mc.world, pos.getPos()) && !(block instanceof FlowingFluidBlock)) {
|
||||
IWikiProvider provider = WikiHooks.getWikiFor(block);
|
||||
String url = provider.getWikiURL(mc.world, pos, mc.player);
|
||||
if(url != null && !url.isEmpty()) {
|
||||
String name = provider.getBlockName(mc.world, pos, mc.player);
|
||||
String wikiName = provider.getWikiName(mc.world, pos, mc.player);
|
||||
drawStr = name + " @ " + TextFormatting.AQUA + wikiName;
|
||||
draw = true;
|
||||
}
|
||||
}
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(draw) {
|
||||
if(!mc.player.isSneaking()) {
|
||||
drawStr = "?";
|
||||
|
||||
@@ -41,8 +41,6 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.multiblock.Multiblock;
|
||||
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.AnyComponent;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.challenge.ModChallenges;
|
||||
import vazkii.botania.client.core.handler.BaubleRenderHandler;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
@@ -198,24 +196,6 @@ public class ClientProxy implements IProxy {
|
||||
return ItemMonocle.hasMonocle(Minecraft.getInstance().player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openWikiPage(World world, Block block, BlockRayTraceResult pos) {
|
||||
if(ConfigHandler.CLIENT.lexicaOfflineMode.get())
|
||||
return false;
|
||||
IWikiProvider wiki = WikiHooks.getWikiFor(block);
|
||||
String url = wiki.getWikiURL(world, pos, Minecraft.getInstance().player);
|
||||
if(url != null && !url.isEmpty()) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLastVersion() {
|
||||
String s = PersistentVariableHelper.lastBotaniaVersion;
|
||||
|
||||
@@ -30,7 +30,6 @@ public final class ConfigHandler {
|
||||
public final ForgeConfigSpec.BooleanValue renderAccessories;
|
||||
public final ForgeConfigSpec.BooleanValue enableSeasonalFeatures;
|
||||
public final ForgeConfigSpec.BooleanValue useShiftForQuickLookup;
|
||||
public final ForgeConfigSpec.BooleanValue lexicaOfflineMode;
|
||||
public final ForgeConfigSpec.BooleanValue enableArmorModels;
|
||||
public final ForgeConfigSpec.BooleanValue enableFancySkybox;
|
||||
public final ForgeConfigSpec.BooleanValue enableFancySkyboxInNormalWorlds;
|
||||
@@ -88,9 +87,6 @@ public final class ConfigHandler {
|
||||
useShiftForQuickLookup = builder
|
||||
.comment("Set this to true to use Shift instead of Ctrl for the inventory lexica botania quick lookup feature")
|
||||
.define("quick_lookup.use_shift", false);
|
||||
lexicaOfflineMode = builder
|
||||
.comment("Set this to true to disable the wiki lookup feature of the lexica, for offline usage")
|
||||
.define("quick_lookup.offline_mode", false);
|
||||
enableArmorModels = builder
|
||||
.comment("Set this to false to disable custom armor models")
|
||||
.define("armor_models", true);
|
||||
|
||||
@@ -3,19 +3,14 @@ package vazkii.botania.common.core.handler;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.imc.IMC;
|
||||
import vazkii.botania.api.imc.ModWikiMessage;
|
||||
import vazkii.botania.api.imc.OreWeightMessage;
|
||||
import vazkii.botania.api.imc.PaintableBlockMessage;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -26,18 +21,9 @@ public final class IMCHandler {
|
||||
public static void handle(InterModProcessEvent evt) {
|
||||
BotaniaAPI.oreWeights = handleOreWeights(evt.getIMCStream(IMC.REGISTER_ORE_WEIGHT::equals));
|
||||
BotaniaAPI.oreWeightsNether = handleOreWeights(evt.getIMCStream(IMC.REGISTER_NETHER_ORE_WEIGHT::equals));
|
||||
WikiHooks.modWikis = handleWikis(evt.getIMCStream(IMC.REGISTER_MOD_WIKI::equals));
|
||||
BotaniaAPI.paintableBlocks = handlePaintable(evt.getIMCStream(IMC.REGISTER_PAINTABLE_BLOCK::equals));
|
||||
}
|
||||
|
||||
private static Map<String, IWikiProvider> handleWikis(Stream<InterModComms.IMCMessage> msgs) {
|
||||
Map<String, IWikiProvider> map = msgs
|
||||
.filter(msg -> msg.getMessageSupplier().get() instanceof ModWikiMessage)
|
||||
.map(msg -> (ModWikiMessage) msg.getMessageSupplier().get())
|
||||
.collect(Collectors.toMap(ModWikiMessage::getModId, ModWikiMessage::getWiki));
|
||||
return ImmutableMap.copyOf(map);
|
||||
}
|
||||
|
||||
private static Map<ResourceLocation, Integer> handleOreWeights(Stream<InterModComms.IMCMessage> msgs) {
|
||||
Map<ResourceLocation, Integer> map = msgs
|
||||
.filter(msg -> msg.getMessageSupplier().get() instanceof OreWeightMessage)
|
||||
|
||||
@@ -2,18 +2,11 @@ package vazkii.botania.common.core.handler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import vazkii.botania.api.ColorHelper;
|
||||
import vazkii.botania.api.imc.IMC;
|
||||
import vazkii.botania.api.imc.ModWikiMessage;
|
||||
import vazkii.botania.api.imc.PaintableBlockMessage;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.SimpleWikiProvider;
|
||||
import vazkii.botania.common.crafting.ModManaAlchemyRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaConjurationRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaInfusionRecipes;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class IMCSender {
|
||||
@@ -91,18 +84,6 @@ public class IMCSender {
|
||||
addOreWeightNether("oreHaditeCoal", 500); // Hadite
|
||||
*/
|
||||
|
||||
IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s");
|
||||
IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s");
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("minecraft", new SimpleWikiProvider("Minecraft Wiki", "https://minecraft.gamepedia.com/%s")));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("mekanism", mekanismWiki));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("mekanismgenerators", mekanismWiki));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("mekanismtools", mekanismWiki));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("enderio", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s")));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("tropicraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s")));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("randomthings", new SimpleWikiProvider("Random Things Wiki", "https://lumien.net/rtwiki/blocks/%s/", "-", true)));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("appliedenergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s")));
|
||||
send(IMC.REGISTER_MOD_WIKI, new ModWikiMessage("bigreactors", technicWiki));
|
||||
|
||||
// Can't iterate over ColorHelper map values yet since remap event hasn't fired yet -.-
|
||||
Block[] stainedGlass = { Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS,
|
||||
Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS,
|
||||
|
||||
@@ -29,8 +29,6 @@ public interface IProxy {
|
||||
|
||||
String getLastVersion();
|
||||
|
||||
boolean openWikiPage(World world, Block block, BlockRayTraceResult pos);
|
||||
|
||||
void setMultiblock(World world, int x, int y, int z, double radius, Block block);
|
||||
|
||||
void removeSextantMultiblock();
|
||||
|
||||
@@ -54,11 +54,6 @@ public class ServerProxy implements IProxy {
|
||||
return LibMisc.BUILD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openWikiPage(World world, Block block, BlockRayTraceResult pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultiblock(World world, int x, int y, int z, double radius, Block block) {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user