Compare commits

...
3 Commits
6 changed files with 53 additions and 4 deletions

No files matched your search

+3 -3
View File
@@ -2,9 +2,9 @@
dependencies {
api('curse.maven:cofh-lib-220333:2388748')
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta4:api')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.33-GTNH:dev')
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.6.2:api')
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta6:api')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.35-GTNH:dev')
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.0:api')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('curse.maven:craftguide-75557:2459320')
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}
@@ -65,6 +65,7 @@ import forestry.core.errors.EnumErrorCode;
import forestry.core.genetics.Chromosome;
import forestry.core.genetics.GenericRatings;
import forestry.core.genetics.IndividualLiving;
import forestry.core.proxy.Proxies;
import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.Log;
import forestry.core.utils.StringUtil;
@@ -456,6 +457,21 @@ public class Bee extends IndividualLiving implements IBee {
if (genome.getTolerantFlyer()) {
list.add(EnumChatFormatting.WHITE + StringUtil.localize("gui.flyer.tooltip"));
}
// Add lore and discovered by
String descTokens[] = primary.getDescription().split("\\|");
if (descTokens.length > 0) {
String speciesLore = descTokens[0];
if (!speciesLore.isEmpty() && Proxies.common.isCtrlDown()) {
list.addAll(StringUtil.multilineStrings(speciesLore, 50));
}
}
if (descTokens.length > 2) {
String discoveredBy = descTokens[2];
if (!discoveredBy.isEmpty()) {
list.add("Discovered by " + discoveredBy);
}
}
}
@Override
@@ -61,6 +61,10 @@ public class ProxyCommon {
return false;
}
public boolean isCtrlDown() {
return false;
}
public void playSoundFX(World world, int x, int y, int z, Block block) {
Proxies.net.sendNetworkPacket(new PacketFXSignal(PacketFXSignal.SoundFXType.LEAF, x, y, z, block, 0), world);
}
@@ -63,6 +63,11 @@ public class ProxyCommonClient extends ProxyCommon {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
@Override
public boolean isCtrlDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
}
@Override
public String getDisplayName(ItemStack itemstack) {
return itemstack.getItem().getItemStackDisplayName(itemstack);
@@ -8,7 +8,9 @@
******************************************************************************/
package forestry.core.utils;
import java.util.ArrayList;
import java.util.IllegalFormatException;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -116,4 +118,26 @@ public class StringUtil {
return lineCount * fontRenderer.FONT_HEIGHT;
}
public static List<String> multilineStrings(String input, int n) {
List<String> result = new ArrayList<>();
int start = 0;
while (start < input.length()) {
// Find the end index by starting with n characters ahead
int end = Math.min(start + n, input.length());
// If end is not at the end of the string, backtrack to the last space
if (end < input.length() && !Character.isWhitespace(input.charAt(end))) {
int lastSpace = input.lastIndexOf(' ', end);
if (lastSpace > start) {
end = lastSpace;
}
}
result.add(input.substring(start, end).trim());
start = end;
}
return result;
}
}