Fixes #723 and wrench works with ic2 machines now

This commit is contained in:
modmuss50 2016-09-06 22:16:21 +01:00
parent d96149fc97
commit d5ff2a42bb
6 changed files with 39 additions and 22 deletions

View file

@ -16,14 +16,12 @@ buildscript {
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'ModsIOUpload:ModsIOUpload:+'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'net.cazzar.gradle.modsio'
sourceCompatibility = 1.8
targetCompatibility = 1.8
@ -96,13 +94,13 @@ dependencies {
if(!f.exists()){
f.mkdir()
}
compile 'RebornCore:RebornCore-1.9.4:+:dev'
compile 'RebornCore:RebornCore-1.10.2:+:dev'
deobfCompile "mezz.jei:jei_1.9.4:+"
// compile "net.darkhax.tesla:Tesla:1.9.4-1.1.0.24:deobf"
deobfCompile "slimeknights.mantle:Mantle:1.9.4-0.10.1.jenkins142"
deobfCompile "slimeknights:TConstruct:1.9.4-2.3.1.jenkins229"
deobfCompile "mcjty.theoneprobe:TheOneProbe:1.9.4-1.0.4-14"
deobfCompile 'net.industrial-craft:industrialcraft-2:2.5.1-ex19:dev'
deobfCompile 'net.industrial-craft:industrialcraft-2:2.6.58-ex110:dev'
}
@ -164,22 +162,6 @@ artifacts {
build.dependsOn deobfJar, apiJar
modsIO {
if (project.hasProperty('mavenPass'))
{
key = project.getProperty('modsioTRKey')
}
project {
artifact = jar.archivePath
modid = "1182"
minecraft = "1.10.2"
changelog = "See github at : https://github.com/TechReborn/TechReborn"
tag = "alpha"
current = true
}
}
uploadArchives {
repositories {

View file

@ -1,5 +1,6 @@
package techreborn;
import ic2.api.info.Info;
import net.minecraft.block.BlockDispenser;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
@ -83,6 +84,8 @@ public class Core {
worldGen.hConfigFile = (new File(configDir, "ores.hjson"));
TechRebornAPI.subItemRetriever = new SubItemRetriever();
//Recheck here because things break at times
CompatManager.isIC2Loaded = Info.isIc2Available();
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.preInit(event);

View file

@ -26,7 +26,7 @@ public class CompatManager
public CompatManager()
{
isIC2Loaded = Loader.isModLoaded("IC2");
isIC2Loaded = Info.isIc2Available();
registerCompact(MinetweakerCompat.class, "MineTweaker3");
registerCompact(TechRebornParts.class, "reborncore-mcmultipart");
registerCompact(ClientPartLoader.class, "reborncore-mcmultipart", "@client");

View file

@ -25,10 +25,12 @@ import reborncore.common.tile.TileMachineBase;
import techreborn.blocks.fluid.BlockFluidBase;
import techreborn.blocks.storage.BlockBatBox;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.compat.CompatManager;
import techreborn.init.ModSounds;
import techreborn.items.ItemTR;
import techreborn.lib.ModInfo;
import techreborn.tiles.storage.TileEnergyStorage;
import techreborn.utils.IC2WrenchHelper;
import java.util.ArrayList;
import java.util.List;
@ -50,6 +52,12 @@ public class ItemWrench extends ItemTR implements ITexturedItem
@Override public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(CompatManager.isIC2Loaded){
EnumActionResult result = IC2WrenchHelper.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
if(result == EnumActionResult.SUCCESS){
return result;
}
}
if (world.isAirBlock(pos))
{
return EnumActionResult.FAIL;

View file

@ -156,7 +156,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
if (!worldObj.isRemote)
FluidUtils.drainContainers(this, inventory, 0, 1);
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick && tank.getFluidType() != null && fluids.containsKey(tank.getFluidType().getName()))
{
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8

View file

@ -0,0 +1,24 @@
package techreborn.utils;
import ic2.api.item.IC2Items;
import ic2.core.item.tool.ItemToolWrench;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class IC2WrenchHelper {
static ItemToolWrench wrench;
public static EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand){
if(wrench == null){
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
}
return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
}
}