mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
fix hand usable check and add block interaction list checking
This commit is contained in:
parent
6a471729d1
commit
82d999c4c5
1 changed files with 3 additions and 5 deletions
|
@ -13,7 +13,6 @@ import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.decoration.DisplayEntity;
|
import net.minecraft.entity.decoration.DisplayEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.consume.UseAction;
|
import net.minecraft.item.consume.UseAction;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
|
@ -35,7 +34,6 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -139,7 +137,7 @@ public class Utl {
|
||||||
// try the default conditions
|
// try the default conditions
|
||||||
if (presets.isBlock() && itemStack.getItem() instanceof BlockItem) return TRUE;
|
if (presets.isBlock() && itemStack.getItem() instanceof BlockItem) return TRUE;
|
||||||
if (presets.isFood() && food.contains(itemStack.getUseAction())) return TRUE;
|
if (presets.isFood() && food.contains(itemStack.getUseAction())) return TRUE;
|
||||||
if (presets.isUsable() && hasItemUse(itemStack)) return TRUE;
|
if (presets.isUsable() && !notUsable.contains(itemStack.getUseAction())) return TRUE;
|
||||||
|
|
||||||
// if nothing else is met, the item is filtered out
|
// if nothing else is met, the item is filtered out
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -166,14 +164,14 @@ public class Utl {
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
|
|
||||||
// make sure that the block that is being sit on has no interaction when hand sitting
|
// make sure that the block that is being sit on has no interaction when hand sitting
|
||||||
if (hit != null && hasInteraction(blockState)) {
|
if (hit != null && blockIsInList(config.getInteractionBlocks(), blockState)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only if custom is enabled
|
// only if custom is enabled
|
||||||
if (config.isCustomEnabled()) {
|
if (config.isCustomEnabled()) {
|
||||||
// if the block is on the blacklist, false
|
// if the block is on the blacklist, false
|
||||||
if (config.getBlacklistedBlocks().stream().anyMatch(c -> c.isValid(blockState))) return null;
|
if (blockIsInList(config.getBlacklistedBlocks(),blockState)) return null;
|
||||||
|
|
||||||
for (SittingBlock sittingBlock : config.getSittingBlocks()) {
|
for (SittingBlock sittingBlock : config.getSittingBlocks()) {
|
||||||
// if the block is valid, true
|
// if the block is valid, true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue