Skip to content

Commit 091a4e7

Browse files
committed
+ Added Configurations
Former-commit-id: a083c8d
1 parent 2e89e1f commit 091a4e7

20 files changed

+308
-1965
lines changed

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
minecraft.version=1.7.10
22
forge.version=10.13.4.1566-1.7.10
33

4-
detravscanner.version=gt.9.31-0.43.0
4+
detravscanner.version=gt.9.31-0.44.0
55

66
ae2.version=rv2-beta-33
77
applecore.version=1.7.10-1.2.1+107.59407

src/main/java/com/detrav/DetravScannerMod.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.detrav.events.DetravBlockBreakEventHandler;
66
import com.detrav.events.DetravLoginEventHandler;
77
import com.detrav.proxies.CommonProxy;
8+
import com.detrav.utils.DetravConfig;
89
import com.detrav.utils.DetravCreativeTab;
910
import com.detrav.net.DetravNetwork;
1011
import cpw.mods.fml.common.Mod;
@@ -23,7 +24,7 @@
2324
public class DetravScannerMod
2425
{
2526
public static final String MODID = "detravscannermod";
26-
public static final String VERSION = "0.43";
27+
public static final String VERSION = "0.44";
2728

2829
public static final CreativeTabs TAB_DETRAV = new DetravCreativeTab();
2930

@@ -35,20 +36,19 @@ public class DetravScannerMod
3536

3637
public DetravScannerMod()
3738
{
38-
GregTech_API.sAfterGTPreload.add(new Detrav_AfterGTPreload_Loader());
39+
3940
new DetravNetwork();
4041
}
4142

4243
@EventHandler
43-
public void preInit(FMLPreInitializationEvent event) {
44-
Configuration Config = new Configuration(event.getSuggestedConfigurationFile());
45-
Config.load();
46-
47-
48-
if (Config.hasChanged()){
49-
Config.save();
50-
}
44+
public void preLoad(FMLPreInitializationEvent event) {
45+
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
46+
new DetravConfig(config);
47+
proxy.onPreLoad();
48+
}
5149

50+
@EventHandler
51+
public void preInit(FMLPreInitializationEvent event) {
5252
proxy.onPreInit();
5353
}
5454

src/main/java/com/detrav/Detrav_AfterGTPreload_Loader.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/com/detrav/commands/DetravBiomeScannerCommand.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
package com.detrav.commands;
22

3+
import com.detrav.utils.DetravConfig;
34
import net.minecraft.command.ICommand;
45
import net.minecraft.command.ICommandSender;
56
import net.minecraft.util.ChatComponentText;
67
import net.minecraft.util.ChunkCoordinates;
78
import net.minecraft.world.World;
89
import net.minecraft.world.biome.BiomeGenBase;
9-
import scala.Int;
1010

1111
import javax.imageio.ImageIO;
1212
import java.awt.image.BufferedImage;
1313
import java.awt.image.WritableRaster;
1414
import java.io.File;
15-
import java.io.FileWriter;
1615
import java.io.PrintWriter;
1716
import java.util.ArrayList;
18-
import java.util.Dictionary;
1917
import java.util.HashMap;
2018
import java.util.List;
2119

@@ -99,7 +97,7 @@ public void processCommand(ICommandSender sender, String[] args) {
9997

10098
@Override
10199
public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) {
102-
return true;
100+
return DetravConfig.BIOME_SCANNER_ENABLE;
103101
}
104102

105103
@Override

src/main/java/com/detrav/enums/DetravItemList.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public enum DetravItemList implements IItemContainer {
1717
Shape_Extruder_ProPick,
1818
Solar_Boiler_Low,
1919
Solar_Boiler_Medium,
20-
Solar_Boiler_High,
21-
ConfiguredCircuit;
20+
Solar_Boiler_High;
2221

2322

2423
private ItemStack mStack;

src/main/java/com/detrav/events/DetravBlockBreakEventHandler.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.detrav.events;
22

3+
import com.detrav.utils.DetravConfig;
34
import cpw.mods.fml.common.FMLCommonHandler;
45
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
56
import gregtech.api.items.GT_Generic_Item;
@@ -41,6 +42,7 @@ public void onBreakBlock(BlockEvent.BreakEvent ev) {
4142
long minningMode = entityData.getLong("detrav.minning.mode");
4243
if (minningMode == 0) return;
4344
int side = 0;
45+
int rad = DetravConfig.DIGGING_RADIUS;
4446
switch ((int) minningMode) {
4547
case 1:
4648
Vec3 vec3 = Vec3.createVectorHelper(player.posX, player.posY + 1.62f, player.posZ);
@@ -69,25 +71,25 @@ else if ((-225 <= rotationYaw && rotationYaw <= -135) || -45 <= rotationYaw || r
6971
case 0:
7072
case 1:
7173
// if (ev.getPlayer().rotationPitch > 45 || ev.getPlayer().rotationPitch < -45) {
72-
for (int i = ev.x - 1; i <= ev.x + 1; i++)
73-
for (int j = ev.z - 1; j <= ev.z + 1; j++)
74+
for (int i = ev.x - rad; i <= ev.x + rad; i++)
75+
for (int j = ev.z - rad; j <= ev.z + rad; j++)
7476
if (i != ev.x || j != ev.z)
7577
tryHarvestBlock(i, ev.y, j, ev);
7678
break;
7779
// and (-45 > x > -135) and (-135 > x > -225) and (-225 > x > -315) or (-315 > x > -45)
7880
// } else if ((-135 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -45) || (-315 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -225)) {
7981
case 4:
8082
case 5:
81-
for (int i = ev.z - 1; i <= ev.z + 1; i++)
82-
for (int j = ev.y - 1; j <= ev.y + 1; j++)
83+
for (int i = ev.z - rad; i <= ev.z + rad; i++)
84+
for (int j = ev.y - rad; j <= ev.y + rad; j++)
8385
if (i != ev.z || j != ev.y)
8486
tryHarvestBlock(ev.x, j, i, ev);
8587
break;
8688
// } else if ((-225 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -135) || -45 <= ev.getPlayer().rotationYaw || ev.getPlayer().rotationYaw <= -315) {
8789
case 2:
8890
case 3:
89-
for (int i = ev.x - 1; i <= ev.x + 1; i++)
90-
for (int j = ev.y - 1; j <= ev.y + 1; j++)
91+
for (int i = ev.x - rad; i <= ev.x + rad; i++)
92+
for (int j = ev.y - rad; j <= ev.y + rad; j++)
9193
if (i != ev.x || j != ev.y)
9294
tryHarvestBlock(i, j, ev.z, ev);
9395
break;
@@ -96,9 +98,9 @@ else if ((-225 <= rotationYaw && rotationYaw <= -135) || -45 <= rotationYaw || r
9698
}
9799
else {
98100
// if (ev.getPlayer().rotationPitch > 45 || ev.getPlayer().rotationPitch < -45) {
99-
for (int i = ev.x - 1; i <= ev.x + 1; i++)
100-
for (int j = ev.y - 1; j <= ev.y + 1; j++)
101-
for (int k = ev.z - 1; k <= ev.z + 1; k++)
101+
for (int i = ev.x - rad; i <= ev.x + rad; i++)
102+
for (int j = ev.y - rad; j <= ev.y + rad; j++)
103+
for (int k = ev.z - rad; k <= ev.z + rad; k++)
102104
if (i != ev.x || j != ev.y || k != ev.z)
103105
if (ev.block == ev.world.getBlock(i, j, k) && (ev.blockMetadata == ev.world.getBlockMetadata(i, j, k)))
104106
tryHarvestBlock(i, j, k, ev);
@@ -236,9 +238,11 @@ static int rayTrace(World w, Block block, int blockMetadata, Vec3 playerPos, Vec
236238
public static void register() {
237239
if (!inited) {
238240
inited = true;
239-
DetravBlockBreakEventHandler handler = new DetravBlockBreakEventHandler();
240-
MinecraftForge.EVENT_BUS.register(handler);
241-
FMLCommonHandler.instance().bus().register(handler);
241+
if(DetravConfig.DIGGING_ENABLE) {
242+
DetravBlockBreakEventHandler handler = new DetravBlockBreakEventHandler();
243+
MinecraftForge.EVENT_BUS.register(handler);
244+
FMLCommonHandler.instance().bus().register(handler);
245+
}
242246
}
243247
}
244248

src/main/java/com/detrav/events/DetravDrawBlockHighlightEventHandler.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.detrav.events;
22

3+
import com.detrav.utils.DetravConfig;
34
import cpw.mods.fml.common.FMLCommonHandler;
45
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
56
import 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
}

src/main/java/com/detrav/events/DetravKeyHandler.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.detrav.net.DetravModeSwitchPacket02;
44
import com.detrav.net.DetravNetwork;
5+
import com.detrav.utils.DetravConfig;
56
import cpw.mods.fml.client.registry.ClientRegistry;
67
import cpw.mods.fml.common.FMLCommonHandler;
78
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -21,10 +22,12 @@ public class DetravKeyHandler {
2122
@SubscribeEvent
2223
public void onKeyInput(InputEvent.KeyInputEvent event) {
2324
if (modeSwitchKey.isPressed()) {
24-
if (Minecraft.getMinecraft().thePlayer.isSneaking())
25-
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, true));
26-
else
27-
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, false));
25+
if(DetravConfig.DIGGING_ENABLE) {
26+
if (Minecraft.getMinecraft().thePlayer.isSneaking())
27+
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, true));
28+
else
29+
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, false));
30+
}
2831
//Minecraft.getMinecraft().thePlayer.getEntityData().
2932
}
3033
}

0 commit comments

Comments
 (0)