79 lines
4.2 KiB
Diff
79 lines
4.2 KiB
Diff
--- a/net/minecraft/inventory/container/EnchantmentContainer.java
|
|
+++ b/net/minecraft/inventory/container/EnchantmentContainer.java
|
|
@@ -56,7 +56,7 @@
|
|
});
|
|
this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) {
|
|
public boolean func_75214_a(ItemStack p_75214_1_) {
|
|
- return p_75214_1_.func_77973_b() == Items.field_196128_bn;
|
|
+ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_230235_a_(p_75214_1_.func_77973_b());
|
|
}
|
|
});
|
|
|
|
@@ -82,40 +82,28 @@
|
|
this.func_216958_a(IntReferenceHolder.func_221497_a(this.field_185002_i, 2));
|
|
}
|
|
|
|
+ private float getPower(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) {
|
|
+ return world.func_180495_p(pos).getEnchantPowerBonus(world, pos);
|
|
+ }
|
|
+
|
|
public void func_75130_a(IInventory p_75130_1_) {
|
|
if (p_75130_1_ == this.field_75168_e) {
|
|
ItemStack itemstack = p_75130_1_.func_70301_a(0);
|
|
if (!itemstack.func_190926_b() && itemstack.func_77956_u()) {
|
|
this.field_217006_g.func_221486_a((p_217002_2_, p_217002_3_) -> {
|
|
- int j = 0;
|
|
+ int power = 0;
|
|
|
|
for(int k = -1; k <= 1; ++k) {
|
|
for(int l = -1; l <= 1; ++l) {
|
|
if ((k != 0 || l != 0) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 0, k)) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 1, k))) {
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k * 2)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k * 2));
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k * 2));
|
|
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k * 2)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
-
|
|
if (l != 0 && k != 0) {
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
-
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
-
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 0, k * 2)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
-
|
|
- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 1, k * 2)).func_203425_a(Blocks.field_150342_X)) {
|
|
- ++j;
|
|
- }
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k));
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k));
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 0, k * 2));
|
|
+ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 1, k * 2));
|
|
}
|
|
}
|
|
}
|
|
@@ -124,12 +112,13 @@
|
|
this.field_75169_l.setSeed((long)this.field_178149_f.func_221495_b());
|
|
|
|
for(int i1 = 0; i1 < 3; ++i1) {
|
|
- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, j, itemstack);
|
|
+ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack);
|
|
this.field_185001_h[i1] = -1;
|
|
this.field_185002_i[i1] = -1;
|
|
if (this.field_75167_g[i1] < i1 + 1) {
|
|
this.field_75167_g[i1] = 0;
|
|
}
|
|
+ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_217002_2_, p_217002_3_, i1, (int)power, itemstack, field_75167_g[i1]);
|
|
}
|
|
|
|
for(int j1 = 0; j1 < 3; ++j1) {
|