1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
package gregtech.common.tools;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.event.world.BlockEvent;
import gregtech.GT_Mod;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_ToolHarvestHelper;
import gregtech.api.util.GT_Utility;
public class GT_Tool_JackHammer extends GT_Tool_Drill_LV {
@Override
public int getToolDamagePerBlockBreak() {
return GT_Mod.gregtechproxy.mHardRock ? 200 : 400;
}
@Override
public int getToolDamagePerDropConversion() {
return 400;
}
@Override
public int getToolDamagePerContainerCraft() {
return 3200;
}
@Override
public int getToolDamagePerEntityAttack() {
return 800;
}
@Override
public int getBaseQuality() {
return 1;
}
@Override
public float getBaseDamage() {
return 3.0F;
}
@Override
public float getSpeedMultiplier() {
return 12.0F;
}
@Override
public float getMaxDurabilityMultiplier() {
return 2.0F;
}
@Override
public boolean isMinableBlock(Block aBlock, byte aMetaData) {
return GT_ToolHarvestHelper.isAppropriateTool(aBlock, aMetaData, "pickaxe") //
|| GT_ToolHarvestHelper.isAppropriateMaterial(
aBlock, //
Material.rock, //
Material.glass, //
Material.ice, //
Material.packedIce //
);
}
@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 rConversions = 0;
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(
null,
true,
2147483647L,
null,
new ItemStack(aBlock, 1, aMetaData));
if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) {
for (ItemStack tDrop : aDrops) {
tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(
null,
true,
2147483647L,
null,
GT_Utility.copyAmount(1L, new Object[] { tDrop }));
if (tRecipe != null) {
ItemStack tHammeringOutput = tRecipe.getOutput(0);
if (tHammeringOutput != null) {
rConversions += tDrop.stackSize;
tDrop.stackSize *= tHammeringOutput.stackSize;
tHammeringOutput.stackSize = tDrop.stackSize;
GT_Utility.setStack(tDrop, tHammeringOutput);
}
}
}
} else {
aDrops.clear();
aDrops.add(tRecipe.getOutput(0));
rConversions++;
}
return rConversions;
}
@Override
public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer) {
super.onToolCrafted(aStack, aPlayer);
try {
GT_Mod.instance.achievements.issueAchievement(aPlayer, "hammertime");
} catch (Exception ignored) {}
}
@Override
public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {
return aIsToolHead ? Textures.ItemIcons.JACKHAMMER : null;
}
@Override
public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) {
return new ChatComponentText(
EnumChatFormatting.RED + aEntity.getCommandSenderName()
+ EnumChatFormatting.WHITE
+ " has been jackhammered into pieces by "
+ EnumChatFormatting.GREEN
+ aPlayer.getCommandSenderName()
+ EnumChatFormatting.WHITE);
}
}
|