Skip to content

Commit

Permalink
fix stacking enchantments, fix dungeon loot having omega, fix village…
Browse files Browse the repository at this point in the history
…rs trading omega
  • Loading branch information
Draylar committed Aug 10, 2020
1 parent d4880a2 commit 59b834a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
loader_version=0.9.0+build.204
# Mod Properties
mod_version=1.0.1-beta
mod_version=1.0.2-beta
maven_group=draylar
archives_base_name=into-the-omega
# Dependencies
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/draylar/intotheomega/mixin/EnchantmentMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,37 @@ public boolean isOmega() {
public Enchantment getVanilla() {
return me_vanilla;
}

@Inject(
method = "isAvailableForEnchantedBookOffer",
at = @At("HEAD"),
cancellable = true
)
private void isAvailableForEnchantedBookOffer(CallbackInfoReturnable<Boolean> cir) {
if(isOmega()) {
cir.setReturnValue(false);
}
}

@Inject(
method = "isAvailableForRandomSelection",
at = @At("HEAD"),
cancellable = true
)
private void isAvailableForRandomSelection(CallbackInfoReturnable<Boolean> cir) {
if(isOmega()) {
cir.setReturnValue(false);
}
}

@Inject(
method = "canAccept",
at = @At("HEAD"),
cancellable = true
)
private void canAccept(Enchantment other, CallbackInfoReturnable<Boolean> cir) {
if(this.isOmega() && this.getVanilla().equals(other)) {
cir.setReturnValue(false);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/intotheomega.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ accessible method net/minecraft/enchantment/SilkTouchEnchantment <init> (Lne
accessible method net/minecraft/enchantment/UnbreakingEnchantment <init> (Lnet/minecraft/enchantment/Enchantment$Rarity;[Lnet/minecraft/entity/EquipmentSlot;)V
accessible method net/minecraft/enchantment/LureEnchantment <init> (Lnet/minecraft/enchantment/Enchantment$Rarity;Lnet/minecraft/enchantment/EnchantmentTarget;[Lnet/minecraft/entity/EquipmentSlot;)V

accessible class net/minecraft/enchantment/EnchantmentHelper$Consumer
accessible class net/minecraft/enchantment/EnchantmentHelper$Consumer
accessible class net/minecraft/village/TradeOffers$EnchantBookFactory

0 comments on commit 59b834a

Please sign in to comment.