-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
140 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/github/kill05/mixins/disablevanilla/ItemToolPickaxeMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.kill05.mixins.disablevanilla; | ||
|
||
import com.github.kill05.config.ArchitectConfig; | ||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.item.tool.ItemToolPickaxe; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin( | ||
value = ItemToolPickaxe.class, | ||
remap = false | ||
) | ||
public abstract class ItemToolPickaxeMixin { | ||
|
||
@Inject( | ||
method = "canHarvestBlock", | ||
at = @At(value = "HEAD"), | ||
cancellable = true | ||
) | ||
public void canHarvestBlockInject(Block block, CallbackInfoReturnable<Boolean> cir) { | ||
if(ArchitectConfig.getDisableVanillaTools()) cir.setReturnValue(false); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/com/github/kill05/mixins/disablevanilla/ItemToolSwordMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.github.kill05.mixins.disablevanilla; | ||
|
||
import com.github.kill05.config.ArchitectConfig; | ||
import com.github.kill05.utils.ItemUtils; | ||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.entity.Entity; | ||
import net.minecraft.core.item.Item; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.item.tool.ItemToolSword; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import sunsetsatellite.catalyst.core.util.ICustomDescription; | ||
|
||
@Mixin( | ||
value = ItemToolSword.class, | ||
remap = false | ||
) | ||
public abstract class ItemToolSwordMixin extends Item implements ICustomDescription { | ||
|
||
public ItemToolSwordMixin(int id) { | ||
super(id); | ||
} | ||
|
||
@Inject( | ||
method = "getStrVsBlock", | ||
at = @At(value = "HEAD"), | ||
cancellable = true | ||
) | ||
public void getStrVsBlockInject(ItemStack itemstack, Block block, CallbackInfoReturnable<Float> cir) { | ||
if(ArchitectConfig.getDisableVanillaTools()) cir.setReturnValue(1.0f); | ||
} | ||
|
||
@Inject( | ||
method = "isSilkTouch", | ||
at = @At(value = "HEAD"), | ||
cancellable = true | ||
) | ||
public void isSilkTouchInject(CallbackInfoReturnable<Boolean> cir) { | ||
if(ArchitectConfig.getDisableVanillaTools()) cir.setReturnValue(false); | ||
} | ||
|
||
@Inject( | ||
method = "getDamageVsEntity", | ||
at = @At(value = "HEAD"), | ||
cancellable = true | ||
) | ||
public void getDamageVsEntityInject(Entity entity, CallbackInfoReturnable<Integer> cir) { | ||
if(ArchitectConfig.getDisableVanillaTools()) cir.setReturnValue(1); | ||
} | ||
|
||
|
||
@Override | ||
public int getMaxDamage() { | ||
return ArchitectConfig.getDisableVanillaTools() ? 1 : super.getMaxDamage(); | ||
} | ||
|
||
@Override | ||
public String getDescription(ItemStack itemStack) { | ||
return ItemUtils.getDisabledDescription(); | ||
} | ||
|
||
@Override | ||
public String getTranslatedName(ItemStack itemstack) { | ||
return ItemUtils.getDisabledName(super.getTranslatedName(itemstack)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters