Merge branch '1.8.9' of https://github.com/TechReborn/TechReborn into 1.8.9
This commit is contained in:
commit
158f68c4a8
2 changed files with 35 additions and 7 deletions
|
@ -104,7 +104,7 @@ dependencies {
|
||||||
compile "slimeknights:TConstruct:1.8.8-2.0.1.jenkins11:deobf"
|
compile "slimeknights:TConstruct:1.8.8-2.0.1.jenkins11:deobf"
|
||||||
// compile "mods.natura:natura:1.7.10-107.779621d:deobf"
|
// compile "mods.natura:natura:1.7.10-107.779621d:deobf"
|
||||||
compile "slimeknights.mantle:Mantle:1.8.8-0.6.jenkins60:deobf"
|
compile "slimeknights.mantle:Mantle:1.8.8-0.6.jenkins60:deobf"
|
||||||
compile "com.github.glitchfiend.biomesoplenty:BiomesOPlenty:1.8.9-3.0.0.1552:deobf"
|
compile "com.github.glitchfiend.biomesoplenty:BiomesOPlenty:1.8.9-3.0.0.1923:deobf"
|
||||||
//compile 'Azanor:Thaumcraft:5.0.3:deobf@jar'
|
//compile 'Azanor:Thaumcraft:5.0.3:deobf@jar'
|
||||||
compile "com.github.azanor:baubles:1.1.2.0:deobf@jar"
|
compile "com.github.azanor:baubles:1.1.2.0:deobf@jar"
|
||||||
compile name: "CraftTweaker", version: "1.8.8-3.0.0", classifier: "Dev"
|
compile name: "CraftTweaker", version: "1.8.8-3.0.0", classifier: "Dev"
|
||||||
|
|
|
@ -1,20 +1,27 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import ic2.api.tile.IWrenchable;
|
import ic2.api.tile.IWrenchable;
|
||||||
|
import net.minecraft.block.BlockDynamicLiquid;
|
||||||
|
import net.minecraft.block.BlockStaticLiquid;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidBase;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.items.ItemTR;
|
import techreborn.items.ItemTR;
|
||||||
import techreborn.items.ItemTextureBase;
|
import techreborn.items.ItemTextureBase;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,12 +45,34 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||||
if(tile == null){
|
if(tile == null){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
|
IInventory inventory = (IInventory) tile;
|
||||||
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
|
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||||
|
|
||||||
|
if(itemStack == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (itemStack != null && itemStack.stackSize > 0) {
|
||||||
|
if (itemStack.getItem() instanceof ItemBlock) {
|
||||||
|
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase || ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items.add(itemStack.copy());
|
||||||
|
}
|
||||||
|
|
||||||
if(tile instanceof IWrenchable){
|
if(tile instanceof IWrenchable){
|
||||||
if(((IWrenchable) tile).wrenchCanRemove(player)){
|
if(((IWrenchable) tile).wrenchCanRemove(player)){
|
||||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||||
if(itemStack == null){
|
if(itemStack == null){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
items.add(itemStack);
|
||||||
|
}
|
||||||
|
for(ItemStack itemStack : items){
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
@ -60,17 +89,16 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
entityItem.motionX = rand.nextGaussian() * factor;
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||||
|
|
||||||
|
|
||||||
world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 1F);
|
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
world.spawnEntityInWorld(entityItem);
|
world.spawnEntityInWorld(entityItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 1F);
|
||||||
|
if(!world.isRemote){
|
||||||
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue