Fixes #170 and fixes #167

This commit is contained in:
Modmuss50 2015-10-07 08:34:24 +01:00
parent 7d052a3292
commit 9c52e0ace7
27 changed files with 41 additions and 112 deletions

View file

@ -1,11 +1,14 @@
package techreborn.blocks;
import cpw.mods.fml.common.Loader;
import ic2.api.item.IC2Items;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -14,8 +17,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModBlocks;
import techreborn.tiles.TileMachineBase;
import java.util.ArrayList;
import java.util.Random;
public class BlockMachineBase extends BlockContainer {
@ -157,4 +162,19 @@ public class BlockMachineBase extends BlockContainer {
public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z){
return blockAccess.getTileEntity(x, y, z) != null ? getTileRotation(blockAccess.getTileEntity(x, y, z).getWorldObj(), x, y, z) : 0;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
if(Loader.isModLoaded("IC2")){
items.add(IC2Items.getItem(isAdvanced() ? "advancedMachine" : "machine"));
} else {
items.add(isAdvanced()? new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 0) : new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 2));
}
return items;
}
public boolean isAdvanced(){
return false;
}
}

View file

@ -66,9 +66,4 @@ public class BlockDieselGenerator extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -54,9 +54,4 @@ public class BlockDragonEggSiphoner extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -66,9 +66,4 @@ public class BlockGasTurbine extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -54,9 +54,4 @@ public class BlockHeatGenerator extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -46,9 +46,4 @@ public class BlockLightningRod extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -46,9 +46,4 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -46,9 +46,4 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -46,9 +46,4 @@ public class BlockPlasmaGenerator extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -66,9 +66,4 @@ public class BlockSemiFluidGenerator extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -66,9 +66,4 @@ public class BlockThermalGenerator extends BlockMachineBase {
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -74,9 +74,4 @@ public class BlockAlloySmelter extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -74,12 +74,6 @@ public class BlockAssemblingMachine extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -75,8 +75,8 @@ public class BlockBlastFurnace extends BlockMachineBase {
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
public boolean isAdvanced() {
return true;
}
@Override

View file

@ -97,9 +97,4 @@ public class BlockCentrifuge extends BlockMachineBase {
}
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
}

View file

@ -74,11 +74,6 @@ public class BlockChemicalReactor extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -47,11 +47,6 @@ public class BlockDistillationTower extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {

View file

@ -78,11 +78,6 @@ public class BlockGrinder extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// } //TODO get a standalone way for this
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -75,8 +75,8 @@ public class BlockImplosionCompressor extends BlockMachineBase {
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
public boolean isAdvanced() {
return true;
}
@Override

View file

@ -75,11 +75,6 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {

View file

@ -75,8 +75,8 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
public boolean isAdvanced() {
return true;
}
@Override

View file

@ -74,11 +74,6 @@ public class BlockLathe extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -55,9 +55,10 @@ public class BlockMatterFabricator extends BlockMachineBase {
return this.iconOff;
}
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
public boolean isAdvanced() {
return true;
}
@Override

View file

@ -74,11 +74,6 @@ public class BlockPlateCuttingMachine extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -67,11 +67,6 @@ public class BlockRollingMachine extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon));
}
// @Override
// public Item getItemDropped(int meta, Random random, int fortune) {
// return IC2Items.getItem("machine").getItem();
// }//TODO
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){

View file

@ -48,8 +48,8 @@ public class BlockVacuumFreezer extends BlockMachineBase {
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
public boolean isAdvanced() {
return true;
}
@Override

View file

@ -26,7 +26,7 @@ public class CompatManager {
registerCompact(RecipesNatura.class, "Natura");
registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty");
registerCompact(RecipesThaumcraft.class, "Thaumcraft");
registerCompact(RecipesForestry.class, "Forestry");
registerCompact(RecipesForestry.class, "Forestry", isForestry4());
registerCompact(MinetweakerCompat.class, "MineTweaker3");
}
@ -57,4 +57,13 @@ public class CompatManager {
e.printStackTrace();
}
}
public boolean isForestry4(){
try {
Class.forName("forestry.api.arboriculture.EnumWoodType");
return true;
} catch( ClassNotFoundException e ) {
return false;
}
}
}