Ive been trying everything online and have yet to find it. Heres my code. Please tell me what to fix Im so confused.
private void loadProtectionEnchant() {
    
    int protectionID = 0;
    
    try {
        Field id = net.minecraft.server.v1_8_R3.Enchantment.class.getDeclaredField("byId");
        Field protEnchant = Enchantment.class.getDeclaredField("PROTECTION_ENVIRONMENTAL");
        
        id.setAccessible(true);
        protEnchant.setAccessible(true);
        
         Object[] byID = (Object[]) id.get(null);
        byID[protectionID] = null;
        
        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersField.setAccessible(true);
        modifiersField.setInt(id, id.getModifiers() & ~Modifier.FINAL & ~Modifier.PRIVATE);
        id.setAccessible(true);
        System.out.println(byID.toString());
        
        System.out.println(id.toString());
        
        id.set(null, byID);
        protEnchant.set(null, new CustomProtectionEnchantment(protectionID, new MinecraftKey("protection"), 10, 0));
        
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
    
    System.out.println(Enchantment.PROTECTION_ENVIRONMENTAL.toString());
    
}
and heres my error
java.lang.IllegalAccessException: Can not set static final [Lnet.minecraft.server.v1_8_R3.Enchantment; field net.minecraft.server.v1_8_R3.Enchantment.byId to [Lnet.minecraft.server.v1_8_R3.Enchantment;
Please tell me if u know whats wrong TY.
