2.1.0 Damage Fix for Ashen Effect
This commit is contained in:
@@ -1,13 +1,18 @@
|
|||||||
package com.acethewildfire.acesbs.item.custom;
|
package com.acethewildfire.acesbs.item.custom;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.AxeItem;
|
import net.minecraft.item.AxeItem;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class SmeltingAxe extends AxeItem {
|
public class SmeltingAxe extends AxeItem {
|
||||||
@@ -15,4 +20,18 @@ public class SmeltingAxe extends AxeItem {
|
|||||||
public SmeltingAxe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
public SmeltingAxe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
||||||
super(material, attackDamage, attackSpeed, settings);
|
super(material, attackDamage, attackSpeed, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) {
|
||||||
|
if (!world.isClient() && miner instanceof PlayerEntity player) {
|
||||||
|
|
||||||
|
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, stack);
|
||||||
|
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
stack.damage(drop.getCount(), miner, EquipmentSlot.MAINHAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.postMine(stack, world, state, pos, miner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
package com.acethewildfire.acesbs.item.custom;
|
package com.acethewildfire.acesbs.item.custom;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
import net.minecraft.recipe.RecipeEntry;
|
|
||||||
import net.minecraft.recipe.RecipeType;
|
|
||||||
import net.minecraft.recipe.SmeltingRecipe;
|
|
||||||
import net.minecraft.recipe.input.SingleStackRecipeInput;
|
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class SmeltingHammer extends HammerItem {
|
public class SmeltingHammer extends HammerItem {
|
||||||
|
|
||||||
public SmeltingHammer(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
public SmeltingHammer(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
||||||
super(material, attackDamage, attackSpeed, settings);
|
super(material, attackDamage, attackSpeed, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) {
|
||||||
|
if (!world.isClient() && miner instanceof PlayerEntity player) {
|
||||||
|
|
||||||
|
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, stack);
|
||||||
|
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
stack.damage(drop.getCount(), miner, EquipmentSlot.MAINHAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.postMine(stack, world, state, pos, miner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,41 @@
|
|||||||
package com.acethewildfire.acesbs.item.custom;
|
package com.acethewildfire.acesbs.item.custom;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
|
import com.acethewildfire.acesbs.AcesBS;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.recipe.RecipeEntry;
|
||||||
|
import net.minecraft.recipe.RecipeType;
|
||||||
|
import net.minecraft.recipe.SmeltingRecipe;
|
||||||
|
import net.minecraft.recipe.input.SingleStackRecipeInput;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class SmeltingPickaxe extends Item {
|
public class SmeltingPickaxe extends Item {
|
||||||
public SmeltingPickaxe(Settings settings) {
|
public SmeltingPickaxe(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) {
|
||||||
|
if (!world.isClient() && miner instanceof PlayerEntity player) {
|
||||||
|
|
||||||
|
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, stack);
|
||||||
|
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
stack.damage(drop.getCount(), miner, EquipmentSlot.MAINHAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.postMine(stack, world, state, pos, miner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
package com.acethewildfire.acesbs.item.custom;
|
package com.acethewildfire.acesbs.item.custom;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.item.AxeItem;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ShovelItem;
|
import net.minecraft.item.ShovelItem;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class SmeltingShovel extends ShovelItem {
|
public class SmeltingShovel extends ShovelItem {
|
||||||
@@ -15,4 +20,18 @@ public class SmeltingShovel extends ShovelItem {
|
|||||||
public SmeltingShovel(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
public SmeltingShovel(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
||||||
super(material, attackDamage, attackSpeed, settings);
|
super(material, attackDamage, attackSpeed, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) {
|
||||||
|
if (!world.isClient() && miner instanceof PlayerEntity player) {
|
||||||
|
|
||||||
|
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, stack);
|
||||||
|
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
stack.damage(drop.getCount(), miner, EquipmentSlot.MAINHAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.postMine(stack, world, state, pos, miner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user