mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Fix Search targeting air blocks
This commit is contained in:
parent
100d7ae885
commit
5ff8e6d143
@ -14,6 +14,7 @@ import java.util.Set;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
|
|
||||||
|
import net.minecraft.block.AirBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.wurstclient.WurstClient;
|
import net.wurstclient.WurstClient;
|
||||||
import net.wurstclient.clickgui.BlockComponent;
|
import net.wurstclient.clickgui.BlockComponent;
|
||||||
@ -56,6 +57,9 @@ public final class BlockSetting extends Setting
|
|||||||
|
|
||||||
public void setBlock(Block block)
|
public void setBlock(Block block)
|
||||||
{
|
{
|
||||||
|
if(block == null || block instanceof AirBlock)
|
||||||
|
return;
|
||||||
|
|
||||||
String newName = Objects.requireNonNull(BlockUtils.getName(block));
|
String newName = Objects.requireNonNull(BlockUtils.getName(block));
|
||||||
|
|
||||||
if(blockName.equals(newName))
|
if(blockName.equals(newName))
|
||||||
@ -93,7 +97,7 @@ public final class BlockSetting extends Setting
|
|||||||
String newName = JsonUtils.getAsString(json);
|
String newName = JsonUtils.getAsString(json);
|
||||||
|
|
||||||
Block newBlock = BlockUtils.getBlockFromName(newName);
|
Block newBlock = BlockUtils.getBlockFromName(newName);
|
||||||
if(newBlock == null)
|
if(newBlock == null || newBlock instanceof AirBlock)
|
||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
|
|
||||||
blockName = BlockUtils.getName(newBlock);
|
blockName = BlockUtils.getName(newBlock);
|
||||||
|
Loading…
Reference in New Issue
Block a user