Move all mod compatibility out into its own mod, ic2 support is gone and will come back in some more basic form once ic2 is on 1.13

The new mod compatibility will be included (either shaded or jar-in-jar) in the main TR distrubtion, this has been done to aid development
This commit is contained in:
modmuss50 2018-07-19 10:48:30 +01:00
parent 4ea0dc1e9a
commit b65e963f12
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
119 changed files with 975 additions and 1146 deletions

View file

@ -24,9 +24,6 @@
package techreborn.items.tools;
import ic2.core.item.tool.ItemTreetap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -45,10 +42,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
import reborncore.common.util.ItemUtils;
import techreborn.utils.TechRebornCreativeTab;
import techreborn.compat.CompatManager;
import techreborn.init.ModItems;
import techreborn.items.ItemTR;
@ -69,20 +64,6 @@ public class ItemElectricTreetap extends ItemTR implements IEnergyItemInfo {
setMaxStackSize(1);
}
// Item
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
IEnergyStorage capEnergy = playerIn.getHeldItem(hand).getCapability(CapabilityEnergy.ENERGY, null);
if (CompatManager.isIC2Loaded && block == Block.getBlockFromName("ic2:rubber_wood") && capEnergy.getEnergyStored() >= cost)
if (ItemTreetap.attemptExtract(playerIn, worldIn, pos, side, state, null) && !worldIn.isRemote) {
capEnergy.extractEnergy(cost, false);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);

View file

@ -24,7 +24,6 @@
package techreborn.items.tools;
import ic2.core.item.tool.ItemTreetap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@ -36,7 +35,6 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import techreborn.utils.TechRebornCreativeTab;
import techreborn.compat.CompatManager;
import techreborn.events.TRRecipeHandler;
import techreborn.items.ItemTR;
@ -49,22 +47,6 @@ public class ItemTreeTap extends ItemTR {
setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock();
if (CompatManager.isIC2Loaded && block == Block.getBlockFromName("ic2:rubber_wood")) {
ItemTreetap.attemptExtract(playerIn, worldIn, pos, side, state, null);
if (!worldIn.isRemote) {
playerIn.getHeldItem(hand).damageItem(1, playerIn);
}
if (playerIn instanceof EntityPlayerMP) {
TRRecipeHandler.unlockTRRecipes((EntityPlayerMP) playerIn);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {

View file

@ -38,9 +38,7 @@ import net.minecraftforge.server.permission.context.BlockPosContext;
import reborncore.api.IToolHandler;
import reborncore.common.util.RebornPermissions;
import techreborn.utils.TechRebornCreativeTab;
import techreborn.compat.CompatManager;
import techreborn.items.ItemTR;
import techreborn.utils.IC2WrenchHelper;
/**
* Created by modmuss50 on 26/02/2016.
@ -59,12 +57,6 @@ public class ItemWrench extends ItemTR implements IToolHandler {
if (!world.isRemote && !PermissionAPI.hasPermission(player.getGameProfile(), RebornPermissions.WRENCH_BLOCK, new BlockPosContext(player, pos, world.getBlockState(pos), facing))) {
return EnumActionResult.PASS;
}
if (CompatManager.isIC2Loaded) {
EnumActionResult result = IC2WrenchHelper.onItemUse(player.getHeldItem(hand), player, world, pos, hand, facing, hitX, hitY, hitZ);
if (result == EnumActionResult.SUCCESS) {
return result;
}
}
return EnumActionResult.PASS;
}