-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
244 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
src/main/java/com/extra/commands/mining/coalNukerCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
package com.extra.commands.mining; | ||
|
||
import com.extra.data.MITconfig; | ||
import com.extra.utils.chatUtils.SendChat; | ||
import gg.essential.api.commands.Command; | ||
import gg.essential.api.commands.DefaultHandler; | ||
|
||
public class coalNukerCommand extends Command { | ||
public static boolean coalNukerIsOn = false; | ||
public static boolean coalVroomVroom = false; | ||
|
||
public coalNukerCommand() { | ||
super("coalnuker"); | ||
} | ||
|
||
@DefaultHandler | ||
public void handle() { | ||
coalNukerIsOn = !coalNukerIsOn; | ||
String str = null; | ||
|
||
if (MITconfig.coalVroomVroomMode) { | ||
coalNukerIsOn = !coalNukerIsOn; | ||
str = coalNukerIsOn ? "Coal Nuker Enabled!" : "Coal Nuker Disabled!"; | ||
} else { | ||
coalVroomVroom = !coalVroomVroom; | ||
str = coalVroomVroom ? "Coal Nuker Enabled!" : "Coal Nuker Disabled!"; | ||
} | ||
|
||
String str = coalNukerIsOn ? "Coal Nuker Enabled!" : "Coal Nuker Disabled!"; | ||
SendChat.chat("§l§4[MINING IN TWO]§r " + str); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/com/extra/features/mining/coalNuker/coalNuker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.extra.features.mining.coalNuker; | ||
|
||
import com.extra.data.currentNukedBlock; | ||
import com.extra.utils.getBlocks.getBlocksInRange; | ||
import com.extra.utils.packets.getBlockEnum; | ||
import com.extra.utils.packets.sendStart; | ||
import com.extra.utils.packets.sendStop; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import static com.extra.commands.mining.coalNukerCommand.coalNukerIsOn; | ||
import static com.extra.data.MITconfig.nukerRange; | ||
|
||
public class coalNuker { | ||
private final Set<BlockPos> destroyedBlocks = ConcurrentHashMap.newKeySet(); | ||
|
||
private BlockPos tickPos; | ||
private boolean nextTick = false; | ||
private int tickCounter = 0; | ||
private boolean sent = false; | ||
private final Block[] blockType = {Blocks.coal_ore} ; | ||
private BlockPos coalBlock; | ||
|
||
@SubscribeEvent | ||
public void onTick(TickEvent.PlayerTickEvent event) { | ||
if (coalNukerIsOn) { | ||
int range = nukerRange; | ||
|
||
if (tickCounter == 0) { | ||
coalBlock = getBlocksInRange.getBlocksMain(range, destroyedBlocks, blockType); | ||
} | ||
|
||
if (coalBlock != null) { | ||
if (nextTick && tickCounter >= 4) { | ||
sendStop.sendStopPacket(tickPos, getBlockEnum.getEnum(tickPos)); | ||
nextTick = false; | ||
sent = false; | ||
tickCounter = 0; | ||
} | ||
|
||
//ps: i do not know y destroyed blocks no work but if u can tell, dm! (dont think this effects performance) | ||
|
||
if (destroyedBlocks.size() > 10){ | ||
destroyedBlocks.clear(); | ||
} | ||
|
||
|
||
if (!sent) { | ||
sendStart.sendStartPacket(coalBlock, getBlockEnum.getEnum(coalBlock)); | ||
currentNukedBlock.blockBeingNuked = coalBlock; | ||
|
||
nextTick = true; | ||
tickPos = coalBlock; | ||
|
||
sent = true; | ||
//destroyedBlocks.add(coalBlock); | ||
} else { | ||
tickCounter++; | ||
} | ||
|
||
} else { | ||
currentNukedBlock.blockBeingNuked = null; | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/com/extra/features/mining/coalNuker/coalNukerVroomVroom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.extra.features.mining.coalNuker; | ||
|
||
import com.extra.commands.farming.cropNukerCommand; | ||
import com.extra.data.currentNukedBlock; | ||
import com.extra.utils.getBlocks.getBlocksInRange; | ||
import com.extra.utils.packets.getBlockEnum; | ||
import com.extra.utils.packets.sendStart; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import static com.extra.commands.mining.coalNukerCommand.coalVroomVroom; | ||
import static com.extra.data.MITconfig.nukerRange; | ||
|
||
public class coalNukerVroomVroom { | ||
private final Set<BlockPos> destroyedBlocks = ConcurrentHashMap.newKeySet(); | ||
public static int tickCount = cropNukerCommand.BPS; | ||
private final Block[] blockType = {Blocks.coal_ore} ; | ||
|
||
@SubscribeEvent | ||
public void onTick(TickEvent.PlayerTickEvent event) { | ||
if (coalVroomVroom && event.phase == TickEvent.Phase.END) { | ||
int range = nukerRange; | ||
|
||
if (getBlocksInRange.getBlocksMain(range, destroyedBlocks, blockType) != null) { | ||
|
||
if (tickCount >= 1) { | ||
BlockPos coalBlockPos = getBlocksInRange.getBlocksMain(range, destroyedBlocks, blockType); | ||
|
||
if (destroyedBlocks.size() >= 20) { | ||
destroyedBlocks.clear(); | ||
} | ||
|
||
sendStart.sendStartPacket(coalBlockPos, getBlockEnum.getEnum(coalBlockPos)); | ||
|
||
currentNukedBlock.blockBeingNuked = coalBlockPos; | ||
|
||
destroyedBlocks.add(coalBlockPos); | ||
|
||
tickCount = 0; | ||
} | ||
|
||
tickCount++; | ||
} else { | ||
currentNukedBlock.blockBeingNuked = null; | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/extra/utils/getUtils/checkIfItemInInv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.extra.utils.getUtils; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class checkIfItemInInv { | ||
|
||
public static Minecraft mc = Minecraft.getMinecraft(); | ||
public static boolean checkIfItemInInv(Item item) { | ||
for (int i = 0; i < 8; i++) { | ||
ItemStack stack = mc.thePlayer.inventory.mainInventory[i]; | ||
|
||
if (stack != null && stack.getItem() == item) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.extra.utils.getUtils; | ||
|
||
import com.extra.data.MITconfig; | ||
|
||
public class getBPS { | ||
public static int getBPS() { | ||
int BPS = MITconfig.cropNukerBPS; | ||
|
||
switch (BPS) { | ||
case 0: | ||
BPS = 1; | ||
break; | ||
|
||
case 1: | ||
BPS = 2; | ||
break; | ||
|
||
case 2: | ||
BPS = 4; | ||
break; | ||
} | ||
|
||
return BPS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.extra.utils.getUtils; | ||
|
||
import com.extra.data.MITconfig; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.init.Blocks; | ||
|
||
public class getCropType { | ||
public static Block getCropType() { | ||
int cropType = MITconfig.cropNukerType; | ||
Block crop = Blocks.wheat; | ||
if (cropType == 1) { | ||
crop = Blocks.carrots; | ||
} else if (cropType == 2) { | ||
crop = Blocks.potatoes; | ||
} else if (cropType == 3) { | ||
crop = Blocks.nether_wart; | ||
} else if (cropType == 4) { | ||
crop = Blocks.pumpkin; | ||
} else if (cropType == 5) { | ||
crop = Blocks.melon_block; | ||
} else if (cropType == 6) { | ||
crop = Blocks.cocoa; | ||
} | ||
|
||
return crop; | ||
} | ||
} |
Oops, something went wrong.