10
10
import cpw .mods .fml .common .gameevent .TickEvent ;
11
11
import cpw .mods .fml .relauncher .Side ;
12
12
import net .minecraft .block .*;
13
- import net .minecraft .block .material .Material ;
14
13
import net .minecraft .client .Minecraft ;
15
- import net .minecraft .client .multiplayer .PlayerControllerMP ;
16
14
import net .minecraft .client .settings .KeyBinding ;
17
15
import net .minecraft .entity .player .EntityPlayer ;
18
16
import net .minecraft .init .Items ;
27
25
import java .util .*;
28
26
29
27
/**
30
- * Created by recursiveg on 14-9-28.
28
+ * Auto Harvest Mod
29
+ * This Mod can help you harvest crops automatically.
30
+ * It can also help you clear the ground.
31
+ * Works for both SSP & SMP
32
+ * This Mod is published under GPLv3
33
+ * Use it *AT YOUR OWN RISK*
34
+ * RecursiveG
35
+ * 2014 Sept. 29th
36
+ *
37
+ *
38
+ *
39
+ * Auto Harvest Mod
40
+ * Copyright (C) 2014 RecursiveG
41
+ *
42
+ * This program is free software: you can redistribute it and/or modify
43
+ * it under the terms of the GNU General Public License as published by
44
+ * the Free Software Foundation, either version 3 of the License, or
45
+ * (at your option) any later version.
46
+ *
47
+ * This program is distributed in the hope that it will be useful,
48
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50
+ * GNU General Public License for more details.
51
+ *
52
+ * You should have received a copy of the GNU General Public License
53
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31
54
*/
32
55
33
56
@ Mod (modid ="autoharvest" , name ="Auto Harvest Mod" , version ="0.1-dev" )
@@ -53,7 +76,7 @@ public class AutoHarvest {
53
76
put (BlockPotato .class ,Items .potato );
54
77
put (BlockNetherWart .class ,Items .nether_wart );
55
78
}};
56
- private static final Map <Class <?>,Integer > cropMatureData =new HashMap <Class <?>, Integer >(){{
79
+ static final Map <Class <?>,Integer > cropMatureData =new HashMap <Class <?>, Integer >(){{
57
80
put (BlockCrops .class ,7 );
58
81
put (BlockCarrot .class ,7 );
59
82
put (BlockPotato .class ,7 );
@@ -62,6 +85,7 @@ public class AutoHarvest {
62
85
63
86
64
87
@ Mod .EventHandler
88
+ @ SuppressWarnings ("unused" )
65
89
public void load (FMLInitializationEvent event ) {
66
90
ClientRegistry .registerKeyBinding (toggleKey );
67
91
MinecraftForge .EVENT_BUS .register (this );
@@ -71,7 +95,9 @@ public void load(FMLInitializationEvent event) {
71
95
private void sendPlayerPrivateMsg (String str ){
72
96
FMLClientHandler .instance ().getClient ().thePlayer .addChatMessage (new ChatComponentText (str ));
73
97
}
98
+
74
99
@ SubscribeEvent
100
+ @ SuppressWarnings ("unused" )
75
101
public void onToggle (InputEvent .KeyInputEvent e ){
76
102
if (toggleKey .isPressed ()){
77
103
if (!enabled ){
@@ -109,7 +135,7 @@ private void doClearGrass(EntityPlayer p){
109
135
for (int deltaX =-2 ;deltaX <=2 ;++deltaX )
110
136
for (int deltaZ =-2 ;deltaZ <=2 ;++deltaZ )
111
137
if (canClearGrass (w ,X + deltaX , Y +deltaY , Z + deltaZ )){
112
- mc .playerController .onPlayerDamageBlock (X + deltaX , Y + deltaY , Z + deltaZ , 1 );
138
+ mc .playerController .onPlayerDamageBlock (X + deltaX , Y + deltaY , Z + deltaZ , 1 );
113
139
return ;
114
140
}
115
141
}
@@ -137,8 +163,8 @@ private void doPlant(EntityPlayer p){
137
163
for (int deltaZ =-harvestRange ;deltaZ <=harvestRange ;++deltaZ ){
138
164
if (canPlantOn (w , p ,X + deltaX , Y , Z + deltaZ )) {
139
165
ItemStack seed =mc .thePlayer .inventory .getCurrentItem ();
140
- mc .playerController .onPlayerRightClick (p ,w , seed ,X + deltaX , Y , Z + deltaZ ,1 ,
141
- Vec3 .createVectorHelper (X + deltaX + 0.5 , Y + 1 , Z + deltaZ + 0.5 ));
166
+ mc .playerController .onPlayerRightClick (p , w , seed , X + deltaX , Y , Z + deltaZ , 1 ,
167
+ Vec3 .createVectorHelper (X + deltaX + 0.5 , Y + 1 , Z + deltaZ + 0.5 ));
142
168
return ;
143
169
}
144
170
}
0 commit comments