mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Add function to add items with the same behavior as the pumpkin for enderman (#6890)
This commit is contained in:
1 parent
68e71009f3
commit
a567ddaa10
5 files changed
+77
-1
No files matched your search
@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -36,6 +37,7 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.monster.EndermanEntity;
|
||||
import net.minecraft.entity.monster.piglin.PiglinTasks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
@@ -814,4 +816,18 @@ public interface IForgeItem
|
||||
default <T extends LivingEntity> int damageItem(ItemStack stack, int amount, T entity, Consumer<T> onBroken) {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this Item can be used to hide player head for enderman.
|
||||
*
|
||||
* @param stack the ItemStack
|
||||
* @param player The player watching the enderman
|
||||
* @param endermanEntity The enderman that the player look
|
||||
* @return true if this Item can be used to hide player head for enderman
|
||||
*/
|
||||
default boolean isEnderMask(ItemStack stack, PlayerEntity player, EndermanEntity endermanEntity)
|
||||
{
|
||||
return stack.getItem() == Blocks.CARVED_PUMPKIN.asItem();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.monster.EndermanEntity;
|
||||
import net.minecraft.util.CachedBlockInfo;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
@@ -473,4 +474,16 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
|
||||
{
|
||||
return getStack().getItem().makesPiglinsNeutral(getStack(), wearer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this Item can be used to hide player head for enderman.
|
||||
*
|
||||
* @param player The player watching the enderman
|
||||
* @param endermanEntity The enderman that the player look
|
||||
* @return true if this Item can be used.
|
||||
*/
|
||||
default boolean isEnderMask(PlayerEntity player, EndermanEntity endermanEntity)
|
||||
{
|
||||
return getStack().getItem().isEnderMask(getStack(), player, endermanEntity);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user