Item and NBT patches, IShearable blocks are responsible for setting themselves to air, to allow for setting other states.

This commit is contained in:
LexManos committed 2018-12-03 18:04:37 -08:00
1 parent bf9158172f
commit a3c8e04ee6
92 files changed
+1008 -2205

No files matched your search

@@ -160,7 +160,7 @@ public interface IForgeBlock
* @param pos Block position in world
* @return True if the block should deal damage
*/
default boolean isBurning(IWorldReader world, BlockPos pos)
default boolean isBurning(IBlockState state, IBlockReader world, BlockPos pos)
{
return false;
}
@@ -361,7 +361,7 @@ public interface IForgeBlock
* @param pos Block position in world
* @return True if the block considered air
*/
default boolean isAir(IBlockState state, IWorldReader world, BlockPos pos)
default boolean isAir(IBlockState state, IBlockReader world, BlockPos pos)
{
return state.getMaterial() == Material.AIR;
}
@@ -903,9 +903,9 @@ public interface IForgeBlock
* @return the PathNodeType
*/
@Nullable
default PathNodeType getAiPathNodeType(IBlockState state, IWorldReader world, BlockPos pos)
default PathNodeType getAiPathNodeType(IBlockState state, IBlockReader world, BlockPos pos)
{
return isBurning(world, pos) ? PathNodeType.DAMAGE_FIRE : null;
return state.isBurning(world, pos) ? PathNodeType.DAMAGE_FIRE : null;
}
/**
@@ -310,7 +310,7 @@ public interface IForgeBlockState
* @param pos Block position in world
* @return True if the block considered air
*/
default boolean isAir(IWorldReader world, BlockPos pos)
default boolean isAir(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().isAir(getBlockState(), world, pos);
}
@@ -898,4 +898,28 @@ public interface IForgeBlockState
{
return getBlockState().getBlock().getValidRotations(getBlockState(), world, pos);
}
/**
* Determines if this block should set fire and deal fire damage
* to entities coming into contact with it.
*
* @param world The current world
* @param pos Block position in world
* @return True if the block should deal damage
*/
default boolean isBurning(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().isBurning(getBlockState(), world, pos);
}
/**
* Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior.
*
* @return the PathNodeType
*/
@Nullable
default PathNodeType getAiPathNodeType(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().getAiPathNodeType(getBlockState(), world, pos);
}
}
@@ -162,7 +162,6 @@ public interface IForgeEntity extends ICapabilitySerializable<NBTTagCompound>
/**
* Checks if this {@link Entity} can trample a {@link Block}.
*
* @param block The block being tested
* @param pos The block pos
* @param fallDistance The fall distance
* @return {@code true} if this entity can trample, {@code false} otherwise
@@ -25,6 +25,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.state.BlockWorldState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -149,4 +150,32 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
{
return getStack().getItem().shouldCauseBlockBreakReset(getStack(), newStack);
}
/**
* Checks whether an item can be enchanted with a certain enchantment. This
* applies specifically to enchanting an item in the enchanting table and is
* called when retrieving the list of possible enchantments for an item.
* Enchantments may additionally (or exclusively) be doing their own checks in
* {@link net.minecraft.enchantment.Enchantment#canApplyAtEnchantingTable(ItemStack)};
* check the individual implementation for reference. By default this will check
* if the enchantment type is valid for this item type.
*
* @param stack the item stack to be enchanted
* @param enchantment the enchantment to be applied
* @return true if the enchantment can be applied to this item
*/
default boolean canApplyAtEnchantingTable(Enchantment enchantment)
{
return getStack().getItem().canApplyAtEnchantingTable(getStack(), enchantment);
}
/**
* ItemStack sensitive version of getItemEnchantability
*
* @return the item echantability value
*/
default int getItemEnchantability()
{
return getStack().getItem().getItemEnchantability(getStack());
}
}