mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Merge branch 'master' into 20w29a
Conflicts: gradle.properties src/main/java/net/wurstclient/WurstClient.java
This commit is contained in:
commit
1fabaa95b9
@ -12,7 +12,7 @@ loader_version=0.9.0+build.204
|
||||
fabric_version=0.14.6+build.377-1.16
|
||||
|
||||
# Mod Properties
|
||||
mod_version = v7.3-MC20w29a
|
||||
mod_version = v7.4-MC20w29a
|
||||
maven_group = net.wurstclient
|
||||
archives_base_name = Wurst-Client
|
||||
|
||||
|
@ -56,7 +56,7 @@ public enum WurstClient
|
||||
public static final MinecraftClient MC = MinecraftClient.getInstance();
|
||||
public static final IMinecraftClient IMC = (IMinecraftClient)MC;
|
||||
|
||||
public static final String VERSION = "7.3";
|
||||
public static final String VERSION = "7.4";
|
||||
public static final String MC_VERSION = "20w29a";
|
||||
|
||||
private WurstAnalytics analytics;
|
||||
|
@ -506,7 +506,7 @@ public final class ClickGui
|
||||
parent.getY() + 13 + parent.getScrollOffset() + owner.getY();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x1, y1, 0);
|
||||
GL11.glTranslated(x1, y1, 300);
|
||||
|
||||
int cMouseX = mouseX - x1;
|
||||
int cMouseY = mouseY - y1;
|
||||
|
@ -21,6 +21,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
@ -33,6 +34,9 @@ import net.wurstclient.events.LeftClickListener;
|
||||
import net.wurstclient.events.RenderListener;
|
||||
import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.settings.BlockListSetting;
|
||||
import net.wurstclient.settings.BlockSetting;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.EnumSetting;
|
||||
import net.wurstclient.settings.SliderSetting;
|
||||
import net.wurstclient.settings.SliderSetting.ValueDisplay;
|
||||
@ -51,17 +55,34 @@ public final class NukerHack extends Hack
|
||||
"\u00a7lNormal\u00a7r mode simply breaks everything\n" + "around you.\n"
|
||||
+ "\u00a7lID\u00a7r mode only breaks the selected block\n"
|
||||
+ "type. Left-click on a block to select it.\n"
|
||||
+ "\u00a7lMultiID\u00a7r mode only breaks the block types\n"
|
||||
+ "in your MultiID List.\n"
|
||||
+ "\u00a7lFlat\u00a7r mode flattens the area around you,\n"
|
||||
+ "but won't dig down.\n"
|
||||
+ "\u00a7lSmash\u00a7r mode only breaks blocks that\n"
|
||||
+ "can be destroyed instantly (e.g. tall grass).",
|
||||
Mode.values(), Mode.NORMAL);
|
||||
|
||||
private final BlockSetting id =
|
||||
new BlockSetting("ID", "The type of block to break in ID mode.\n"
|
||||
+ "air = won't break anything", "minecraft:air", true);
|
||||
|
||||
private final CheckboxSetting lockId =
|
||||
new CheckboxSetting("Lock ID", "Prevents changing the ID by clicking\n"
|
||||
+ "on blocks or restarting Nuker.", false);
|
||||
|
||||
private final BlockListSetting multiIdList = new BlockListSetting(
|
||||
"MultiID List", "The types of blocks to break in MultiID mode.",
|
||||
"minecraft:ancient_debris", "minecraft:bone_block", "minecraft:clay",
|
||||
"minecraft:coal_ore", "minecraft:diamond_ore", "minecraft:emerald_ore",
|
||||
"minecraft:glowstone", "minecraft:gold_ore", "minecraft:iron_ore",
|
||||
"minecraft:lapis_ore", "minecraft:nether_gold_ore",
|
||||
"minecraft:nether_quartz_ore", "minecraft:redstone_ore");
|
||||
|
||||
private final ArrayDeque<Set<BlockPos>> prevBlocks = new ArrayDeque<>();
|
||||
private BlockPos currentBlock;
|
||||
private float progress;
|
||||
private float prevProgress;
|
||||
private String id;
|
||||
|
||||
public NukerHack()
|
||||
{
|
||||
@ -69,6 +90,9 @@ public final class NukerHack extends Hack
|
||||
setCategory(Category.BLOCKS);
|
||||
addSetting(range);
|
||||
addSetting(mode);
|
||||
addSetting(id);
|
||||
addSetting(lockId);
|
||||
addSetting(multiIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,12 +130,18 @@ public final class NukerHack extends Hack
|
||||
}
|
||||
|
||||
prevBlocks.clear();
|
||||
id = null;
|
||||
|
||||
if(!lockId.isChecked())
|
||||
id.setBlock(Blocks.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
// abort if using IDNuker without an ID being set
|
||||
if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR)
|
||||
return;
|
||||
|
||||
ClientPlayerEntity player = MC.player;
|
||||
|
||||
currentBlock = null;
|
||||
@ -187,13 +217,16 @@ public final class NukerHack extends Hack
|
||||
if(mode.getSelected() != Mode.ID)
|
||||
return;
|
||||
|
||||
if(lockId.isChecked())
|
||||
return;
|
||||
|
||||
if(MC.crosshairTarget == null
|
||||
|| MC.crosshairTarget.getType() != HitResult.Type.BLOCK)
|
||||
return;
|
||||
|
||||
BlockHitResult blockHitResult = (BlockHitResult)MC.crosshairTarget;
|
||||
BlockPos pos = new BlockPos(blockHitResult.getBlockPos());
|
||||
id = BlockUtils.getName(pos);
|
||||
id.setBlockName(BlockUtils.getName(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -243,24 +276,24 @@ public final class NukerHack extends Hack
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LINE_SMOOTH);
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
}
|
||||
|
||||
private enum Mode
|
||||
{
|
||||
NORMAL("Normal", n -> n.getName(), (n, p) -> true),
|
||||
|
||||
ID("ID", n -> "IDNuker [" + n.id + "]",
|
||||
(n, p) -> BlockUtils.getName(p).equals(n.id)),
|
||||
ID("ID",
|
||||
n -> "IDNuker [" + n.id.getBlockName().replace("minecraft:", "")
|
||||
+ "]",
|
||||
(n, p) -> BlockUtils.getName(p).equals(n.id.getBlockName())),
|
||||
|
||||
MULTI_ID("MultiID",
|
||||
n -> "MultiIDNuker [" + n.multiIdList.getBlockNames().size()
|
||||
+ (n.multiIdList.getBlockNames().size() == 1 ? " ID]"
|
||||
: " IDs]"),
|
||||
(n, p) -> n.multiIdList.getBlockNames()
|
||||
.contains(BlockUtils.getName(p))),
|
||||
|
||||
FLAT("Flat", n -> "FlatNuker",
|
||||
(n, p) -> p.getY() >= MC.player.getPos().getY()),
|
||||
|
@ -16,6 +16,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
@ -29,6 +30,9 @@ import net.wurstclient.events.LeftClickListener;
|
||||
import net.wurstclient.events.RenderListener;
|
||||
import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.settings.BlockListSetting;
|
||||
import net.wurstclient.settings.BlockSetting;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.EnumSetting;
|
||||
import net.wurstclient.settings.SliderSetting;
|
||||
import net.wurstclient.settings.SliderSetting.ValueDisplay;
|
||||
@ -47,12 +51,30 @@ public final class NukerLegitHack extends Hack
|
||||
"\u00a7lNormal\u00a7r mode simply breaks everything\n" + "around you.\n"
|
||||
+ "\u00a7lID\u00a7r mode only breaks the selected block\n"
|
||||
+ "type. Left-click on a block to select it.\n"
|
||||
+ "\u00a7lMultiID\u00a7r mode only breaks the block types\n"
|
||||
+ "in your MultiID List.\n"
|
||||
+ "\u00a7lFlat\u00a7r mode flattens the area around you,\n"
|
||||
+ "but won't dig down.\n"
|
||||
+ "\u00a7lSmash\u00a7r mode only breaks blocks that\n"
|
||||
+ "can be destroyed instantly (e.g. tall grass).",
|
||||
Mode.values(), Mode.NORMAL);
|
||||
|
||||
private final BlockSetting id =
|
||||
new BlockSetting("ID", "The type of block to break in ID mode.\n"
|
||||
+ "air = won't break anything", "minecraft:air", true);
|
||||
|
||||
private final CheckboxSetting lockId =
|
||||
new CheckboxSetting("Lock ID", "Prevents changing the ID by clicking\n"
|
||||
+ "on blocks or restarting Nuker.", false);
|
||||
|
||||
private final BlockListSetting multiIdList = new BlockListSetting(
|
||||
"MultiID List", "The types of blocks to break in MultiID mode.",
|
||||
"minecraft:ancient_debris", "minecraft:bone_block", "minecraft:clay",
|
||||
"minecraft:coal_ore", "minecraft:diamond_ore", "minecraft:emerald_ore",
|
||||
"minecraft:glowstone", "minecraft:gold_ore", "minecraft:iron_ore",
|
||||
"minecraft:lapis_ore", "minecraft:nether_gold_ore",
|
||||
"minecraft:nether_quartz_ore", "minecraft:redstone_ore");
|
||||
|
||||
private BlockPos currentBlock;
|
||||
|
||||
public NukerLegitHack()
|
||||
@ -64,12 +86,15 @@ public final class NukerLegitHack extends Hack
|
||||
setCategory(Category.BLOCKS);
|
||||
addSetting(range);
|
||||
addSetting(mode);
|
||||
addSetting(id);
|
||||
addSetting(lockId);
|
||||
addSetting(multiIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderName()
|
||||
{
|
||||
return mode.getSelected().getRenderName(WURST.getHax().nukerHack);
|
||||
return mode.getSelected().getRenderName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,12 +124,20 @@ public final class NukerLegitHack extends Hack
|
||||
// resets
|
||||
MC.options.keyAttack.setPressed(false);
|
||||
currentBlock = null;
|
||||
WURST.getHax().nukerHack.setId(null);
|
||||
if(!lockId.isChecked())
|
||||
id.setBlock(Blocks.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeftClick(LeftClickEvent event)
|
||||
{
|
||||
// check mode
|
||||
if(mode.getSelected() != Mode.ID)
|
||||
return;
|
||||
|
||||
if(lockId.isChecked())
|
||||
return;
|
||||
|
||||
// check hitResult
|
||||
if(MC.crosshairTarget == null
|
||||
|| !(MC.crosshairTarget instanceof BlockHitResult))
|
||||
@ -116,27 +149,22 @@ public final class NukerLegitHack extends Hack
|
||||
|| BlockUtils.getState(pos).getMaterial() == Material.AIR)
|
||||
return;
|
||||
|
||||
// check mode
|
||||
if(mode.getSelected() != Mode.ID)
|
||||
return;
|
||||
|
||||
// set id
|
||||
WURST.getHax().nukerHack.setId(BlockUtils.getName(pos));
|
||||
id.setBlockName(BlockUtils.getName(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
// abort if using IDNuker without an ID being set
|
||||
if(mode.getSelected() == Mode.ID
|
||||
&& WURST.getHax().nukerHack.getId() == null)
|
||||
if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR)
|
||||
return;
|
||||
|
||||
currentBlock = null;
|
||||
|
||||
// get valid blocks
|
||||
Iterable<BlockPos> validBlocks = getValidBlocks(range.getValue(),
|
||||
mode.getSelected().getValidator(WURST.getHax().nukerHack));
|
||||
mode.getSelected().getValidator(this));
|
||||
|
||||
// find closest valid block
|
||||
for(BlockPos pos : validBlocks)
|
||||
@ -286,8 +314,17 @@ public final class NukerLegitHack extends Hack
|
||||
{
|
||||
NORMAL("Normal", n -> "NukerLegit", (n, p) -> true),
|
||||
|
||||
ID("ID", n -> "IDNukerLegit [" + n.getId() + "]",
|
||||
(n, p) -> BlockUtils.getName(p).equals(n.getId())),
|
||||
ID("ID",
|
||||
n -> "IDNukerLegit ["
|
||||
+ n.id.getBlockName().replace("minecraft:", "") + "]",
|
||||
(n, p) -> BlockUtils.getName(p).equals(n.id.getBlockName())),
|
||||
|
||||
MULTI_ID("MultiID",
|
||||
n -> "MultiIDNuker [" + n.multiIdList.getBlockNames().size()
|
||||
+ (n.multiIdList.getBlockNames().size() == 1 ? " ID]"
|
||||
: " IDs]"),
|
||||
(n, p) -> n.multiIdList.getBlockNames()
|
||||
.contains(BlockUtils.getName(p))),
|
||||
|
||||
FLAT("Flat", n -> "FlatNukerLegit",
|
||||
(n, p) -> p.getY() >= MC.player.getPos().getY()),
|
||||
@ -296,11 +333,11 @@ public final class NukerLegitHack extends Hack
|
||||
(n, p) -> BlockUtils.getHardness(p) >= 1);
|
||||
|
||||
private final String name;
|
||||
private final Function<NukerHack, String> renderName;
|
||||
private final BiPredicate<NukerHack, BlockPos> validator;
|
||||
private final Function<NukerLegitHack, String> renderName;
|
||||
private final BiPredicate<NukerLegitHack, BlockPos> validator;
|
||||
|
||||
private Mode(String name, Function<NukerHack, String> renderName,
|
||||
BiPredicate<NukerHack, BlockPos> validator)
|
||||
private Mode(String name, Function<NukerLegitHack, String> renderName,
|
||||
BiPredicate<NukerLegitHack, BlockPos> validator)
|
||||
{
|
||||
this.name = name;
|
||||
this.renderName = renderName;
|
||||
@ -313,12 +350,12 @@ public final class NukerLegitHack extends Hack
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRenderName(NukerHack n)
|
||||
public String getRenderName(NukerLegitHack n)
|
||||
{
|
||||
return renderName.apply(n);
|
||||
}
|
||||
|
||||
public Predicate<BlockPos> getValidator(NukerHack n)
|
||||
public Predicate<BlockPos> getValidator(NukerLegitHack n)
|
||||
{
|
||||
return p -> validator.test(n, p);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public final class SearchHack extends Hack
|
||||
implements UpdateListener, PacketInputListener, RenderListener
|
||||
{
|
||||
private final BlockSetting block = new BlockSetting("Block",
|
||||
"The type of block to search for.", "minecraft:diamond_ore");
|
||||
"The type of block to search for.", "minecraft:diamond_ore", false);
|
||||
|
||||
private final EnumSetting<Area> area = new EnumSetting<>("Area",
|
||||
"The area around the player to search in.\n"
|
||||
|
@ -10,10 +10,12 @@ package net.wurstclient.hacks;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -23,6 +25,9 @@ import net.wurstclient.SearchTags;
|
||||
import net.wurstclient.events.LeftClickListener;
|
||||
import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.settings.BlockListSetting;
|
||||
import net.wurstclient.settings.BlockSetting;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.EnumSetting;
|
||||
import net.wurstclient.settings.SliderSetting;
|
||||
import net.wurstclient.settings.SliderSetting.ValueDisplay;
|
||||
@ -37,8 +42,33 @@ public final class SpeedNukerHack extends Hack
|
||||
private final SliderSetting range =
|
||||
new SliderSetting("Range", 5, 1, 6, 0.05, ValueDisplay.DECIMAL);
|
||||
|
||||
private final EnumSetting<Mode> mode =
|
||||
new EnumSetting<>("Mode", Mode.values(), Mode.NORMAL);
|
||||
private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
|
||||
"\u00a7lNormal\u00a7r mode simply breaks everything\n" + "around you.\n"
|
||||
+ "\u00a7lID\u00a7r mode only breaks the selected block\n"
|
||||
+ "type. Left-click on a block to select it.\n"
|
||||
+ "\u00a7lMultiID\u00a7r mode only breaks the block types\n"
|
||||
+ "in your MultiID List.\n"
|
||||
+ "\u00a7lFlat\u00a7r mode flattens the area around you,\n"
|
||||
+ "but won't dig down.\n"
|
||||
+ "\u00a7lSmash\u00a7r mode only breaks blocks that\n"
|
||||
+ "can be destroyed instantly (e.g. tall grass).",
|
||||
Mode.values(), Mode.NORMAL);
|
||||
|
||||
private final BlockSetting id =
|
||||
new BlockSetting("ID", "The type of block to break in ID mode.\n"
|
||||
+ "air = won't break anything", "minecraft:air", true);
|
||||
|
||||
private final CheckboxSetting lockId =
|
||||
new CheckboxSetting("Lock ID", "Prevents changing the ID by clicking\n"
|
||||
+ "on blocks or restarting Nuker.", false);
|
||||
|
||||
private final BlockListSetting multiIdList = new BlockListSetting(
|
||||
"MultiID List", "The types of blocks to break in MultiID mode.",
|
||||
"minecraft:ancient_debris", "minecraft:bone_block", "minecraft:clay",
|
||||
"minecraft:coal_ore", "minecraft:diamond_ore", "minecraft:emerald_ore",
|
||||
"minecraft:glowstone", "minecraft:gold_ore", "minecraft:iron_ore",
|
||||
"minecraft:lapis_ore", "minecraft:nether_gold_ore",
|
||||
"minecraft:nether_quartz_ore", "minecraft:redstone_ore");
|
||||
|
||||
public SpeedNukerHack()
|
||||
{
|
||||
@ -48,12 +78,15 @@ public final class SpeedNukerHack extends Hack
|
||||
setCategory(Category.BLOCKS);
|
||||
addSetting(range);
|
||||
addSetting(mode);
|
||||
addSetting(id);
|
||||
addSetting(lockId);
|
||||
addSetting(multiIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRenderName()
|
||||
{
|
||||
return mode.getSelected().renderName.get();
|
||||
return mode.getSelected().renderName.apply(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,20 +112,20 @@ public final class SpeedNukerHack extends Hack
|
||||
EVENTS.remove(UpdateListener.class, this);
|
||||
|
||||
// resets
|
||||
WURST.getHax().nukerHack.setId(null);
|
||||
if(!lockId.isChecked())
|
||||
id.setBlock(Blocks.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
// abort if using IDNuker without an ID being set
|
||||
if(mode.getSelected() == Mode.ID
|
||||
&& WURST.getHax().nukerHack.getId() == null)
|
||||
if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR)
|
||||
return;
|
||||
|
||||
// get valid blocks
|
||||
Iterable<BlockPos> validBlocks =
|
||||
getValidBlocks(range.getValue(), mode.getSelected().validator);
|
||||
Iterable<BlockPos> validBlocks = getValidBlocks(range.getValue(),
|
||||
pos -> mode.getSelected().validator.test(this, pos));
|
||||
|
||||
Iterator<BlockPos> autoToolIterator = validBlocks.iterator();
|
||||
if(autoToolIterator.hasNext())
|
||||
@ -124,6 +157,13 @@ public final class SpeedNukerHack extends Hack
|
||||
@Override
|
||||
public void onLeftClick(LeftClickEvent event)
|
||||
{
|
||||
// check mode
|
||||
if(mode.getSelected() != Mode.ID)
|
||||
return;
|
||||
|
||||
if(lockId.isChecked())
|
||||
return;
|
||||
|
||||
// check hitResult
|
||||
if(MC.crosshairTarget == null
|
||||
|| !(MC.crosshairTarget instanceof BlockHitResult))
|
||||
@ -135,35 +175,38 @@ public final class SpeedNukerHack extends Hack
|
||||
|| BlockUtils.getState(pos).getMaterial() == Material.AIR)
|
||||
return;
|
||||
|
||||
// check mode
|
||||
if(mode.getSelected() != Mode.ID)
|
||||
return;
|
||||
|
||||
// set id
|
||||
WURST.getHax().nukerHack.setId(BlockUtils.getName(pos));
|
||||
id.setBlockName(BlockUtils.getName(pos));
|
||||
}
|
||||
|
||||
private enum Mode
|
||||
{
|
||||
NORMAL("Normal", () -> "SpeedNuker", pos -> true),
|
||||
NORMAL("Normal", n -> "SpeedNuker", (n, pos) -> true),
|
||||
|
||||
ID("ID",
|
||||
() -> "IDSpeedNuker [" + WURST.getHax().nukerHack.getId() + "]",
|
||||
pos -> WURST.getHax().nukerHack.getId()
|
||||
.equals(BlockUtils.getName(pos))),
|
||||
n -> "IDSpeedNuker ["
|
||||
+ n.id.getBlockName().replace("minecraft:", "") + "]",
|
||||
(n, pos) -> BlockUtils.getName(pos).equals(n.id.getBlockName())),
|
||||
|
||||
FLAT("Flat", () -> "FlatSpeedNuker",
|
||||
pos -> pos.getY() >= MC.player.getY()),
|
||||
MULTI_ID("MultiID",
|
||||
n -> "MultiIDNuker [" + n.multiIdList.getBlockNames().size()
|
||||
+ (n.multiIdList.getBlockNames().size() == 1 ? " ID]"
|
||||
: " IDs]"),
|
||||
(n, p) -> n.multiIdList.getBlockNames()
|
||||
.contains(BlockUtils.getName(p))),
|
||||
|
||||
SMASH("Smash", () -> "SmashSpeedNuker",
|
||||
pos -> BlockUtils.getHardness(pos) >= 1);
|
||||
FLAT("Flat", n -> "FlatSpeedNuker",
|
||||
(n, pos) -> pos.getY() >= MC.player.getY()),
|
||||
|
||||
SMASH("Smash", n -> "SmashSpeedNuker",
|
||||
(n, pos) -> BlockUtils.getHardness(pos) >= 1);
|
||||
|
||||
private final String name;
|
||||
private final Supplier<String> renderName;
|
||||
private final Predicate<BlockPos> validator;
|
||||
private final Function<SpeedNukerHack, String> renderName;
|
||||
private final BiPredicate<SpeedNukerHack, BlockPos> validator;
|
||||
|
||||
private Mode(String name, Supplier<String> renderName,
|
||||
Predicate<BlockPos> validator)
|
||||
private Mode(String name, Function<SpeedNukerHack, String> renderName,
|
||||
BiPredicate<SpeedNukerHack, BlockPos> validator)
|
||||
{
|
||||
this.name = name;
|
||||
this.renderName = renderName;
|
||||
|
@ -28,8 +28,10 @@ public final class BlockSetting extends Setting
|
||||
{
|
||||
private String blockName = "";
|
||||
private final String defaultName;
|
||||
private final boolean allowAir;
|
||||
|
||||
public BlockSetting(String name, String description, String blockName)
|
||||
public BlockSetting(String name, String description, String blockName,
|
||||
boolean allowAir)
|
||||
{
|
||||
super(name, description);
|
||||
|
||||
@ -38,11 +40,12 @@ public final class BlockSetting extends Setting
|
||||
this.blockName = BlockUtils.getName(block);
|
||||
|
||||
defaultName = this.blockName;
|
||||
this.allowAir = allowAir;
|
||||
}
|
||||
|
||||
public BlockSetting(String name, String blockName)
|
||||
public BlockSetting(String name, String blockName, boolean allowAir)
|
||||
{
|
||||
this(name, "", blockName);
|
||||
this(name, "", blockName, allowAir);
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
@ -57,7 +60,10 @@ public final class BlockSetting extends Setting
|
||||
|
||||
public void setBlock(Block block)
|
||||
{
|
||||
if(block == null || block instanceof AirBlock)
|
||||
if(block == null)
|
||||
return;
|
||||
|
||||
if(!allowAir && block instanceof AirBlock)
|
||||
return;
|
||||
|
||||
String newName = Objects.requireNonNull(BlockUtils.getName(block));
|
||||
@ -97,7 +103,10 @@ public final class BlockSetting extends Setting
|
||||
String newName = JsonUtils.getAsString(json);
|
||||
|
||||
Block newBlock = BlockUtils.getBlockFromName(newName);
|
||||
if(newBlock == null || newBlock instanceof AirBlock)
|
||||
if(newBlock == null)
|
||||
throw new JsonException();
|
||||
|
||||
if(!allowAir && newBlock instanceof AirBlock)
|
||||
throw new JsonException();
|
||||
|
||||
blockName = BlockUtils.getName(newBlock);
|
||||
|
Loading…
Reference in New Issue
Block a user