Fix forestry compatibility and add luber ability to chainsaw

This commit is contained in:
Blood-Asp 2015-11-28 20:35:13 +01:00
parent aeff64f935
commit 4fd0a7f473
3 changed files with 48 additions and 8 deletions

View file

@ -1,7 +1,7 @@
minecraft.version=1.7.10 minecraft.version=1.7.10
forge.version=10.13.4.1517-1.7.10 forge.version=10.13.4.1517-1.7.10
gt.version=5.09.13 gt.version=5.09.14
ae2.version=rv2-beta-33 ae2.version=rv2-beta-33
applecore.version=1.7.10-1.2.1+107.59407 applecore.version=1.7.10-1.2.1+107.59407

View file

@ -1,16 +1,25 @@
package gregtech.common.tools; package gregtech.common.tools;
import java.util.ArrayList;
import java.util.List;
import gregtech.GT_Mod; import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.IIconContainer;
import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.items.GT_MetaGenerated_Tool;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.event.world.BlockEvent;
public class GT_Tool_Chainsaw_LV public class GT_Tool_Chainsaw_LV
extends GT_Tool_Saw { extends GT_Tool_Saw {
@ -77,7 +86,35 @@ public class GT_Tool_Chainsaw_LV
} catch (Exception e) { } catch (Exception e) {
} }
} }
@Override
public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) {
int rAmount = 0;
if ((aBlock.getMaterial() == Material.leaves) && ((aBlock instanceof IShearable))) {
aPlayer.worldObj.setBlock(aX, aY, aZ, aBlock, aMetaData, 0);
if (((IShearable) aBlock).isShearable(aStack, aPlayer.worldObj, aX, aY, aZ)) {
ArrayList<ItemStack> tDrops = ((IShearable) aBlock).onSheared(aStack, aPlayer.worldObj, aX, aY, aZ, aFortune);
aDrops.clear();
aDrops.addAll(tDrops);
aEvent.dropChance = 1.0F;
}
aPlayer.worldObj.setBlock(aX, aY, aZ, Blocks.air, 0, 0);
} else if (((aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce)) && (aDrops.isEmpty())) {
aDrops.add(new ItemStack(aBlock, 1, aMetaData));
aPlayer.worldObj.setBlockToAir(aX, aY, aZ);
aEvent.dropChance = 1.0F;
return 1;
}
if ((GregTech_API.sTimber) && (!aPlayer.isSneaking()) && (OrePrefixes.log.contains(new ItemStack(aBlock, 1, aMetaData)))) {
int tY = aY + 1;
for (int tH = aPlayer.worldObj.getHeight(); tY < tH; tY++) {
if ((aPlayer.worldObj.getBlock(aX, tY, aZ) != aBlock) || (!aPlayer.worldObj.func_147480_a(aX, tY, aZ, true))) {
break;
}
rAmount++;
}
}
return rAmount;
}
public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.toolHeadChainsaw.mTextureIndex] : Textures.ItemIcons.POWER_UNIT_LV; return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.toolHeadChainsaw.mTextureIndex] : Textures.ItemIcons.POWER_UNIT_LV;

View file

@ -9,10 +9,13 @@ import forestry.apiculture.genetics.Bee;
import forestry.apiculture.genetics.BeeDefinition; import forestry.apiculture.genetics.BeeDefinition;
import forestry.apiculture.genetics.BeeVariation; import forestry.apiculture.genetics.BeeVariation;
import forestry.apiculture.genetics.IBeeDefinition; import forestry.apiculture.genetics.IBeeDefinition;
import forestry.core.config.ForestryItem; //import forestry.apiculture.items.EnumHoneyComb;
import forestry.core.genetics.alleles.AlleleHelper; import forestry.core.genetics.alleles.AlleleHelper;
//import forestry.plugins.PluginApiculture;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList; import gregtech.api.enums.ItemList;
import gregtech.api.util.GT_ModHandler;
import gregtech.common.items.CombType; import gregtech.common.items.CombType;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -26,7 +29,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
CLAY(GT_BranchDefinition.ORGANIC, "Clay", true, 0x19d0ec, 0xffdc16) { CLAY(GT_BranchDefinition.ORGANIC, "Clay", true, 0x19d0ec, 0xffdc16) {
@Override @Override
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.30f); beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f);
beeSpecies.addProduct(new ItemStack(Items.clay_ball, 1), 0.15f); beeSpecies.addProduct(new ItemStack(Items.clay_ball, 1), 0.15f);
beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setHumidity(EnumHumidity.DAMP);
beeSpecies.setTemperature(EnumTemperature.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL);
@ -45,7 +48,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
SLIMEBALL(GT_BranchDefinition.ORGANIC, "SlimeBall", true, 0x4E9E55, 0x00FF15) { SLIMEBALL(GT_BranchDefinition.ORGANIC, "SlimeBall", true, 0x4E9E55, 0x00FF15) {
@Override @Override
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 15), 0.30f); beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 15), 0.30f);
beeSpecies.addSpecialty(GT_Bees.combs.getStackForType(CombType.STICKY), 0.30f); beeSpecies.addSpecialty(GT_Bees.combs.getStackForType(CombType.STICKY), 0.30f);
beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setHumidity(EnumHumidity.DAMP);
beeSpecies.setTemperature(EnumTemperature.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL);
@ -65,7 +68,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
@Override @Override
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.LIGNIE), 0.30f); beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.LIGNIE), 0.30f);
beeSpecies.addProduct(ForestryItem.peat.getItemStack(1), 0.15f); beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.15f);
beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setHumidity(EnumHumidity.NORMAL);
beeSpecies.setTemperature(EnumTemperature.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL);
} }
@ -83,7 +86,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
STICKYRESIN(GT_BranchDefinition.ORGANIC, "StickyResin", true, 0x2E8F5B, 0xDCC289) { STICKYRESIN(GT_BranchDefinition.ORGANIC, "StickyResin", true, 0x2E8F5B, 0xDCC289) {
@Override @Override
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.30f); beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f);
beeSpecies.addProduct(ItemList.IC2_Resin.get(1, new Object[0]), 0.15f); beeSpecies.addProduct(ItemList.IC2_Resin.get(1, new Object[0]), 0.15f);
beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setHumidity(EnumHumidity.NORMAL);
beeSpecies.setTemperature(EnumTemperature.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL);
@ -121,7 +124,7 @@ public enum GT_BeeDefinition implements IBeeDefinition {
OIL(GT_BranchDefinition.ORGANIC, "Oil", true, 0x4C4C4C, 0x333333) { OIL(GT_BranchDefinition.ORGANIC, "Oil", true, 0x4C4C4C, 0x333333) {
@Override @Override
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.30f); beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f);
beeSpecies.addSpecialty(GT_Bees.combs.getStackForType(CombType.OIL), 0.15f); beeSpecies.addSpecialty(GT_Bees.combs.getStackForType(CombType.OIL), 0.15f);
beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setHumidity(EnumHumidity.DAMP);
beeSpecies.setTemperature(EnumTemperature.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL);