Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
lolhol authored Feb 24, 2023
1 parent 7e5a37a commit be9a9f2
Show file tree
Hide file tree
Showing 12 changed files with 244 additions and 68 deletions.
6 changes: 1 addition & 5 deletions src/main/java/com/extra/MITExtras.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.extra;

import com.extra.commands.KeyBinds.coalNukerBind;
import com.extra.commands.farming.ExtrasCommand;
import com.extra.commands.farming.NukerCommand;
import com.extra.commands.farming.continueNukerCommand;
Expand All @@ -11,8 +10,7 @@
import com.extra.features.farming.ESP.currentNukedBlockESP;
import com.extra.features.farming.cropNuker;
import com.extra.features.farming.gardenNuker;
import com.extra.features.mining.coalNuker;
import com.extra.utils.chatUtils.SendChat;
import com.extra.features.mining.coalNuker.coalNuker;
import com.extra.utils.onKeyPress;
import com.extra.utils.random.MacroUtil;
import gg.essential.api.EssentialAPI;
Expand All @@ -23,8 +21,6 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/extra/commands/farming/NukerCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.extra.commands.farming;

import com.extra.utils.chatUtils.SendChat;
import com.extra.utils.random.checkIfItemInInv;
import com.extra.utils.getUtils.checkIfItemInInv;
import gg.essential.api.commands.Command;
import gg.essential.api.commands.DefaultHandler;
import net.minecraft.init.Items;
Expand Down
28 changes: 5 additions & 23 deletions src/main/java/com/extra/commands/farming/cropNukerCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.extra.commands.farming;

import com.extra.data.MITconfig;
import com.extra.utils.chatUtils.SendChat;
import com.extra.utils.getUtils.getBPS;
import com.extra.utils.getUtils.getCropType;
import gg.essential.api.commands.Command;
import gg.essential.api.commands.DefaultHandler;
import net.minecraft.block.Block;
Expand All @@ -16,35 +17,16 @@ public cropNukerCommand() {
}

public static Block cropType = Blocks.wheat;
public static int BPS = 1;

@DefaultHandler
public void handle() {
cropNuker = !cropNuker;

cropType = getCropType();
cropType = getCropType.getCropType();
BPS = getBPS.getBPS();

String str = cropNuker ? "Crop Nuker Enabled!" : "Crop Nuker Disabled!";
SendChat.chat("§l§4[MINING IN TWO]§r " + str);
}

private 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;
}

}
13 changes: 11 additions & 2 deletions src/main/java/com/extra/commands/mining/coalNukerCommand.java
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);
}
}
10 changes: 5 additions & 5 deletions src/main/java/com/extra/data/MITconfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ public class MITconfig extends Vigilant {
)
public static int nukerRange = 4;

//----------------------------------------------------------------
// Crop Nuker
//----------------------------------------------------------------

@Property(
type = PropertyType.SELECTOR, name = "Nuker Crop Type", description = "Customise what crops the crop nuker will nuke. (only crop)", category = "Nuker", options = {"Wheat", "Carrot", "Potato", "Warts", "Pumpkin", "Melon", "Cocoa"})
public static int cropNukerType = 0;

@Property(
type = PropertyType.SELECTOR, name = "Crop Nuker Blocks/Second", description = "Customise how fast the nuker breaks blocks. (Ps: yes, ik this is slow but i still dono how to make it faster.) This is only for crop nuker !", category = "Nuker", options = {"10 BPS", "5 BPS"}
type = PropertyType.SELECTOR, name = "Crop Nuker Blocks/Second", description = "Customise how fast the nuker breaks blocks. (Ps: yes, ik this is slow but i still dono how to make it faster.) This is only for crop nuker !", category = "Nuker", options = {"(NEW!) 20 BPS", "10 BPS", "5 BPS"}
)
public static int cropNukerBPS = 1;

@Property(
type = PropertyType.SWITCH, name = "Coal ping-less(ish) mode", description = "!!WARNING!! USE ONLY IF U CAN 100% INSTABREAK COAL IF U CANT, THIS FEATURE IS USELESS!", category = "Nuker")
public static boolean coalVroomVroomMode = false;

//----------------------------------------------------------------
// ESP
//----------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/extra/features/farming/cropNuker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.extra.features.farming;

import com.extra.data.MITconfig;
import com.extra.commands.farming.cropNukerCommand;
import com.extra.data.currentNukedBlock;
import com.extra.utils.getBlocks.getBlocksInRange;
import com.extra.utils.packets.sendStart;
Expand All @@ -21,7 +21,7 @@ public class cropNuker {
private final Set<BlockPos> destroyedBlocks = ConcurrentHashMap.newKeySet();


public static int tickCount = MITconfig.cropNukerBPS * 2;
public static int tickCount = cropNukerCommand.BPS;
@SubscribeEvent
public void onTick(TickEvent.PlayerTickEvent event) {
if (cropNuker && event.phase == TickEvent.Phase.END) {
Expand All @@ -30,10 +30,10 @@ public void onTick(TickEvent.PlayerTickEvent event) {

if (getBlocksInRange.getBlocksMain(range, destroyedBlocks, crop) != null) {

if (tickCount >= 1) {
if (tickCount >= cropNukerCommand.BPS) {
BlockPos cropCords = getBlocksInRange.getBlocksMain(range, destroyedBlocks, crop);

if (destroyedBlocks.size() >= 40) {
if (destroyedBlocks.size() >= 100) {
destroyedBlocks.clear();
}

Expand Down
72 changes: 72 additions & 0 deletions src/main/java/com/extra/features/mining/coalNuker/coalNuker.java
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;
}
}
}
}
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 src/main/java/com/extra/utils/getUtils/checkIfItemInInv.java
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;
}
}
25 changes: 25 additions & 0 deletions src/main/java/com/extra/utils/getUtils/getBPS.java
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;
}
}
27 changes: 27 additions & 0 deletions src/main/java/com/extra/utils/getUtils/getCropType.java
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;
}
}
Loading

0 comments on commit be9a9f2

Please sign in to comment.