Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 653557bc65 | |||
| dde87448a9 |
@@ -83,7 +83,9 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||||
// installable runtime dependencies
|
// installable runtime dependencies
|
||||||
deobfCompile "curse.maven:gregtechceu-557242:3949406"
|
//deobfCompile "curse.maven:gregtechceu-557242:3949406"
|
||||||
|
|
||||||
|
compileOnly(files("etc/gregtech-1.12.2-2.4.4-beta.jar"))
|
||||||
|
|
||||||
compileOnly "curse.maven:chisel-235279:2915375"
|
compileOnly "curse.maven:chisel-235279:2915375"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.enderio.core.common.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public interface IOverlayRenderAware {
|
||||||
|
|
||||||
|
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,7 +41,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Optional.Interface(iface = "gregtech.api.items.IToolItem", modid = "gregtech")
|
|
||||||
public class CraftingTreeNode {
|
public class CraftingTreeNode {
|
||||||
|
|
||||||
// what slot!
|
// what slot!
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package appeng.integration.modules.gregtech;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
|
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class ToolClass {
|
||||||
|
private static Class<?> GTToolClass;
|
||||||
|
private static Method getMaxItemDamage = null;
|
||||||
|
private static Method getItemDamage = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
GTToolClass = Class.forName("gregtech.api.items.IToolItem", false, Launch.classLoader);
|
||||||
|
getItemDamage = ReflectionHelper.findMethod(GTToolClass, "getItemDamage", null, ItemStack.class);
|
||||||
|
getMaxItemDamage = ReflectionHelper.findMethod(GTToolClass, "getMaxItemDamage", null, ItemStack.class);
|
||||||
|
} catch (ClassNotFoundException ignored) {
|
||||||
|
try {
|
||||||
|
GTToolClass = Class.forName("gregtech.api.items.toolitem.IGTTool", false, Launch.classLoader);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Enum<Interfaces> GTToolInterface = getGTToolInterface();
|
||||||
|
|
||||||
|
public static Class<?> getGTToolClass() {
|
||||||
|
if (GTToolClass == null) {
|
||||||
|
System.out.printf("TToolClass == null");
|
||||||
|
}
|
||||||
|
return GTToolClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Enum<Interfaces> getGTToolInterface() {
|
||||||
|
if (GTToolClass.getName().equals("IToolItem")) {
|
||||||
|
return Interfaces.ITOOLITEM;
|
||||||
|
} else {
|
||||||
|
return Interfaces.IGTTOOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getGTMaxDamage(ItemStack itemStack) {
|
||||||
|
if (GTToolInterface == Interfaces.ITOOLITEM) {
|
||||||
|
try {
|
||||||
|
return (int) getMaxItemDamage.invoke(itemStack.getItem(), itemStack);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return itemStack.getMaxDamage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getGTitemDamage(ItemStack itemStack) {
|
||||||
|
if (GTToolInterface == Interfaces.ITOOLITEM) {
|
||||||
|
try {
|
||||||
|
return (int) getItemDamage.invoke(itemStack.getItem(), itemStack);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return itemStack.getItemDamage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Interfaces {
|
||||||
|
ITOOLITEM,
|
||||||
|
IGTTOOL
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ import appeng.fluids.util.AEFluidStack;
|
|||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.integration.Integrations;
|
import appeng.integration.Integrations;
|
||||||
import appeng.integration.modules.bogosorter.InventoryBogoSortModule;
|
import appeng.integration.modules.bogosorter.InventoryBogoSortModule;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.GridNode;
|
import appeng.me.GridNode;
|
||||||
import appeng.me.helpers.AENetworkProxy;
|
import appeng.me.helpers.AENetworkProxy;
|
||||||
@@ -67,7 +68,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import gregtech.api.block.machines.BlockMachine;
|
import gregtech.api.block.machines.BlockMachine;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import gregtech.api.metatileentity.MetaTileEntity;
|
import gregtech.api.metatileentity.MetaTileEntity;
|
||||||
import gregtech.api.util.GTUtility;
|
import gregtech.api.util.GTUtility;
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
@@ -126,7 +126,6 @@ import java.util.*;
|
|||||||
* @version rv2
|
* @version rv2
|
||||||
* @since rv0
|
* @since rv0
|
||||||
*/
|
*/
|
||||||
@Optional.Interface(iface = "gregtech.api.items.IToolItem", modid = "gregtech")
|
|
||||||
@Optional.Interface(iface = "ic2.api.item.ICustomDamageItem", modid = "IC2")
|
@Optional.Interface(iface = "ic2.api.item.ICustomDamageItem", modid = "IC2")
|
||||||
public class Platform {
|
public class Platform {
|
||||||
|
|
||||||
@@ -1417,7 +1416,7 @@ public class Platform {
|
|||||||
|
|
||||||
//consider methods below moving to a compability class
|
//consider methods below moving to a compability class
|
||||||
public static boolean isGTDamageableItem(Item item) {
|
public static boolean isGTDamageableItem(Item item) {
|
||||||
return ((GTLoaded) && item instanceof IToolItem);
|
return ((GTLoaded) && ToolClass.getGTToolClass().isAssignableFrom(item.getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MetaTileEntity getMetaTileEntity(IBlockAccess world, BlockPos pos) {
|
public static MetaTileEntity getMetaTileEntity(IBlockAccess world, BlockPos pos) {
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.core.Api;
|
import appeng.core.Api;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -326,7 +326,7 @@ public class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack {
|
|||||||
} else if (a.getItem().isDamageable()) {
|
} else if (a.getItem().isDamageable()) {
|
||||||
return a.getItemDamage() > 1 == b.getItemDamage() > 1;
|
return a.getItemDamage() > 1 == b.getItemDamage() > 1;
|
||||||
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
||||||
return ((IToolItem) a.getItem()).getItemDamage(a) > 1 == ((IToolItem) b.getItem()).getItemDamage(b) > 1;
|
return (ToolClass.getGTitemDamage(a) > 1 == ToolClass.getGTitemDamage(b) > 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float percentDamageOfA = 0;
|
float percentDamageOfA = 0;
|
||||||
@@ -338,8 +338,8 @@ public class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack {
|
|||||||
percentDamageOfA = (float) a.getItemDamage() / a.getMaxDamage();
|
percentDamageOfA = (float) a.getItemDamage() / a.getMaxDamage();
|
||||||
percentDamageOfB = (float) b.getItemDamage() / b.getMaxDamage();
|
percentDamageOfB = (float) b.getItemDamage() / b.getMaxDamage();
|
||||||
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
||||||
percentDamageOfA = (float) ((IToolItem) a.getItem()).getItemDamage(a) / ((IToolItem) a.getItem()).getMaxItemDamage(a);
|
percentDamageOfA = (float) ToolClass.getGTitemDamage(a) / ToolClass.getGTMaxDamage(a);
|
||||||
percentDamageOfB = (float) ((IToolItem) b.getItem()).getItemDamage(b) / ((IToolItem) b.getItem()).getMaxItemDamage(b);
|
percentDamageOfB = (float) ToolClass.getGTitemDamage(b) / ToolClass.getGTMaxDamage(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
return percentDamageOfA > mode.breakPoint == percentDamageOfB > mode.breakPoint;
|
return percentDamageOfA > mode.breakPoint == percentDamageOfB > mode.breakPoint;
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ package appeng.util.item;
|
|||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap;
|
||||||
@@ -154,8 +154,8 @@ class FuzzyItemVariantList extends ItemVariantList {
|
|||||||
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
||||||
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
||||||
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
maxDamage = ((IToolItem) stack.getItem()).getMaxItemDamage(stack);
|
maxDamage = ToolClass.getGTMaxDamage(stack);
|
||||||
damage = ((IToolItem) stack.getItem()).getItemDamage(stack);
|
damage = ToolClass.getGTitemDamage(stack);
|
||||||
} else {
|
} else {
|
||||||
maxDamage = stack.getMaxDamage();
|
maxDamage = stack.getMaxDamage();
|
||||||
damage = stack.getItemDamage();
|
damage = stack.getItemDamage();
|
||||||
@@ -189,8 +189,8 @@ class FuzzyItemVariantList extends ItemVariantList {
|
|||||||
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
||||||
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
||||||
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
maxDamage = ((IToolItem) stack.getItem()).getMaxItemDamage(stack);
|
maxDamage = ToolClass.getGTMaxDamage(stack);
|
||||||
damage = ((IToolItem) stack.getItem()).getItemDamage(stack);
|
damage = ToolClass.getGTitemDamage(stack);
|
||||||
} else {
|
} else {
|
||||||
maxDamage = stack.getMaxDamage();
|
maxDamage = stack.getMaxDamage();
|
||||||
damage = stack.getItemDamage();
|
damage = stack.getItemDamage();
|
||||||
|
|||||||
Reference in New Issue
Block a user