Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 068e339

Browse files
committed
Move default canDisableShield impl to AxeItem
1 parent 6580bc0 commit 068e339

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.extension;
21+
22+
import org.spongepowered.asm.mixin.Mixin;
23+
import net.minecraftforge.common.extensions.IForgeItem;
24+
25+
import net.minecraft.entity.LivingEntity;
26+
import net.minecraft.item.AxeItem;
27+
import net.minecraft.item.ItemStack;
28+
29+
@Mixin(AxeItem.class)
30+
public abstract class MixinAxeItem implements IForgeItem {
31+
@Override
32+
public boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) {
33+
return true;
34+
}
35+
}

patchwork-extensions/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import net.minecraft.entity.attribute.EntityAttributeModifier;
4444
import net.minecraft.entity.mob.MobEntity;
4545
import net.minecraft.entity.player.PlayerEntity;
46-
import net.minecraft.item.AxeItem;
4746
import net.minecraft.item.Item;
4847
import net.minecraft.item.ItemGroup;
4948
import net.minecraft.item.ItemPropertyGetter;
@@ -726,7 +725,7 @@ default String getCreatorModId(ItemStack itemStack) {
726725
* @return True if this ItemStack can disable the shield in question.
727726
*/
728727
default boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) {
729-
return this instanceof AxeItem;
728+
return false;
730729
}
731730

732731
// TODO: Call locations: Patches: MobEntity, PlayerEntity, Forge classes: IForgeItemStack

patchwork-extensions/src/main/resources/patchwork-extensions.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"compatibilityLevel": "JAVA_8",
55
"mixins": [
66
"ItemTagsAccessor",
7+
"MixinAxeItem",
78
"MixinEnchantedBookItem",
89
"MixinEntityType",
910
"MixinEntityTypeBuilder",

0 commit comments

Comments
 (0)