Skip to content

Commit

Permalink
+ Added Configurations
Browse files Browse the repository at this point in the history
Former-commit-id: a083c8d
  • Loading branch information
Detrav committed Oct 18, 2017
1 parent 2e89e1f commit 091a4e7
Show file tree
Hide file tree
Showing 20 changed files with 308 additions and 1,965 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.4.1566-1.7.10

detravscanner.version=gt.9.31-0.43.0
detravscanner.version=gt.9.31-0.44.0

ae2.version=rv2-beta-33
applecore.version=1.7.10-1.2.1+107.59407
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/detrav/DetravScannerMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.detrav.events.DetravBlockBreakEventHandler;
import com.detrav.events.DetravLoginEventHandler;
import com.detrav.proxies.CommonProxy;
import com.detrav.utils.DetravConfig;
import com.detrav.utils.DetravCreativeTab;
import com.detrav.net.DetravNetwork;
import cpw.mods.fml.common.Mod;
Expand All @@ -23,7 +24,7 @@
public class DetravScannerMod
{
public static final String MODID = "detravscannermod";
public static final String VERSION = "0.43";
public static final String VERSION = "0.44";

public static final CreativeTabs TAB_DETRAV = new DetravCreativeTab();

Expand All @@ -35,20 +36,19 @@ public class DetravScannerMod

public DetravScannerMod()
{
GregTech_API.sAfterGTPreload.add(new Detrav_AfterGTPreload_Loader());

new DetravNetwork();
}

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
Configuration Config = new Configuration(event.getSuggestedConfigurationFile());
Config.load();


if (Config.hasChanged()){
Config.save();
}
public void preLoad(FMLPreInitializationEvent event) {
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
new DetravConfig(config);
proxy.onPreLoad();
}

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
proxy.onPreInit();
}

Expand Down
47 changes: 0 additions & 47 deletions src/main/java/com/detrav/Detrav_AfterGTPreload_Loader.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package com.detrav.commands;

import com.detrav.utils.DetravConfig;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import scala.Int;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.List;

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

