11package com .detrav .events ;
22
3+ import com .detrav .utils .DetravConfig ;
34import cpw .mods .fml .common .FMLCommonHandler ;
45import cpw .mods .fml .common .eventhandler .SubscribeEvent ;
56import net .minecraft .block .Block ;
@@ -38,6 +39,7 @@ public void onDrawBlockHighlight(DrawBlockHighlightEvent e) {
3839 }
3940
4041 public static boolean drawMoreSelectionBox (EntityPlayer player , MovingObjectPosition mouseHit , int par3 , ItemStack par4ItemStack , float par5 ) {
42+ int rad = DetravConfig .DIGGING_RADIUS ;
4143 switch ((int ) modeBlockBreak ) {
4244 //case 0: Просто рисуем без экспанда
4345 case 0 :
@@ -47,27 +49,27 @@ public static boolean drawMoreSelectionBox(EntityPlayer player, MovingObjectPosi
4749 switch (mouseHit .sideHit ) {//Рисуеи по моусхиту
4850 case 0 :
4951 case 1 ://x,z
50- for (int i = -1 ; i <= 1 ; i ++)
51- for (int j = -1 ; j <= 1 ; j ++)
52+ for (int i = -rad ; i <= rad ; i ++)
53+ for (int j = -rad ; j <= rad ; j ++)
5254 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX + i , mouseHit .blockY , mouseHit .blockZ + j , par3 , par4ItemStack , par5 );
5355 break ;
5456 case 2 :
5557 case 3 ://x,y
56- for (int i = -1 ; i <= 1 ; i ++)
57- for (int j = -1 ; j <= 1 ; j ++)
58+ for (int i = -rad ; i <= rad ; i ++)
59+ for (int j = -rad ; j <= rad ; j ++)
5860 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX + i , mouseHit .blockY + j , mouseHit .blockZ , par3 , par4ItemStack , par5 );
5961 break ;
6062 case 4 :
6163 case 5 ://y,z
62- for (int i = -1 ; i <= 1 ; i ++)
63- for (int j = -1 ; j <= 1 ; j ++)
64+ for (int i = -rad ; i <= rad ; i ++)
65+ for (int j = -rad ; j <= rad ; j ++)
6466 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX , mouseHit .blockY + i , mouseHit .blockZ + j , par3 , par4ItemStack , par5 );
6567 break ;
6668 }
6769 break ;
6870 case 2 ://x,z
69- for (int i = -1 ; i <= 1 ; i ++)
70- for (int j = -1 ; j <= 1 ; j ++)
71+ for (int i = -rad ; i <= rad ; i ++)
72+ for (int j = -rad ; j <= rad ; j ++)
7173 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX + i , mouseHit .blockY , mouseHit .blockZ + j , par3 , par4ItemStack , par5 );
7274 break ;
7375 case 3 :
@@ -76,21 +78,21 @@ public static boolean drawMoreSelectionBox(EntityPlayer player, MovingObjectPosi
7678 while (rotationYaw < -360 ) rotationYaw += 360F ;
7779 if ((-135 <= rotationYaw && rotationYaw <= -45 ) || (-315 <= rotationYaw && rotationYaw <= -225 )) {
7880 //y,z
79- for (int i = -1 ; i <= 1 ; i ++)
80- for (int j = -1 ; j <= 1 ; j ++)
81+ for (int i = -rad ; i <= rad ; i ++)
82+ for (int j = -rad ; j <= rad ; j ++)
8183 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX , mouseHit .blockY + i , mouseHit .blockZ + j , par3 , par4ItemStack , par5 );
8284 } else if ((-225 <= rotationYaw && rotationYaw <= -135 ) || -45 <= rotationYaw || rotationYaw <= -315 ) {
8385 //x,y
84- for (int i = -1 ; i <= 1 ; i ++)
85- for (int j = -1 ; j <= 1 ; j ++)
86+ for (int i = -rad ; i <= rad ; i ++)
87+ for (int j = -rad ; j <= rad ; j ++)
8688 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX + i , mouseHit .blockY + j , mouseHit .blockZ , par3 , par4ItemStack , par5 );
8789 }
8890 break ;
8991 case 4 :
9092 //x,y,z
91- for (int i = -1 ; i <= 1 ; i ++)
92- for (int j = -1 ; j <= 1 ; j ++)
93- for (int k = -1 ; k <= 1 ; k ++)
93+ for (int i = -rad ; i <= rad ; i ++)
94+ for (int j = -rad ; j <= rad ; j ++)
95+ for (int k = -rad ; k <= rad ; k ++)
9496 drawSelectionBox (player , mouseHit .typeOfHit , mouseHit .blockX + i , mouseHit .blockY + j , mouseHit .blockZ + k , par3 , par4ItemStack , par5 );
9597 break ;
9698 }
@@ -260,9 +262,11 @@ private static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB) {
260262 public static void register () {
261263 if (!inited ) {
262264 inited = true ;
263- DetravDrawBlockHighlightEventHandler handler = new DetravDrawBlockHighlightEventHandler ();
264- MinecraftForge .EVENT_BUS .register (handler );
265- FMLCommonHandler .instance ().bus ().register (handler );
265+ if (DetravConfig .DIGGING_HIGHLIGHT ) {
266+ DetravDrawBlockHighlightEventHandler handler = new DetravDrawBlockHighlightEventHandler ();
267+ MinecraftForge .EVENT_BUS .register (handler );
268+ FMLCommonHandler .instance ().bus ().register (handler );
269+ }
266270 }
267271 }
268272}
0 commit comments