Fix a few places where the vanilla method was being called instead of the forge one (#7535)

Cleanup javadocs references slightly, fix a couple spots not using the proper forge hooks, and remove a couple unneeded patches
Update deprecation comment on isAir
This commit is contained in:
Sara Freimer authored and GitHub committed 2021-03-03 12:50:32 -08:00
1 parent 17500032ae
commit 9602c22083
12 files changed
+64 -78

No files matched your search

@@ -74,9 +74,9 @@ public interface IForgeBlock
* between 0 and 1.
* <p>
* Note that entities may reduce slipperiness by a certain factor of their own;
* for {@link net.minecraft.entity.EntityLivingBase}, this is {@code .91}.
* {@link net.minecraft.entity.item.EntityItem} uses {@code .98}, and
* {@link net.minecraft.entity.projectile.EntityFishHook} uses {@code .92}.
* for {@link net.minecraft.entity.LivingEntity}, this is {@code .91}.
* {@link net.minecraft.entity.item.ItemEntity} uses {@code .98}, and
* {@link net.minecraft.entity.projectile.FishingBobberEntity} uses {@code .92}.
*
* @param state state of the block
* @param world the world
@@ -84,7 +84,10 @@ public interface IForgeBlock
* @param entity the entity in question
* @return the factor by which the entity's motion should be multiplied
*/
float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity);
default float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity)
{
return getBlock().getSlipperiness();
}
/**
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
@@ -379,7 +382,7 @@ public interface IForgeBlock
/**
* Allows a block to override the standard vanilla running particles.
* This is called from {@link Entity#spawnRunningParticles} and is called both,
* This is called from {@link Entity#handleRunningEffect} and is called both,
* Client and server side, it's up to the implementor to client check / server check.
* By default vanilla spawns particles only on the client and the server methods no-op.
*
@@ -407,7 +410,7 @@ public interface IForgeBlock
* @return True to prevent vanilla digging particles form spawning.
*/
@OnlyIn(Dist.CLIENT)
default boolean addHitEffects(BlockState state, World worldObj, RayTraceResult target, ParticleManager manager)
default boolean addHitEffects(BlockState state, World world, RayTraceResult target, ParticleManager manager)
{
return false;
}
@@ -463,6 +466,7 @@ public interface IForgeBlock
* @param pos Block position in world
* @param source Source plant's position in world
*/
@Deprecated//TODO - 1.17: Remove (unused)
default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (state.isIn(Tags.Blocks.DIRT))
@@ -562,6 +566,7 @@ public interface IForgeBlock
* @param changedBlock The updated block.
* @param changedBlockPos The updated block's position.
*/
@Deprecated//TODO - 1.17: Remove (unused)
default void observedNeighborChange(BlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos){}
/**
@@ -57,9 +57,9 @@ public interface IForgeBlockState
* between 0 and 1.
* <p>
* Note that entities may reduce slipperiness by a certain factor of their own;
* for {@link net.minecraft.entity.EntityLivingBase}, this is {@code .91}.
* {@link net.minecraft.entity.item.EntityItem} uses {@code .98}, and
* {@link net.minecraft.entity.projectile.EntityFishHook} uses {@code .92}.
* for {@link net.minecraft.entity.LivingEntity}, this is {@code .91}.
* {@link net.minecraft.entity.item.ItemEntity} uses {@code .98}, and
* {@link net.minecraft.entity.projectile.FishingBobberEntity} uses {@code .92}.
*
* @param world the world
* @param pos the position in the world
@@ -327,7 +327,7 @@ public interface IForgeBlockState
}
/**
* Allows a block to override the standard vanilla running particles.
* This is called from {@link Entity#spawnRunningParticles} and is called both,
* This is called from {@link Entity#handleRunningEffect} and is called both,
* Client and server side, it's up to the implementor to client check / server check.
* By default vanilla spawns particles only on the client and the server methods no-op.
*
@@ -478,12 +478,12 @@ public interface IForgeBlockState
/**
* Called on an Observer block whenever an update for an Observer is received.
*
* @param observerState The Observer block's state.
* @param world The current world.
* @param pos The Observer block's position.
* @param changed The updated block.
* @param changedPos The updated block's position.
*/
@Deprecated//TODO - 1.17: Remove (unused)
default void observedNeighborChange(World world, BlockPos pos, Block changed, BlockPos changedPos)
{
getBlockState().getBlock().observedNeighborChange(getBlockState(), world, pos, changed, changedPos);
@@ -553,7 +553,7 @@ public interface IForgeBlockState
/**
* @param world The world
* @param pos The position of this state
* @param beaconPos The position of the beacon
* @param beacon The position of the beacon
* @return A float RGB [0.0, 1.0] array to be averaged with a beacon's existing beam color, or null to do nothing to the beam
*/
@Nullable
@@ -594,7 +594,6 @@ public interface IForgeBlockState
}
/**
* @param state The state
* @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
*/
default boolean isSlimeBlock()
@@ -603,7 +602,6 @@ public interface IForgeBlockState
}
/**
* @param state The state
* @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
*/
default boolean isStickyBlock()
@@ -790,7 +788,7 @@ public interface IForgeBlockState
* @param pos The block position in world
* @param player The player clicking the block
* @param stack The stack being used by the player
* @param toolTypes The tool types to be considered when performing the action
* @param toolType The tool type to be considered when performing the action
* @return The resulting state after the action has been performed
*/
@Nullable
@@ -381,11 +381,11 @@ public interface IForgeItem
/**
* Override this to set a non-default armor slot for an ItemStack, but <em>do
* not use this to get the armor slot of said stack; for that, use
* {@link net.minecraft.entity.EntityLiving#getSlotForItemStack(ItemStack)}.</em>
* {@link net.minecraft.entity.LivingEntity#getSlotForItemStack(ItemStack)}.</em>
*
* @param stack the ItemStack
* @return the armor slot of the ItemStack, or {@code null} to let the default
* vanilla logic as per {@code EntityLiving.getSlotForItemStack(stack)}
* vanilla logic as per {@code LivingEntity.getSlotForItemStack(stack)}
* decide
*/
@Nullable
@@ -733,8 +733,8 @@ public interface IForgeItem
*
* @param stack The ItemStack
* @param shield The shield in question
* @param entity The EntityLivingBase holding the shield
* @param attacker The EntityLivingBase holding the ItemStack
* @param entity The LivingEntity holding the shield
* @param attacker The LivingEntity holding the ItemStack
* @retrun True if this ItemStack can disable the shield in question.
*/
default boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker)
@@ -61,7 +61,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* ItemStack sensitive version of getContainerItem. Returns a full ItemStack
* instance of the result.
*
* @param itemStack The current ItemStack
* @return The resulting ItemStack
*/
default ItemStack getContainerItem()
@@ -72,7 +71,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
/**
* ItemStack sensitive version of hasContainerItem
*
* @param stack The current item stack
* @return True if this item has a 'container'
*/
default boolean hasContainerItem()
@@ -168,7 +166,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* 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
*/
@@ -190,10 +187,10 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
/**
* Override this to set a non-default armor slot for an ItemStack, but <em>do
* not use this to get the armor slot of said stack; for that, use
* {@link net.minecraft.entity.EntityLiving#getSlotForItemStack(ItemStack)}.</em>
* {@link net.minecraft.entity.LivingEntity#getSlotForItemStack(ItemStack)}.</em>
*
* @return the armor slot of the ItemStack, or {@code null} to let the default
* vanilla logic as per {@code EntityLiving.getSlotForItemStack(stack)}
* vanilla logic as per {@code LivingEntity.getSlotForItemStack(stack)}
* decide
*/
@Nullable
@@ -206,8 +203,8 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* Can this Item disable a shield
*
* @param shield The shield in question
* @param entity The EntityLivingBase holding the shield
* @param attacker The EntityLivingBase holding the ItemStack
* @param entity The LivingEntity holding the shield
* @param attacker The LivingEntity holding the ItemStack
* @retrun True if this ItemStack can disable the shield in question.
*/
default boolean canDisableShield(ItemStack shield, LivingEntity entity, LivingEntity attacker)
@@ -292,7 +289,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
}
/**
* Called every tick from {@link EntityHorse#onUpdate()} on the item in the
* Called every tick from {@link HorseEntity#onUpdate()} on the item in the
* armor slot.
*
* @param world the world the horse is in
@@ -319,7 +316,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
/**
* Allow or forbid the specific book/item combination as an anvil enchant
*
* @param stack The item
* @param book The book
* @return if the enchantment is allowed
*/
@@ -335,7 +331,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* spawning in the world
*
* @param player The player that dropped the item
* @param item The item stack, before the item is removed.
*/
default boolean onDroppedByPlayer(PlayerEntity player)
{
@@ -378,7 +373,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* Override this method to decide what to do with the NBT data received from
* getNBTShareTag().
*
* @param stack The stack that received NBT
* @param nbt Received NBT, can be null
*/
default void readShareTag(@Nullable CompoundNBT nbt)