Skip to content

Commit

Permalink
Add Jubilance description (#4)
Browse files Browse the repository at this point in the history
* Bump Forestry

* Add Jubilance tooltip

* Buildscript

* Spotless
  • Loading branch information
kuba6000 authored Oct 16, 2022
1 parent 4c3831e commit e60bba6
Show file tree
Hide file tree
Showing 39 changed files with 1,019 additions and 427 deletions.
44 changes: 44 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
* text eol=lf

*.[jJ][aA][rR] binary

*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary

*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary

*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary

*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary

*.[pP][aA][tT][cC][hH] -text

*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf

*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
756 changes: 565 additions & 191 deletions build.gradle

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev')

implementation('com.github.GTNewHorizons:ForestryMC:4.4.5:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.5.3:dev')
implementation('com.github.GTNewHorizons:waila:1.5.18:dev')
}
10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}

apply plugin: 'com.diffplug.blowdryerSetup'

blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
13 changes: 8 additions & 5 deletions src/main/scala/net/bdew/neiaddons/BaseAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
import cpw.mods.fml.relauncher.Side;
import java.util.Map;
import net.bdew.neiaddons.api.NEIAddon;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;

import java.util.Map;

public abstract class BaseAddon implements NEIAddon {

protected boolean active = false;
Expand Down Expand Up @@ -98,12 +97,16 @@ protected boolean verifyModVersion(String spec) {
ArtifactVersion found = modlist.get(modid).getProcessedVersion();

if (found == null) {
logInfo("Unable to determine version of required mod %s, dependent features will be unavailable", req.getLabel());
logInfo(
"Unable to determine version of required mod %s, dependent features will be unavailable",
req.getLabel());
return false;
}

if (!req.containsVersion(found)) {
logInfo("Version mismatch: %s is required while %s was detected, dependent features will be unavailable", req.toString(), found.getVersionString());
logInfo(
"Version mismatch: %s is required while %s was detected, dependent features will be unavailable",
req.toString(), found.getVersionString());
return false;
}

Expand All @@ -115,4 +118,4 @@ protected boolean verifyModVersion(String spec) {
public boolean isEnabledByDefault() {
return true;
}
}
}
14 changes: 9 additions & 5 deletions src/main/scala/net/bdew/neiaddons/NEIAddons.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.relauncher.Side;
import java.util.ArrayList;
import java.util.List;
import net.bdew.neiaddons.api.NEIAddon;
import net.bdew.neiaddons.network.ClientHandler;
import net.bdew.neiaddons.network.NetChannel;
Expand All @@ -23,10 +25,11 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

@Mod(modid = NEIAddons.modId, name = NEIAddons.modName, version = NEIAddons.modVersion, dependencies = "after:NotEnoughItems")
@Mod(
modid = NEIAddons.modId,
name = NEIAddons.modName,
version = NEIAddons.modVersion,
dependencies = "after:NotEnoughItems")
public class NEIAddons {

public static final String modVersion = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -85,7 +88,8 @@ public void preInit(FMLPreInitializationEvent event) {
public void init(FMLInitializationEvent event) {
logInfo("Loading NEI Addons");
for (NEIAddon addon : addons) {
if (config.get("Addons", addon.getName(), addon.isEnabledByDefault()).getBoolean(false)) {
if (config.get("Addons", addon.getName(), addon.isEnabledByDefault())
.getBoolean(false)) {
logInfo("Loading %s Addon...", addon.getName());
try {
addon.init(event.getSide());
Expand Down
37 changes: 17 additions & 20 deletions src/main/scala/net/bdew/neiaddons/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
package net.bdew.neiaddons;

import codechicken.nei.api.API;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;

public class Utils {
@SuppressWarnings("unchecked")
public static <T> Class<? extends T> getAndCheckClass(String cls, Class<? extends T> sup) throws ClassNotFoundException {
public static <T> Class<? extends T> getAndCheckClass(String cls, Class<? extends T> sup)
throws ClassNotFoundException {
Class<?> c = Class.forName(cls);
if (c != null) {
if (sup.isAssignableFrom(c)) {
Expand All @@ -35,7 +35,8 @@ public static <T> Class<? extends T> getAndCheckClass(String cls, Class<? extend
}

@SuppressWarnings("unchecked")
public static <T> T getAndCheckStaicField(String cls, String field, Class<T> sup) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
public static <T> T getAndCheckStaicField(String cls, String field, Class<T> sup)
throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
Class<?> c = Class.forName(cls);
if (c == null) throw new RuntimeException("Can't get " + cls);

Expand All @@ -47,7 +48,8 @@ public static <T> T getAndCheckStaicField(String cls, String field, Class<T> sup
if (sup.isInstance(v)) {
return (T) v;
} else {
throw new RuntimeException(String.format("%s.%s is of wrong type, expected: %s, got: %s", cls, field, sup, v.getClass()));
throw new RuntimeException(
String.format("%s.%s is of wrong type, expected: %s, got: %s", cls, field, sup, v.getClass()));
}
}

Expand All @@ -57,25 +59,19 @@ public static void drawCenteredString(String s, int x, int y, int color) {
}

public static void safeAddNBTItem(ItemStack item) {
if (item == null)
return;
if (item == null) return;
API.addItemListEntry(item);
}

/**
* Like ItemStack.isItemStackEqual but ignores stack size
*/
public static boolean isSameItem(ItemStack s1, ItemStack s2) {
if ((s1 == null) || (s2 == null))
return false;
if (s1.getItem() != s2.getItem())
return false;
if (s1.getItemDamage() != s2.getItemDamage())
return false;
if ((s1.getTagCompound() == null) && (s2.getTagCompound() == null))
return true;
if ((s1.getTagCompound() == null) || (s2.getTagCompound() == null))
return false;
if ((s1 == null) || (s2 == null)) return false;
if (s1.getItem() != s2.getItem()) return false;
if (s1.getItemDamage() != s2.getItemDamage()) return false;
if ((s1.getTagCompound() == null) && (s2.getTagCompound() == null)) return true;
if ((s1.getTagCompound() == null) || (s2.getTagCompound() == null)) return false;
return s1.getTagCompound().equals(s2.getTagCompound());
}

Expand All @@ -88,7 +84,8 @@ public static Map<ItemStack, Float> mergeStacks(Map<ItemStack, Float> stacks) {
continue;
}
for (Entry<ItemStack, Float> mergedStack : merged.entrySet()) {
if (isSameItem(stack.getKey(), mergedStack.getKey()) && (stack.getValue().equals(mergedStack.getValue()))) {
if (isSameItem(stack.getKey(), mergedStack.getKey())
&& (stack.getValue().equals(mergedStack.getValue()))) {
mergedStack.getKey().stackSize += 1;
continue outer;
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/scala/net/bdew/neiaddons/appeng/AddonAppeng.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.lang.reflect.Method;
import net.bdew.neiaddons.BaseAddon;
import net.bdew.neiaddons.NEIAddons;
import net.bdew.neiaddons.Utils;
Expand All @@ -23,9 +24,11 @@
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;

import java.lang.reflect.Method;

@Mod(modid = NEIAddons.modId + "|AppEng", name = NEIAddons.modName + ": Applied Energistics 2", version = NEIAddons.modVersion, dependencies = "after:NEIAddons;after:appliedenergistics2")
@Mod(
modid = NEIAddons.modId + "|AppEng",
name = NEIAddons.modName + ": Applied Energistics 2",
version = NEIAddons.modVersion,
dependencies = "after:NEIAddons;after:appliedenergistics2")
public class AddonAppeng extends BaseAddon {

@Instance(NEIAddons.modId + "|AppEng")
Expand All @@ -45,7 +48,7 @@ public String getName() {

@Override
public String[] getDependencies() {
return new String[]{"appliedenergistics2"};
return new String[] {"appliedenergistics2"};
}

@Override
Expand Down
44 changes: 21 additions & 23 deletions src/main/scala/net/bdew/neiaddons/appeng/AppEngGuiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,33 @@ public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemSta
if (AddonAppeng.clsBaseGui.isInstance(gui)) {
final Slot currentSlot = getSlotAtPosition(gui, mouseX, mouseY);

if (currentSlot != null && AddonAppeng.clsSlotFake.isInstance(currentSlot) && SlotHelper.isSlotEnabled(currentSlot)) {
if (currentSlot != null
&& AddonAppeng.clsSlotFake.isInstance(currentSlot)
&& SlotHelper.isSlotEnabled(currentSlot)) {

if (ClientHandler.enabledCommands.contains(AddonAppeng.setWorkbenchCommand)) {
final ItemStack stack = draggedStack.copy();

stack.stackSize = Math.min(stack.stackSize, 127);

if (button == 0) { //left
if (button == 0) { // left
setWorkbenchCommand(currentSlot.slotNumber, stack, true);
} else if (button == 1) { //right
} else if (button == 1) { // right
stack.stackSize = 1;
setWorkbenchCommand(currentSlot.slotNumber, stack, false);
} else if (button == 2) { //middle
} else if (button == 2) { // middle
setWorkbenchCommand(currentSlot.slotNumber, stack, true);
draggedStack.stackSize -= stack.stackSize;
}

return true;
} else {
Minecraft.getMinecraft().thePlayer.addChatMessage(
new ChatComponentTranslation("bdew.neiaddons.noserver").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))
);
Minecraft.getMinecraft()
.thePlayer
.addChatMessage(new ChatComponentTranslation("bdew.neiaddons.noserver")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
}

}

}

return super.handleDragNDrop(gui, mouseX, mouseY, draggedStack, button);
Expand All @@ -68,8 +69,7 @@ private boolean isMouseOverSlot(GuiContainer gui, Slot slot, int mouseX, int mou
return mouseX >= slotX - 1 && mouseX < slotX + slotW + 1 && mouseY >= slotY - 1 && mouseY < slotY + slotH + 1;
}

private void setWorkbenchCommand(int slotNum, ItemStack stack, boolean replace)
{
private void setWorkbenchCommand(int slotNum, ItemStack stack, boolean replace) {
NBTTagCompound message = new NBTTagCompound();
message.setInteger("slot", slotNum);
message.setBoolean("replace", replace);
Expand All @@ -81,17 +81,15 @@ private void setWorkbenchCommand(int slotNum, ItemStack stack, boolean replace)
PacketHelper.sendToServer(AddonAppeng.setWorkbenchCommand, message);
}

private Slot getSlotAtPosition(GuiContainer gui, int x, int y)
{
for (int k = 0; k < gui.inventorySlots.inventorySlots.size(); ++k) {
Slot slot = (Slot)gui.inventorySlots.inventorySlots.get(k);

if (isMouseOverSlot(gui, slot, x, y)) {
return slot;
}
}
private Slot getSlotAtPosition(GuiContainer gui, int x, int y) {
for (int k = 0; k < gui.inventorySlots.inventorySlots.size(); ++k) {
Slot slot = (Slot) gui.inventorySlots.inventorySlots.get(k);

return null;
}
if (isMouseOverSlot(gui, slot, x, y)) {
return slot;
}
}

return null;
}
}
26 changes: 21 additions & 5 deletions src/main/scala/net/bdew/neiaddons/botany/AddonBotany.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
import net.bdew.neiaddons.botany.flowers.FlowerHelper;
import net.minecraft.client.resources.I18n;

@Mod(modid = NEIAddons.modId + "|Botany", name = NEIAddons.modName + ": Botany", version = NEIAddons.modVersion, dependencies = "after:NEIAddons;after:Botany")
@Mod(
modid = NEIAddons.modId + "|Botany",
name = NEIAddons.modName + ": Botany",
version = NEIAddons.modVersion,
dependencies = "after:NEIAddons;after:Botany")
public class AddonBotany extends BaseAddon {
public static boolean showFlowerMutations;
public static boolean loadBlacklisted;
Expand All @@ -41,7 +45,7 @@ public String getName() {

@Override
public String[] getDependencies() {
return new String[]{"Botany"};
return new String[] {"Botany"};
}

@Override
Expand All @@ -52,15 +56,27 @@ public void preInit(FMLPreInitializationEvent ev) {

@Override
public void init(Side side) throws Exception {
showFlowerMutations = NEIAddons.config.get(getName(), "Show Flower Mutations", true, "Set to false to disable flower mutations browsing").getBoolean(false);
showFlowerMutations = NEIAddons.config
.get(getName(), "Show Flower Mutations", true, "Set to false to disable flower mutations browsing")
.getBoolean(false);

loadBlacklisted = NEIAddons.config.get(getName(), "Load blacklisted", false, "Set to true to load blacklisted species and alleles, it's dangerous and (mostly) useless").getBoolean(false);
loadBlacklisted = NEIAddons.config
.get(
getName(),
"Load blacklisted",
false,
"Set to true to load blacklisted species and alleles, it's dangerous and (mostly) useless")
.getBoolean(false);

active = true;
}

public void registerWithNEIPlugins(String name, String id) {
FMLInterModComms.sendRuntimeMessage(this, "NEIPlugins", "register-crafting-handler", String.format("%s@%s@%s", I18n.format("bdew.neiaddons.genetics"), name, id));
FMLInterModComms.sendRuntimeMessage(
this,
"NEIPlugins",
"register-crafting-handler",
String.format("%s@%s@%s", I18n.format("bdew.neiaddons.genetics"), name, id));
}

@Override
Expand Down
Loading

0 comments on commit e60bba6

Please sign in to comment.