@Override
public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) {
return true;
return DetravConfig.BIOME_SCANNER_ENABLE;
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/detrav/enums/DetravItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public enum DetravItemList implements IItemContainer {
Shape_Extruder_ProPick,
Solar_Boiler_Low,
Solar_Boiler_Medium,
Solar_Boiler_High,
ConfiguredCircuit;
Solar_Boiler_High;


private ItemStack mStack;
Expand Down
28 changes: 16 additions & 12 deletions src/main/java/com/detrav/events/DetravBlockBreakEventHandler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.detrav.events;

import com.detrav.utils.DetravConfig;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import gregtech.api.items.GT_Generic_Item;
Expand Down Expand Up @@ -41,6 +42,7 @@ public void onBreakBlock(BlockEvent.BreakEvent ev) {
long minningMode = entityData.getLong("detrav.minning.mode");
if (minningMode == 0) return;
int side = 0;
int rad = DetravConfig.DIGGING_RADIUS;
switch ((int) minningMode) {
case 1:
Vec3 vec3 = Vec3.createVectorHelper(player.posX, player.posY + 1.62f, player.posZ);
Expand Down Expand Up @@ -69,25 +71,25 @@ else if ((-225 <= rotationYaw && rotationYaw <= -135) || -45 <= rotationYaw || r
case 0:
case 1:
// if (ev.getPlayer().rotationPitch > 45 || ev.getPlayer().rotationPitch < -45) {
for (int i = ev.x - 1; i <= ev.x + 1; i++)
for (int j = ev.z - 1; j <= ev.z + 1; j++)
for (int i = ev.x - rad; i <= ev.x + rad; i++)
for (int j = ev.z - rad; j <= ev.z + rad; j++)
if (i != ev.x || j != ev.z)
tryHarvestBlock(i, ev.y, j, ev);
break;
// and (-45 > x > -135) and (-135 > x > -225) and (-225 > x > -315) or (-315 > x > -45)
// } else if ((-135 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -45) || (-315 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -225)) {
case 4:
case 5:
for (int i = ev.z - 1; i <= ev.z + 1; i++)
for (int j = ev.y - 1; j <= ev.y + 1; j++)
for (int i = ev.z - rad; i <= ev.z + rad; i++)
for (int j = ev.y - rad; j <= ev.y + rad; j++)
if (i != ev.z || j != ev.y)
tryHarvestBlock(ev.x, j, i, ev);
break;
// } else if ((-225 <= ev.getPlayer().rotationYaw && ev.getPlayer().rotationYaw <= -135) || -45 <= ev.getPlayer().rotationYaw || ev.getPlayer().rotationYaw <= -315) {
case 2:
case 3:
for (int i = ev.x - 1; i <= ev.x + 1; i++)
for (int j = ev.y - 1; j <= ev.y + 1; j++)
for (int i = ev.x - rad; i <= ev.x + rad; i++)
for (int j = ev.y - rad; j <= ev.y + rad; j++)
if (i != ev.x || j != ev.y)
tryHarvestBlock(i, j, ev.z, ev);
break;
Expand All @@ -96,9 +98,9 @@ else if ((-225 <= rotationYaw && rotationYaw <= -135) || -45 <= rotationYaw || r
}
else {
// if (ev.getPlayer().rotationPitch > 45 || ev.getPlayer().rotationPitch < -45) {
for (int i = ev.x - 1; i <= ev.x + 1; i++)
for (int j = ev.y - 1; j <= ev.y + 1; j++)
for (int k = ev.z - 1; k <= ev.z + 1; k++)
for (int i = ev.x - rad; i <= ev.x + rad; i++)
for (int j = ev.y - rad; j <= ev.y + rad; j++)
for (int k = ev.z - rad; k <= ev.z + rad; k++)
if (i != ev.x || j != ev.y || k != ev.z)
if (ev.block == ev.world.getBlock(i, j, k) && (ev.blockMetadata == ev.world.getBlockMetadata(i, j, k)))
tryHarvestBlock(i, j, k, ev);
Expand Down Expand Up @@ -236,9 +238,11 @@ static int rayTrace(World w, Block block, int blockMetadata, Vec3 playerPos, Vec
public static void register() {
if (!inited) {
inited = true;
DetravBlockBreakEventHandler handler = new DetravBlockBreakEventHandler();
MinecraftForge.EVENT_BUS.register(handler);
FMLCommonHandler.instance().bus().register(handler);
if(DetravConfig.DIGGING_ENABLE) {
DetravBlockBreakEventHandler handler = new DetravBlockBreakEventHandler();
MinecraftForge.EVENT_BUS.register(handler);
FMLCommonHandler.instance().bus().register(handler);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.detrav.events;

import com.detrav.utils.DetravConfig;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -38,6 +39,7 @@ public void onDrawBlockHighlight(DrawBlockHighlightEvent e) {
}

public static boolean drawMoreSelectionBox(EntityPlayer player, MovingObjectPosition mouseHit, int par3, ItemStack par4ItemStack, float par5) {
int rad = DetravConfig.DIGGING_RADIUS;
switch ((int) modeBlockBreak) {
//case 0: Просто рисуем без экспанда
case 0:
Expand All @@ -47,27 +49,27 @@ public static boolean drawMoreSelectionBox(EntityPlayer player, MovingObjectPosi
switch (mouseHit.sideHit) {//Рисуеи по моусхиту
case 0:
case 1://x,z
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX + i, mouseHit.blockY, mouseHit.blockZ + j, par3, par4ItemStack, par5);
break;
case 2:
case 3://x,y
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX + i, mouseHit.blockY + j, mouseHit.blockZ, par3, par4ItemStack, par5);
break;
case 4:
case 5://y,z
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX, mouseHit.blockY + i, mouseHit.blockZ + j, par3, par4ItemStack, par5);
break;
}
break;
case 2://x,z
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX + i, mouseHit.blockY, mouseHit.blockZ + j, par3, par4ItemStack, par5);
break;
case 3:
Expand All @@ -76,21 +78,21 @@ public static boolean drawMoreSelectionBox(EntityPlayer player, MovingObjectPosi
while (rotationYaw < -360) rotationYaw += 360F;
if ((-135 <= rotationYaw && rotationYaw <= -45) || (-315 <= rotationYaw && rotationYaw <= -225)) {
//y,z
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX, mouseHit.blockY + i, mouseHit.blockZ + j, par3, par4ItemStack, par5);
} else if ((-225 <= rotationYaw && rotationYaw <= -135) || -45 <= rotationYaw || rotationYaw <= -315) {
//x,y
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX + i, mouseHit.blockY + j, mouseHit.blockZ, par3, par4ItemStack, par5);
}
break;
case 4:
//x,y,z
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int k = -1; k <= 1; k++)
for (int i = -rad; i <= rad; i++)
for (int j = -rad; j <= rad; j++)
for (int k = -rad; k <= rad; k++)
drawSelectionBox(player, mouseHit.typeOfHit, mouseHit.blockX + i, mouseHit.blockY + j, mouseHit.blockZ + k, par3, par4ItemStack, par5);
break;
}
Expand Down Expand Up @@ -260,9 +262,11 @@ private static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB) {
public static void register() {
if (!inited) {
inited = true;
DetravDrawBlockHighlightEventHandler handler = new DetravDrawBlockHighlightEventHandler();
MinecraftForge.EVENT_BUS.register(handler);
FMLCommonHandler.instance().bus().register(handler);
if (DetravConfig.DIGGING_HIGHLIGHT) {
DetravDrawBlockHighlightEventHandler handler = new DetravDrawBlockHighlightEventHandler();
MinecraftForge.EVENT_BUS.register(handler);
FMLCommonHandler.instance().bus().register(handler);
}
}
}
}
11 changes: 7 additions & 4 deletions src/main/java/com/detrav/events/DetravKeyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.detrav.net.DetravModeSwitchPacket02;
import com.detrav.net.DetravNetwork;
import com.detrav.utils.DetravConfig;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
Expand All @@ -21,10 +22,12 @@ public class DetravKeyHandler {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (modeSwitchKey.isPressed()) {
if (Minecraft.getMinecraft().thePlayer.isSneaking())
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, true));
else
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, false));
if(DetravConfig.DIGGING_ENABLE) {
if (Minecraft.getMinecraft().thePlayer.isSneaking())
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, true));
else
DetravNetwork.INSTANCE.sendToServer(new DetravModeSwitchPacket02(Minecraft.getMinecraft().thePlayer, false));
}
//Minecraft.getMinecraft().thePlayer.getEntityData().
}
}
Expand Down
Loading

0 comments on commit 091a4e7

Please sign in to comment.