@@ -231,7 +231,7 @@ public static void onItemDamageUncertain(int minAmount, int maxAmount, LivingEnt
231
231
}
232
232
233
233
private static boolean canMaintainPlayerRNG () {
234
- return TempRules .playerRNGMaintenance && TempRules .enchCrackState == EnumCrackState .CRACKED ;
234
+ return TempRules .playerRNGMaintenance && ( TempRules .enchCrackState == EnumCrackState .CRACKED || TempRules . enchCrackState == EnumCrackState . CRACKED_PLAYER_SEED ) ;
235
235
}
236
236
237
237
// RENDERING
@@ -399,7 +399,7 @@ public static void addEnchantmentSeedInfo(World world, EnchantingTableContainer
399
399
400
400
private static void addPlayerRNGInfo (int enchantmentSeed ) {
401
401
EnumCrackState crackState = TempRules .enchCrackState ;
402
- if (crackState == EnumCrackState .CRACKED ) {
402
+ if (crackState == EnumCrackState .CRACKED || crackState == EnumCrackState . CRACKED_PLAYER_SEED ) {
403
403
return ;
404
404
}
405
405
@@ -441,9 +441,10 @@ private static void addPlayerRNGInfo(int enchantmentSeed) {
441
441
public static void onEnchantedItem () {
442
442
doneEnchantment = true ;
443
443
EnumCrackState crackState = TempRules .enchCrackState ;
444
- if (crackState == EnumCrackState .CRACKED ) {
444
+ if (crackState == EnumCrackState .CRACKED || crackState == EnumCrackState . CRACKED_PLAYER_SEED ) {
445
445
possibleXPSeeds .clear ();
446
446
possibleXPSeeds .add (playerRand .nextInt ());
447
+ TempRules .enchCrackState = EnumCrackState .CRACKED ;
447
448
} else if (crackState == EnumCrackState .CRACKED_ENCH_SEED ) {
448
449
possibleXPSeeds .clear ();
449
450
TempRules .enchCrackState = EnumCrackState .CRACKING ;
@@ -460,7 +461,7 @@ public static void onEnchantedItem() {
460
461
*/
461
462
462
463
private static EnchantManipulationStatus manipulateEnchantmentsSanityCheck (PlayerEntity player ) {
463
- if (TempRules .enchCrackState != EnumCrackState .CRACKED ) {
464
+ if (TempRules .enchCrackState != EnumCrackState .CRACKED && TempRules . enchCrackState != EnumCrackState . CRACKED_PLAYER_SEED ) {
464
465
return EnchantManipulationStatus .NOT_CRACKED ;
465
466
} else if (!player .onGround ) {
466
467
return EnchantManipulationStatus .NOT_ON_GROUND ;
@@ -488,7 +489,7 @@ public static EnchantManipulationStatus manipulateEnchantments(Item item,
488
489
int bookshelvesNeeded = 0 ;
489
490
int slot = 0 ;
490
491
int [] enchantLevels = new int [3 ];
491
- outerLoop : for (int i = -1 ; i < 1000 ; i ++) {
492
+ outerLoop : for (int i = TempRules . enchCrackState == EnumCrackState . CRACKED_PLAYER_SEED ? 0 : -1 ; i < 1000 ; i ++) {
492
493
int xpSeed = (int ) ((i == -1 ? seed : ((seed * MULTIPLIER + ADDEND ) & MASK )) >>> 16 );
493
494
Random rand = new Random ();
494
495
for (bookshelvesNeeded = 0 ; bookshelvesNeeded <= 15 ; bookshelvesNeeded ++) {
@@ -772,7 +773,7 @@ private static long getSeed(Random rand) {
772
773
773
774
public static enum EnumCrackState implements StringIdentifiable {
774
775
UNCRACKED ("uncracked" ), CRACKING_ENCH_SEED ("crackingEnchSeed" ), CRACKED_ENCH_SEED ("crackedEnchSeed" ), CRACKING (
775
- "cracking" ), CRACKED ("cracked" ), INVALID ("invalid" );
776
+ "cracking" ), CRACKED ("cracked" ), CRACKED_PLAYER_SEED ( "crackedPlayerSeed" ), INVALID ("invalid" );
776
777
777
778
private String name ;
778
779
0 commit comments