21w19a
This commit is contained in:
1 parent
4542612bc8
commit
727bdd7b1a
8 files changed
+32
-31
No files matched your search
@@ -1,25 +1,31 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.MiningToolItem;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.tag.Tag;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
//import org.spongepowered.asm.mixin.injection.At;
|
||||
//import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(PickaxeItem.class)
|
||||
public class PickaxeItem_missingToolsMixin
|
||||
public class PickaxeItem_missingToolsMixin extends MiningToolItem
|
||||
{
|
||||
@Redirect(method = "getMiningSpeedMultiplier", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/BlockState;getMaterial()Lnet/minecraft/block/Material;"
|
||||
))
|
||||
private Material getCustomMaterial(BlockState blockState)
|
||||
{
|
||||
Material material = blockState.getMaterial();
|
||||
|
||||
protected PickaxeItem_missingToolsMixin(float attackDamage, float attackSpeed, ToolMaterial material, Tag<Block> tag, Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, tag, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
Material material = state.getMaterial();
|
||||
if (CarpetSettings.missingTools && material == Material.GLASS)
|
||||
material = Material.STONE;
|
||||
return material;
|
||||
return miningSpeed;
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user